I've been using SQLAlchemy with a web service for a few months, and am
starting to see weird issues between dev & prod. This is connecting to
a SQL Server 2008 box from Windows.

In dev, it will be happily working, and then spit out
"sqlalchemy.exc.DBAPIError: (Error) ('HYC00', '[HYC00] [Microsoft][SQL
Native Client]Optional feature not implemented (0)
(SQLBindParameter)') 'select run_date, cast(value as float) val from
dashboard_query_history where query_id = ? and run_date between ? and
? order by 1' (504, datetime.date(2012, 4, 10), datetime.date(2012, 4,
11))"

Exact same query & syntax works fine in prod.

Here's my test script, with python 2.6.5 on both.

import sqlalchemy
print sqlalchemy.__version__

import pyodbc
print pyodbc.version

import datetime

oms = sqlalchemy.create_engine("mssql://CORP\svc_oms@hqadmintools01c")

begin_date = datetime.date(2012,04,10)
end_date = datetime.date(2012,04,11)
query_id = 504

rs = oms.execute("select run_date, cast(value as float) val from
dashboard_query_history where query_id = ? and run_date between ? and
? order by 1",
            (query_id, begin_date, end_date))

for row in rs:
    print " ".join([str(x) for x in row])


Dev:

0.7.6
3.0.3

Traceback (most recent call last):
  File "sqlalchemy_test.py", line 16, in <module>
    (query_id, begin_date, end_date))
  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 2433, in execute
  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 1450, in execute
  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 1627,
in _execute_text
  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 1697,
in _execute_context
  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 1690,
in _execute_context
  File "build\bdist.win32\egg\sqlalchemy\engine\default.py", line 335,
in do_execute
sqlalchemy.exc.DBAPIError: (Error) ('HYC00', '[HYC00] [Microsoft][SQL
Native Client]Optional feature not implemented (0)
(SQLBindParameter)') 'select run_date, cast(value as float) val from
dashboard_query_history where query_id = ? and run_date between ? and
? order by 1' (504, datetime.date(2012, 4, 10), datetime.date(2012, 4,
11))


And prod:
0.7.6
2.1.7
2012-04-10 00:02:23.903000 3.25
2012-04-10 00:13:24.253000 2.26
2012-04-10 00:24:24.650000 2.25
2012-04-10 00:35:27.760000 None
[etc]

The first thing I did was upgrade pyodbc on my dev box, and it got
exactly the same error. It's also sporadic; it tends to work for
awhile and then fail.

Any ideas?

-Jeff

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to