Here's another simple testcase that fails for Oracle beta5 but works
with 0.3.7. It's about the simplest query I can come up with. Have a
table with a date column in it and query against it using the
"to_date" function.
def test_to_date():
start_date = '10/05/04'
where = cal_dim.c.adwkenddt == func.to_date(start_date,'MM/DD/RR')
query = select([cal_dim.c.adwkenddt],
whereclause=where
)
result = query.execute()
for r in result:
print r
This fails for beta5, works for .3.7. The error is::
Traceback (most recent call last):
File "s4.py", line 88, in ?
test_to_date()
File "s4.py", line 59, in test_to_date
result = query.execute()
File
"/home/matt/work/vpython/lib/python2.4/site-packages/SQLAlchemy-0.4.0beta5-py2.4.egg/sqlalchemy/sql/expression.py",
line 973, in execute
return compiled.execute(*multiparams, **params)
File
"/home/matt/work/vpython/lib/python2.4/site-packages/SQLAlchemy-0.4.0beta5-py2.4.egg/sqlalchemy/engine/base.py",
line 488, in execute
return e._execute_compiled(self, multiparams, params)
File
"/home/matt/work/vpython/lib/python2.4/site-packages/SQLAlchemy-0.4.0beta5-py2.4.egg/sqlalchemy/engine/base.py",
line 1121, in _execute_compiled
return connection._execute_compiled(compiled, multiparams, params)
File
"/home/matt/work/vpython/lib/python2.4/site-packages/SQLAlchemy-0.4.0beta5-py2.4.egg/sqlalchemy/engine/base.py",
line 832, in _execute_compiled
self.__execute_raw(context)
File
"/home/matt/work/vpython/lib/python2.4/site-packages/SQLAlchemy-0.4.0beta5-py2.4.egg/sqlalchemy/engine/base.py",
line 850, in __execute_raw
self._cursor_execute(context.cursor, context.statement,
parameters, context=context)
File
"/home/matt/work/vpython/lib/python2.4/site-packages/SQLAlchemy-0.4.0beta5-py2.4.egg/sqlalchemy/engine/base.py",
line 867, in _cursor_execute
raise exceptions.DBAPIError.instance(statement, parameters, e)
sqlalchemy.exceptions.DatabaseError: (DatabaseError) ORA-00932:
inconsistent datatypes: expected NUMBER got CLOB
'SELECT "AD_WEEK_CALENDAR_DIM".adwkenddt \nFROM
"AD_WEEK_CALENDAR_DIM" \nWHERE "AD_WEEK_CALENDAR_DIM".adwkenddt =
to_date(:to_date, :to_date_1)' {'to_date_1': 'MM/DD/RR', 'to_date':
'10/05/04'}
Am still confused as to the problem here.... I run the same query
through text and it works::
def test_to_date_text():
s = text("""SELECT "AD_WEEK_CALENDAR_DIM".adwkenddt
FROM "AD_WEEK_CALENDAR_DIM"
WHERE "AD_WEEK_CALENDAR_DIM".adwkenddt = to_date(:to_date, :to_date_1)""")
result = connection.execute(s,
to_date_1= 'MM/DD/RR',
to_date= '10/05/04')
for r in result:
print r
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---