this is #2355:
http://www.sqlalchemy.org/trac/ticket/2355
Pyodbc + MSSQL is not yet tested for Py3K. (note it's on the map as
'development': www.sqlalchemy.org/docs/core/engines.html#supported-databases )
PyODBC + MSSQL is a tricky platform overall so you might need to stick with
py2k for the moment. The above ticket shouldn't be hard to fix, but it's not
yet clear what other pyodbc + py3k issues might need to be solved once that one
is fixed.
On Jan 2, 2012, at 4:48 AM, keson wrote:
> I'm using python 3.2.2, sqlalchemy 0.7.4 and pyodbc 3.0.2
>
> from sqlalchemy import create_engine, MetaData, Table
> engine = create_engine('mssql+pyodbc://user:pass@dsn')
> metadata = MetaData(engine)
> my_view = Table("PGRDAT", metadata, autoload=True)
>
>
> and getting this error:
>
> Traceback (most recent call last):
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\pool.py", line 675, in _do_get
> return self._pool.get(wait, self._timeout)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\util\queue.py", line 137, in get
> raise Empty
> sqlalchemy.util.queue.Empty
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "mssql_test.py", line 4, in <module>
> my_view = Table("PGRDAT", metadata, autoload=True)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\schema.py", line 292, in __new__
> table._init(name, metadata, *args, **kw)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\schema.py", line 353, in _init
> self._autoload(metadata, autoload_with, include_columns)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\schema.py", line 377, in _autoload
> self, include_columns
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\engine\base.py", line 2276, in run_callable
> conn = self.contextual_connect()
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\engine\base.py", line 2342, in contextual_connect
> self.pool.connect(),
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\pool.py", line 210, in connect
> return _ConnectionFairy(self).checkout()
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\pool.py", line 371, in __init__
> rec = self._connection_record = pool._do_get()
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\pool.py", line 697, in _do_get
> con = self._create_connection()
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\pool.py", line 174, in _create_connection
> return _ConnectionRecord(self)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\pool.py", line 259, in __init__
> pool.dispatch.first_connect.exec_once(self.connection, self)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\event.py", line 262, in exec_once
> self(*args, **kw)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\event.py", line 271, in __call__
> fn(*args, **kw)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\engine\strategies.py", line 167, in first_connect
> dialect.initialize(c)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\connectors\pyodbc.py", line 127, in initialize
> super(PyODBCConnector, self).initialize(connection)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\dialects\mssql\base.py", line 1130, in initialize
> super(MSDialect, self).initialize(connection)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\engine\default.py", line 176, in initialize
> self._get_default_schema_name(connection)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\dialects\mssql\base.py", line 1146, in
> _get_default_schema_name
> user_name = connection.scalar("SELECT user_name() as user_name;")
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\engine\base.py", line 1339, in scalar
> return self.execute(object, *multiparams, **params).scalar()
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\engine\base.py", line 1405, in execute
> params)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\engine\base.py", line 1582, in _execute_text
> statement, parameters
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\engine\base.py", line 1665, in _execute_context
> result = context.get_result_proxy()
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\dialects\mssql\base.py", line 737, in get_result_proxy
> return base.ResultProxy(self)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\engine\base.py", line 2722, in __init__
> self._init_metadata()
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\engine\base.py", line 2729, in _init_metadata
> self._metadata = ResultMetaData(self, metadata)
> File "c:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
> \sqlalchemy\engine\base.py", line 2585, in __init__
> colname = dialect._description_decoder(colname)
> AttributeError: 'MSDialect_pyodbc' object has no attribute
> '_description_decoder'
>
>
> Any idea how to avoid this error?
> Thanks in advance
>
> --
> 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.
>
--
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.