I'm not sure if this is a bug, please bear with me.
I just switched to oursql 0.9.2 from mysqldb 1.2.2. Running Python 2.6 on win32. I am using SQLAlchemy 0.6.6. I didn't change my code, just the SQLalchemy import statements. I am now getting a bunch of exceptions.
Traceback (most recent call last):
File "c:\Python26\Lib\threading.py", line 532, in __bootstrap_inner
self.run()
File "c:\users\jlaughlin\documents\smartview-svn\python\branches\python2.6\smartview\eventd\eventd.py", line 470, in r
un
self.device.process()
File "c:\users\jlaughlin\documents\smartview-svn\python\branches\python2.6\smartview\eventd\eventd.py", line 363, in p
rocess
event_logger.process()
File "c:\users\jlaughlin\documents\smartview-svn\python\branches\python2.6\smartview\eventd\eventlogger.py", line 69,
in process
conn = dls.connection()
File "c:\Python26\lib\site-packages\sqlalchemy\orm\session.py", line 656, in connection
return self._connection_for_bind(self.get_bind(mapper, clause))
File "c:\Python26\lib\site-packages\sqlalchemy\orm\session.py", line 660, in _connection_for_bind
return self.transaction._connection_for_bind(engine)
File "c:\Python26\lib\site-packages\sqlalchemy\orm\session.py", line 336, in _connection_for_bind
conn = bind.contextual_connect()
File "c:\Python26\lib\site-packages\sqlalchemy\engine\base.py", line 1829, in contextual_connect
self.pool.connect(),
File "c:\Python26\lib\site-packages\sqlalchemy\pool.py", line 182, in connect
return _ConnectionFairy(self).checkout()
File "c:\Python26\lib\site-packages\sqlalchemy\pool.py", line 369, in __init__
rec = self._connection_record = pool.get()
File "c:\Python26\lib\site-packages\sqlalchemy\pool.py", line 213, in get
return self.do_get()
File "c:\Python26\lib\site-packages\sqlalchemy\pool.py", line 732, in do_get
con = self.create_connection()
File "c:\Python26\lib\site-packages\sqlalchemy\pool.py", line 147, in create_connection
return _ConnectionRecord(self)
File "c:\Python26\lib\site-packages\sqlalchemy\pool.py", line 258, in __init__
l.first_connect(self.connection, self)
File "c:\Python26\lib\site-packages\sqlalchemy\engine\strategies.py", line 151, in first_connect
dialect.initialize(c)
File "c:\Python26\lib\site-packages\sqlalchemy\dialects\mysql\oursql.py", line 188, in initialize
connection.execution_options(_oursql_plain_query=True)
File "c:\Python26\lib\site-packages\sqlalchemy\dialects\mysql\base.py", line 1753, in initialize
default.DefaultDialect.initialize(self, connection)
File "c:\Python26\lib\site-packages\sqlalchemy\engine\default.py", line 159, in initialize
self.returns_unicode_strings = self._check_unicode_returns(connection)
File "c:\Python26\lib\site-packages\sqlalchemy\engine\default.py", line 205, in _check_unicode_returns
unicode_for_varchar = check_unicode(sqltypes.VARCHAR(60))
File "c:\Python26\lib\site-packages\sqlalchemy\engine\default.py", line 198, in check_unicode
row = cursor.fetchone()
File "cursor.pyx", line 185, in oursql.Cursor.fetchone (oursqlx\oursql.c:16162)
File "statement.pyx", line 541, in oursql._Statement.fetchone (oursqlx\oursql.c:11281)
InterfaceError: (None, 'truncated column 0, type 253', None)
Also this one:
Traceback (most recent call last):
File "c:\users\jlaughlin\documents\smartview-svn\python\branches\python2.6\smartview\eventd\eventlogger.py", line 91,
in run
queuedevts = dls.query(model.EventQueue).order_by(model.EventQueue.idx).all()
File "c:\Python26\lib\site-packages\sqlalchemy\orm\query.py", line 1579, in all
return list(self)
File "c:\Python26\lib\site-packages\sqlalchemy\orm\query.py", line 1791, in instances
fetch = cursor.fetchall()
File "c:\Python26\lib\site-packages\sqlalchemy\engine\base.py", line 2504, in fetchall
self.cursor, self.context)
File "c:\Python26\lib\site-packages\sqlalchemy\engine\base.py", line 2498, in fetchall
l = self.process_rows(self._fetchall_impl())
File "c:\Python26\lib\site-packages\sqlalchemy\engine\base.py", line 2465, in _fetchall_impl
return self.cursor.fetchall()
File "cursor.pyx", line 228, in oursql.Cursor.fetchall (oursqlx\oursql.c:16568)
File "statement.pyx", line 550, in oursql._Statement.fetchall (oursqlx\oursql.c:11377)
File "statement.pyx", line 541, in oursql._Statement.fetchone (oursqlx\oursql.c:11281)
InterfaceError: (InterfaceError) (None, 'truncated column 0, type 3', None) None None
Sorry, I changed the sqlalchemy URLs, not the import statements.
FWIW I turned echo on, here's the log leading up to the second exception:
2011-02-04 11:40:41,437 INFO sqlalchemy. engine. base.Engine. 0x...8490 BEGIN (implicit) engine. base.Engine. 0x...8490 SELECT event_queue.idx AS event_queue_idx engine. base.Engine. 0x...8490 () engine. base.Engine. 0x...8490 Col ('event_ queue_idx' ,) 04T11:40: 41|eventd| ERROR |Exception in RemoteDBThread jlaughlin\ documents\ smartview- svn\python\ branches\ python2. 6\smartview\ eventd\ eventlogger. py", line 91, model.EventQueu e).order_ by(model. EventQueue. idx).all( ) lib\site- packages\ sqlalchemy\ orm\query. py", line 1579, in all lib\site- packages\ sqlalchemy\ orm\query. py", line 1791, in instances lib\site- packages\ sqlalchemy\ engine\ base.py" , line 2504, in fetchall lib\site- packages\ sqlalchemy\ engine\ base.py" , line 2498, in fetchall rows(self. _fetchall_ impl()) lib\site- packages\ sqlalchemy\ engine\ base.py" , line 2465, in _fetchall_impl fetchall( ) Cursor. fetchall (oursqlx\ oursql. c:16568) _Statement. fetchall (oursqlx\ oursql. c:11377) _Statement. fetchone (oursqlx\ oursql. c:11281)
2011-02-04 11:40:41,443 INFO sqlalchemy.
FROM event_queue ORDER BY event_queue.idx
2011-02-04 11:40:41,444 INFO sqlalchemy.
2011-02-04 11:40:41,446 DEBUG sqlalchemy.
2011-02-
Traceback (most recent call last):
File "c:\users\
in run
queuedevts = dls.query(
File "c:\Python26\
return list(self)
File "c:\Python26\
fetch = cursor.fetchall()
File "c:\Python26\
self.cursor, self.context)
File "c:\Python26\
l = self.process_
File "c:\Python26\
return self.cursor.
File "cursor.pyx", line 228, in oursql.
File "statement.pyx", line 550, in oursql.
File "statement.pyx", line 541, in oursql.
InterfaceError: (InterfaceError) (None, 'truncated column 0, type 3', None) None None
This table is trivial: .`event_ queue` ( queue_ibfk_ 1` FOREIGN KEY (`idx`) REFERENCES `events2` (`idx`)
CREATE TABLE `rtu_prod`
`idx` int(11) NOT NULL,
PRIMARY KEY (`idx`),
CONSTRAINT `event_
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
every record appears to be populated with a normal int.