without seeing a full example, its looking like a mysql bug.  SA's
datetime implementation for MySQL doesnt do any conversion from return
value since MySQLDB handles that task.  whereas the sqlite dialect in
SA *does* do conversion since sqlite doesnt handle that.

Below my small example (It doesn't clarify where the problem is)
I hope someone else will check it, with other databases too (postgres,
for example)
I hope it can help

My results:
sqlite_engine (True, True)
mysql_engine (False, False)


My configuration:
debian etch
sqlite 3
sqlalchemy trunk Revision: 2212
mysql 5.0.30
python 2.4.4

Alessandro

PS: I hope this email will keep identation. I have also put this test in
http://pastebin.com/861936



import datetime
from sqlalchemy import *

def check(engine):
   mytest = Table('mytest', engine,
             Column('date', DateTime, primary_key=True, \
                    default=datetime.datetime.now))
   try:
       mytest.drop()
   except:
       pass
   mytest.create()
   mytest.insert().execute()

   tt = mytest.alias('tt')
   selTagged = select([tt.c.date,
                 select([tt.c.date],
                        tt.c.date==mytest.c.date,
                        from_obj=[mytest],
                        limit=1, offset=0,
                        scalar=True).label('last_mod')] )
   #Note: 'text' need typemap
   selText  = text(selTagged.__str__(), engine, \
                   typemap={'last_mod':types.DateTime})
   def isdatetime(sel):
       return isinstance(sel.execute().fetchone().last_mod, \
                         datetime.datetime)
   return isdatetime(selTagged), isdatetime(selText)

sqlite_engine = create_engine('sqlite:///database_test.db')
mysql_engine =  create_engine('mysql://[EMAIL PROTECTED]/xxx')
print "sqlite_engine", check(sqlite_engine)
print "mysql_engine", check(mysql_engine)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to