On 8/31/15 6:56 AM, Massi wrote:
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
unfortunately we have this as a "bug" in OurSQL that they don't properly
support the TIME datatype in MySQL.
everything's ok. Of course I NEED to use oursql.
I'd revisit that decision because OurSQL hasn't had a release in four
years - it's a dead project.
There is a very wide variety of actively maintained, production quality
MySQL drivers, supporting Python 2, Python 3, pure Python, and pure C,
you name it. I'd look at PyMySQL and mysqlclient-python:
https://github.com/PyMySQL/PyMySQL
https://github.com/PyMySQL/mysqlclient-python
--
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.