I'm using and loving SQLAlchemy 0.4.3dev_r4136 but I am having a
problem with (drum roll) a legacy database schema.  I'm using pyodbc
on Unix.

The primary keys in a legacy table are alphanumeric and must be
generated by a MSSQL stored procedure which returns a single result
row with a single unnamed char(12).  How can I execute this procedure
with SQLAlchemy?

I tried the obvious session.execute("EXEC sp_new_foo_key").fetchone()
and variations with text() and select() but I always get this error:

<class 'pyodbc.ProgrammingError'>: Attempt to use a closed cursor.

The typemap argument to text() looked like it might do what I need,
but I don't see how to use it with the unnamed result column, and I'm
not sure it would actually result in the correct execution method.

I gather this is because the mssql dialect implements
returns_rows_text() as a regexp matching just SELECT and sp_columns.
SQL Server Profiler shows the statement being executed from SQLAlchemy
as an RPC instead of a SQL batch like when I do the EXEC from SQL
Server Management Studio.

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