On 27 Apr, 16:01, Tom Wood <thomas.a.w...@gmail.com> wrote:
> Hi all,
>
> Am having a problem withSQLAlchemy0.5.3 and MSSQL.  Running on a
> Debian stack, using FreeTDS 0.82, pyodbc 2.1.4, Python 2.5 and
> (separately) SQL Server 2000 and SQL Server 2005.

I have a fairly comparable setup, with SQLALchemy 0.5.3, Python 2.6,
FreeTDS 0.82, pyodbc 2.1.5, all running on Mac 10.5.  Connecting to
SQL Server 2005 running on a virtual machine.

I've been using the connection string: "mssql://user:password@/?
dsn=schematest?driver=FreeTDS"

I can do simple connections using both pyodbc and sqlalchemy.  I can
execute a query, though I don't have any data yet so they only return
empty results.

Trying to create tables tends to cause the following error though:

ProgrammingError: (ProgrammingError) Attempt to use a closed cursor.
None None

Running your test causes the same error, shown below.  I'm a bit stuck
on what to try next, but I'll keep fiddling and let you know of
anything that works for me.

Ed

======================================================================
ERROR: sql_test.Tester.test_orm_relation
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
nose-0.10.4-py2.6.egg/nose/case.py", line 363, in setUp
    try_run(self.inst, ('setup', 'setUp'))
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
nose-0.10.4-py2.6.egg/nose/util.py", line 453, in try_run
    return func()
  File "/Users/singletoned/temp/sql_test.py", line 34, in setup
    metadata.create_all()
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/schema.py", line 1765, in
create_all
    bind.create(self, checkfirst=checkfirst, tables=tables)
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/engine/base.py", line 1129, in
create
    self._run_visitor(self.dialect.schemagenerator, entity,
connection=connection, **kwargs)
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/engine/base.py", line 1158, in
_run_visitor
    visitorcallable(self.dialect, conn, **kwargs).traverse(element)
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/sql/visitors.py", line 89, in
traverse
    return traverse(obj, self.__traverse_options__,
self._visitor_dict)
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/sql/visitors.py", line 200, in
traverse
    return traverse_using(iterate(obj, opts), obj, visitors)
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/sql/visitors.py", line 194, in
traverse_using
    meth(target)
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/sql/compiler.py", line 807, in
visit_metadata
    collection = [t for t in sql_util.sort_tables(tables) if
self._can_create(t)]
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/sql/compiler.py", line 800, in
_can_create
    return not self.checkfirst or not self.dialect.has_table
(self.connection, table.name, schema=table.schema)
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/databases/mssql.py", line 1105,
in has_table
    current_schema = schema or self.get_default_schema_name
(connection)
  File "<string>", line 1, in <lambda>
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/engine/base.py", line 1894, in
decorated
    connection.info[key] = val = fn(self, connection)
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/databases/mssql.py", line 1070,
in get_default_schema_name
    user_name = connection.scalar(sql.text(query))
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/engine/base.py", line 814, in
scalar
    return self.execute(object, *multiparams, **params).scalar()
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/engine/base.py", line 1676, in
scalar
    self.connection._handle_dbapi_exception(e, None, None,
self.cursor, self.context)
  File "/Users/singletoned/.envs/odbc/lib/python2.6/site-packages/
SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/engine/base.py", line 931, in
_handle_dbapi_exception
    raise exc.DBAPIError.instance(statement, parameters, e,
connection_invalidated=is_disconnect)
ProgrammingError: (ProgrammingError) Attempt to use a closed cursor.
None None


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