the above query you are issuing straight textual SQL.  SA has no clue
what types to return and it has no say in it - the inconsistent
behavior above originates within your database/DBAPI (which you havent
told me which one it is).

I'm using Mysql5
A very simple table that give me problems:
mytest = Table('mytest', enginedb_test,
             Column('id', Integer, primary_key=True, nullable=False),
             Column('creation_date', DateTime, default=datetime.datetime.now),
             mysql_engine='InnoDB')


you can issue textual sql using the typemap parameter to text():

s = text("some sql", typemap={'x':types.DateTime})

It doesn't work; result is a 'str' type

res = sq.text("""
SELECT w2.id,
 (SELECT w2t.creation_date AS creation_date
  FROM mytest AS w2t  where w2t.id=w2.id
LIMIT 1 OFFSET 0) as last_mod
FROM mytest AS w2
""", enginedb_test, typemap={'last_mod':sq.types.DateTime}).execute().fetchone()

special.  the text clause above should work better (or at least is
intended for this scenario).   also the type should be propigated
through the label() youre creating above, i thought perhaps it might
not but i added a test case in 2206 that shows it does.

Yes, the test works fine!

I tried to switch db engine: it works for sqlite, it doesn't for mysql...

#works
enginedb_test = create_engine('sqlite:///database_test.db')
=> (1, datetime.datetime(2007, 1, 17, 14, 33, 21, 483043))

#doen't work
enginedb_test =  create_engine('mysql://name:[EMAIL PROTECTED]/dbname')
=> (1L, '2007-01-17 14:30:20')

It is a mysql engine bug?


Thanks for your help

Alessandro



------------------------------------------------------
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://click.libero.it/infostrada17gen07



--~--~---------~--~----~------------~-------~--~----~
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