Hi all,

I'm not sure if its a bug or an intended feature, but the default behaviour
of sqlalchemy when reading Oracle DATE fields is annoying. cx_Oracle
rightfully returns datetime.datetime objects, but Sqlalchemy truncates this
to datetime.date objects.

Why is it done like this (in lib/sqlalchemy/databases/oracle.py:34-60)?
Wouldn't it be a better choice to default to OracleDateTime instead of 
OracleDate
for queries without bound metadata?

Its not a (major) problem when querying via a table object, where i can override
the column type with a sane version (OracleDateTime), but for queries directly
using conn.execute() its ugly.

Basically this throws up:

import sqlalchemy as sa
import datetime
engine = sa.create_engine('oracle://scott:[EMAIL PROTECTED]')
conn = engine.connect()
conn.execute('create table dtest (a DATE)')
# insert a row with date and time
now = datetime.datetime(2007,12,11,13,11,00)
conn.execute('insert into dtest values (:dt)', {'dt':now})
# check its there
rows = conn.execute('select a from dtest where a=:dt',{'dt':now})
for r in rows:
     if rows[0]==now:
        print "Found"
     else:
        print "Not Found"

This prints 'Not Found' even though the row is there and is returned correctly
by cx_Oracle.

I would expect to get at least identity for this.

So is this a bug and should i add a report or is it a 'feature' of some kind 
and will
not change even if i report a bug?

Michael

-- 
Michael Schlenker
Software Engineer

CONTACT Software GmbH           Tel.:   +49 (421) 20153-80
Wiener Straße 1-3               Fax:    +49 (421) 20153-41
28359 Bremen
http://www.contact.de/          E-Mail: [EMAIL PROTECTED]

Sitz der Gesellschaft: Bremen | Geschäftsführer: Karl Heinz Zachries
Eingetragen im Handelsregister des Amtsgerichts Bremen unter HRB 13215


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