Hi,
I see the following messages during initialization of the engine. I'm
using pymysql.
SHOW VARIABLES LIKE 'sql_mode'
SELECT VERSION()
SELECT DATABASE()
SELECT @@transaction_isolation
show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin'
SELECT CAST('test plain returns' AS CHAR(60)) AS anon_1
SELECT CAST('test unicode returns' AS CHAR(60)) AS anon_1
SELECT CAST('test collated returns' AS CHAR CHARACTER SET utf8) COLLATE
utf8_bin AS anon_1
It appears on the 1st call to set up the engine, I get this series of
messages back.
I have the following command
engine = sqlalchemy.create_engine(self.connstring)
I have tried: create_engine(self.connstring, echo_pool=False, echo=False)
I traced this down to self.__connect(first_connect_check=True)
It calls base.__init__ which calls raw_connection
- which calls base._wrap_poop_connect
- which calls pool.unique_connection
- which calls pool._checkout
- _wrap_pool_connect
- pool._do_get
- starts to return: self._create_connection()
- to return: _ConnectionRecord(self)
- _ConnectionRecord __init__:
calls
- pool self.__connect( first_connect_check=True)
calls pymysql Connect
returns self.dbapi.connect(*cargs, **cparams) <- cparams contains the
connection string parameters.
returns dialect.connect(*cargs, **cparams)
to pool 671: connection = pool._invoke_creator(self)
pool 679 if first_connect_check:
681 exec_once(self.connection, self)
attr exec_once which is from _CompoundListener _ListenerCollection:
<sqlalchemy.event.attr._ListenerCollection object at 0x0000014EDA188748>
executes a function fn which goes to langhelpers go if once:
where once contains:
<class 'list'>: [<function
DefaultEngineStrategy.create.<locals>.first_connect at 0x000001B3A579E598>]
dialect.initialize
It then calls self._detect_sql_mode(connection)
which prints the line: SHOW VARIABLES LIKE 'sql_mode' and
SHOW VARIABLES LIKE 'sql_mode'
SELECT VERSION()
SELECT DATABASE()
SELECT @@transaction_isolation
show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin'
SELECT CAST('test plain returns' AS CHAR(60)) AS anon_1
SELECT CAST('test unicode returns' AS CHAR(60)) AS anon_1
SELECT CAST('test collated returns' AS CHAR CHARACTER SET utf8) COLLATE
utf8_bin AS anon_1
I'm guessing there must be some switch in PyMySQL - but I don't know.
Thanks for any help.
Cheers,
Rich
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.