python - How to specify the PostgreSQL DateStyle property with SQLAlchemy ORM -


postgresql supports specifying date formats using datestyle property mentioned here, http://www.postgresql.org/docs/current/interactive/runtime-config-client.html#guc-datestyle. (link 8.3 version of docs).

i not find sqlalchemy orm documentation reference on how define property. possible it?

sqlalchemy makes use of dbapi, psycopg2, marshal date values , python datetime objects - can format/parse way want using standard python techniques. no database-side date formatting features needed.

if want set variable, can execute pg's set statement:

conn = engine.connect() conn.execute("set datestyle='somestring'") # work conn 

to make global connections:

from sqlalchemy import event sqlalchemy.engine import engine  @event.listens_for(engine, "connect") def connect(dbapi_connection, connection_record):     cursor = dbapi_connection.cursor()     cursor.execute("set datestyle='somestring'")     cursor.close() 

Comments

Popular posts from this blog

javascript - Image onload event not firing in firefox -

android - getbluetoothservice() called with no bluetoothmanagercallback -

ios - AVAssetExportSession ignoring videoComposition rotation & stripping metadata -