2010-04-01から1ヶ月間の記事一覧

first() one()

Page not found — SQLAlchemy 1.3 Documentation first() Return the first result of this Query or None if the result doesn’t contain any row. This results in an execution of the underlying query.one() Return exactly one result or raise an exc…

lazy はキャッシュしない方が

The issue I ran into with the above code dealt with related tables. The default behavior for SQLAlchemy is for related table attributes to be lazy-loaded. Once the orm object has been detached from session, the related attribute no longer …

sqlalchemy

("param:").params(param=arg) はプレースホルダ "%s" % (arg) は置換 なので前者はエスケープあり、後者はなし → 確認params()を使った場合のsubquery()の動作http://www.braindonor.net/coding-blog/sqlalchemy-and-memcached/151/

postgres temp function

PostgreSQL:一時関数 create temp function | 作業日報 一時的な関数を利用したい場合は pg_tempスキーマを利用できる、但しVer 8.2.4以降。 drop function if exists pg_temp.test(int);create function pg_temp.test(int) returns integer as $$ begin ret…

postgres 年齢計算

やっべー これは便利だ。 - しすてむ さんぽみち。 age(datetime,datetime) 例: age('now','1957-06-13'::datetime) ::datetime がきかないときは ::timestamp で試して見ましょう! ↑は何歳何ヶ月・・・みたいにでるので 年齢だけとりたい場合は下記のよう…