[Sqlalchemy-tickets] [sqlalchemy] #2937: document the "insert" flag for event.listen and add exampl
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2014-02-05 22:07:28
|
#2937: document the "insert" flag for event.listen and add example regarding
setting flags, also mention this re: mysql sql_mode
---------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.3
Component: documentation | Severity: minor - half an hour
Keywords: | Progress State: in queue
---------------------------+---------------------------------------
{{{
from sqlalchemy import create_engine, event
eng = create_engine("mysql://scott:tiger@localhost/test", echo='debug')
@event.listens_for(eng, "first_connect", insert=True) # make sure we're
the very first thing
@event.listens_for(eng, "connect")
def connect(dbapi_connection, connection_record):
cursor = dbapi_connection.cursor()
cursor.execute("SET sql_mode = 'STRICT_ALL_TABLES'")
conn = eng.connect()
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2937>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|