Hi everyone,
I'm trying to use oursql module with sqlalchemy (0.9.10) for managing a
table with TIME columns, but I'm encountering an error, here a code snippet
showing the problem:
import sqlalchemy
from sqlalchemy import select, create_engine, MetaData, Table, Column
import datetime
engine = create_engine('mysql+oursql://root:password@localhost/test')
metadata = MetaData(engine)
t = Table('mysql_time', metadata,
Column('t1', sqlalchemy.dialects.mysql.TIME())
)
t.create()
t.insert().values(t1=datetime.time(8, 37, 35)).execute()
res = select([t.c.t1]).execute().fetchall()
for i, row in enumerate(res):
res[i] = list(row)
If you run the code, you will get the following error:
Traceback (most recent call last):
File "C:\Users\Impara 01\Desktop\t.py", line 15, in <module>
res[i] = list(row)
File "C:\Python27\lib\site-packages\sqlalchemy\dialects\mysql\base.py",
line 1003, in process
microseconds = value.microseconds
AttributeError: 'datetime.time' object has no attribute 'microseconds'
Process terminated with an exit code of 1
If you run the code changing the engine creation to:
engine = create_engine('mysql://root:password@localhost/test')
everything's ok. Of course I NEED to use oursql.
Is it a bug? or am i missing something?
Thanks in advance!
--
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.