[Sqlalchemy-tickets] Issue #3696: Documentation error in mssql+pymssql connection string (zzzeek/sq
Brought to you by:
zzzeek
From: Rudolf C. <iss...@bi...> - 2016-04-26 14:13:10
|
New issue 3696: Documentation error in mssql+pymssql connection string https://bitbucket.org/zzzeek/sqlalchemy/issues/3696/documentation-error-in-mssql-pymssql Rudolf Cardinal: The docs at http://docs.sqlalchemy.org/en/latest/dialects/mssql.html#module-sqlalchemy.dialects.mssql.pymssql give the following prototype connection string for SQL Server (mssql) via pymssql: ``` #!python mssql+pymssql://<username>:<password>@<freetds_name>?charset=utf8 ``` However (with SQL Alchemy 1.0.12 via "pip install"), this fails. Traceback below. But the basic reason appears to be that the "?charset=utf8" gets incorporated into the "host" parameter. The URL used was: ``` #!python mssql+pymssql://researcher:blibble@crate_sqlserver_test?charset=utf8 ``` where crate_sqlserver_test is defined in /etc/freetds/freetds.conf. Inserting a debugging print statement into DefaultDialect.connect(), in sqlalchemy/engine/default.py, where it calls ``` #!python return self.dbapi.connect(*cargs, **cparams) ``` gives the following: ``` #!python cargs: () cparams: {'password': 'blibble', 'host': 'crate_sqlserver_test?charset=utf8', 'user': 'researcher'} ``` **(note the error for host).** ``` #!python Traceback (most recent call last): File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/pool.py", line 1044, in _do_get return self._pool.get(wait, self._timeout) File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/util/queue.py", line 145, in get raise Empty sqlalchemy.util.queue.Empty During handling of the above exception, another exception occurred: Traceback (most recent call last): File "pymssql.pyx", line 635, in pymssql.connect (pymssql.c:10699) File "_mssql.pyx", line 1900, in _mssql.connect (_mssql.c:21951) File "_mssql.pyx", line 636, in _mssql.MSSQLConnection.__init__ (_mssql.c:6545) _mssql.MSSQLDriverException: Connection to the database failed for an unknown reason. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 2074, in _wrap_pool_connect return fn() File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/pool.py", line 318, in unique_connection return _ConnectionFairy._checkout(self) File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/pool.py", line 713, in _checkout fairy = _ConnectionRecord.checkout(pool) File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/pool.py", line 480, in checkout rec = pool._do_get() File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/pool.py", line 1060, in _do_get self._dec_overflow() File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__ compat.reraise(exc_type, exc_value, exc_tb) File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 184, in reraise raise value File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/pool.py", line 1057, in _do_get return self._create_connection() File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/pool.py", line 323, in _create_connection return _ConnectionRecord(self) File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/pool.py", line 449, in __init__ self.connection = self.__connect() File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/pool.py", line 607, in __connect connection = self.__pool._invoke_creator(self) File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/engine/strategies.py", line 97, in connect return dialect.connect(*cargs, **cparams) File "/home/rudolf/venvs/crate/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 387, in connect return self.dbapi.connect(*cargs, **cparams) File "pymssql.pyx", line 644, in pymssql.connect (pymssql.c:10856) pymssql.InterfaceError: Connection to the database failed for an unknown reason. ``` |