Hi,
I'have a problem with scalar selects: they return a wrong column type Here a small example (obviusly it has no sense..)

res = enginedb.execute("""
SELECT w2.id,
 (SELECT w2t.creation_date AS creation_date
  FROM wkstate AS w2t  where w2t.id=w2.id
  LIMIT 1 OFFSET 0)
FROM wkstate AS w2
""").fetchone()

print type(res[1]) => str but creation_date is a DateTime type!

If I run only the previusly scalar query (alone), it works right: res = enginedb.execute("""
SELECT w2t.creation_date AS creation_date
  FROM wkstate AS w2t
  LIMIT 1 OFFSET 0
"").fetchone()
print type(res[0]) => <type 'datetime.datetime'>
typemap

What appened? How I can solve?

I tried with the 'tagged' sqlalchemy query style, using label and typemap:
res = select([w2.c.id,  #w2 is an alias of the table
       select( ...).label('tmp')
      ).execute(typemap={'tmp':types.DateTime}).fetchall()

but it doesn't work.

Thanks

Alessandro


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



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