Re: [sqlalchemy] MySQL's sql_mode (ORM)

2018-02-09 Thread Simon King
On Tue, Feb 6, 2018 at 7:08 PM, wrote: > If I were to go into my MySQL DB and > > mysql> SET GLOBAL sql_mode='STRICT_TRANS_TABLES'; > > would that have the same effect? I find the MySQL documentation somewhat > lacking on that topic. What are the scope and lifetime of the

Re: [sqlalchemy] MySQL's sql_mode (ORM)

2018-02-06 Thread jens . troeger
If I were to go into my MySQL DB and mysql> SET GLOBAL sql_mode='STRICT_TRANS_TABLES'; would that have the same effect? I find the MySQL documentation somewhat lacking on that topic. What are the scope and lifetime of the above vs. using

[sqlalchemy] MySQL's sql_mode (ORM)

2014-02-05 Thread Staszek
Hi How do you set sql_mode when using SQLAlchemy ORM with MySQL? For example, I would like to be able to do something equivalent to this: SET sql_mode = 'STRICT_ALL_TABLES'; so as to get an error (instead of a warning) when string length exceeds column size on INSERT. Ideally I would like to

Re: [sqlalchemy] MySQL's sql_mode (ORM)

2014-02-05 Thread Jonathan Rogers
Staszek wrote: Hi How do you set sql_mode when using SQLAlchemy ORM with MySQL? For example, I would like to be able to do something equivalent to this: SET sql_mode = 'STRICT_ALL_TABLES'; I don't know if SQLAlchemy has any specific support for this MySQL feature since I use PostgreSQL,

Re: [sqlalchemy] MySQL's sql_mode (ORM)

2014-02-05 Thread Michael Bayer
here’s a recipe for emitting that SQL on every connection, as well as right up front on first connect which is optional, though if you plan on changing ANSI_QUOTES would need to happen before the dialect checks on sql_mode: from sqlalchemy import create_engine, event eng =

Re: [sqlalchemy] MySQL's sql_mode (ORM)

2014-02-05 Thread Jonathan Vanasco
you can pass custom connect arguments to the DBAPI in `create_engine`. http://docs.sqlalchemy.org/en/rel_0_9/faq.html?#how-do-i-pass-custom-connect-arguments-to-my-database-api depending on which driver you use, it will be different. you shouldn't use `text`, because sqlalchemy

Re: [sqlalchemy] MySQL's sql_mode (ORM)

2014-02-05 Thread Jonathan Vanasco
just to clarify... mysqldb - `connect` accepts a `sql_mode` string: http://mysql-python.sourceforge.net/MySQLdb.html pymysql accepts it too https://github.com/PyMySQL/PyMySQL/blob/3576863f9cd0b66ce6c8b32ab3448ab68f55f489/pymysql/connections.py oursql: i couldn't find it