Here another difference between Oracle and PostgreSQL
The SQLAlchemy.func.max() on a column date, returns a datetime.date in pg but a datetime.datetime in oracle...
Why this difference?


take a look:

Bolletta = Table('bolletta', database.metadata,
   Column('id',   Integer, nullable=False, primary_key=True),
   Column('data', Date)
   )


postgres session | oracle session
---------------------------------------------------------------|---------------------------------------------------------------
In [1]: from sqlalchemy import select, func | In [1]: from sqlalchemy import select, func
                                                              |
In [2]: select([Bolletta.c.data]).execute().scalar() | In [2]: select([Bolletta.c.data]).execute().scalar() SELECT bolletta.data FROM bolletta | SELECT bolletta.data FROM bolletta
                                                              |
Out[2]: datetime.date(2007, 12, 31) | Out[2]: datetime.date(2010, 4, 7)
                                                              |
In [3]: select([func.max(Bolletta.c.data)]).execute().scalar() | In [3]: select([func.max(Bolletta.c.data)]).execute().scalar() SELECT max(bolletta.data) FROM bolletta | SELECT max(bolletta.data) FROM bolletta
                                                              |
Out[3]: datetime.date(2010, 4, 7) | Out[3]: *datetime.datetime(*2010, 4, 7, 0, 0),)
---------------------------------------------------------------|---------------------------------------------------------------


j

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
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