4kpt_V
Да нет. Нужен полный трейсбек.Во-вторых попробуйте без создания таблицы.В-третьих. А где логин-пароль в строке?
где-то нашел вариант строки соединения без логина-пароля, вот так и пытаюсь - при win-аутентификации логин/пароль вроде не требуется. Если требуется, то где его взять-то?)
без создания таблицы:
from sqlalchemy import create_engine
engine = create_engine('mssql+pymssql
//localhost/mydb')
print(engine)
for row in engine.execute('select * from test'):
print(dict(row))
=======================================
рез-т:
C:\Python36\python.exe “F
dev/python projects/untitled/test”
Engine(mssql+pymssql
//localhost/mydb)
Traceback (most recent call last):
File “C:\Python36\lib\sqlalchemy\pool.py”, line 1122, in _do_get
return self._pool.get(wait, self._timeout)
File “C:\Python36\lib\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:10734)
File “_mssql.pyx”, line 1902, in _mssql.connect (_mssql.c:21821)
File “_mssql.pyx”, line 637, in _mssql.MSSQLConnection.__init__ (_mssql.c:6581)
File “_mssql.pyx”, line 1630, in _mssql.maybe_raise_MSSQLDatabaseException (_mssql.c:17524)
_mssql.MSSQLDatabaseException: (20009, b'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (localhost:1433)\nNet-Lib error during Unknown error (10060)\n')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Python36\lib\sqlalchemy\engine\base.py”, line 2138, in _wrap_pool_connect
return fn()
File “C:\Python36\lib\sqlalchemy\pool.py”, line 387, in connect
return _ConnectionFairy._checkout(self)
File “C:\Python36\lib\sqlalchemy\pool.py”, line 766, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File “C:\Python36\lib\sqlalchemy\pool.py”, line 516, in checkout
rec = pool._do_get()
File “C:\Python36\lib\sqlalchemy\pool.py”, line 1138, in _do_get
self._dec_overflow()
File “C:\Python36\lib\sqlalchemy\util\langhelpers.py”, line 60, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File “C:\Python36\lib\sqlalchemy\util\compat.py”, line 187, in reraise
raise value
File “C:\Python36\lib\sqlalchemy\pool.py”, line 1135, in _do_get
return self._create_connection()
File “C:\Python36\lib\sqlalchemy\pool.py”, line 333, in _create_connection
return _ConnectionRecord(self)
File “C:\Python36\lib\sqlalchemy\pool.py”, line 461, in __init__
self.__connect(first_connect_check=True)
File “C:\Python36\lib\sqlalchemy\pool.py”, line 651, in __connect
connection = pool._invoke_creator(self)
File “C:\Python36\lib\sqlalchemy\engine\strategies.py”, line 105, in connect
return dialect.connect(*cargs, **cparams)
File “C:\Python36\lib\sqlalchemy\engine\default.py”, line 393, in connect
return self.dbapi.connect(*cargs, **cparams)
File “pymssql.pyx”, line 641, in pymssql.connect (pymssql.c:10824)
pymssql.OperationalError: (20009, b'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (localhost:1433)\nNet-Lib error during Unknown error (10060)\n')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “F
dev/python projects/untitled/test”, line 7, in <module>
for row in engine.execute('select * from test'):
File “C:\Python36\lib\sqlalchemy\engine\base.py”, line 2054, in execute
connection = self.contextual_connect(close_with_result=True)
File “C:\Python36\lib\sqlalchemy\engine\base.py”, line 2103, in contextual_connect
self._wrap_pool_connect(self.pool.connect, None),
File “C:\Python36\lib\sqlalchemy\engine\base.py”, line 2142, in _wrap_pool_connect
e, dialect, self)
File “C:\Python36\lib\sqlalchemy\engine\base.py”, line 1456, in _handle_dbapi_exception_noconnection
exc_info
File “C:\Python36\lib\sqlalchemy\util\compat.py”, line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File “C:\Python36\lib\sqlalchemy\util\compat.py”, line 186, in reraise
raise value.with_traceback(tb)
File “C:\Python36\lib\sqlalchemy\engine\base.py”, line 2138, in _wrap_pool_connect
return fn()
File “C:\Python36\lib\sqlalchemy\pool.py”, line 387, in connect
return _ConnectionFairy._checkout(self)
File “C:\Python36\lib\sqlalchemy\pool.py”, line 766, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File “C:\Python36\lib\sqlalchemy\pool.py”, line 516, in checkout
rec = pool._do_get()
File “C:\Python36\lib\sqlalchemy\pool.py”, line 1138, in _do_get
self._dec_overflow()
File “C:\Python36\lib\sqlalchemy\util\langhelpers.py”, line 60, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File “C:\Python36\lib\sqlalchemy\util\compat.py”, line 187, in reraise
raise value
File “C:\Python36\lib\sqlalchemy\pool.py”, line 1135, in _do_get
return self._create_connection()
File “C:\Python36\lib\sqlalchemy\pool.py”, line 333, in _create_connection
return _ConnectionRecord(self)
File “C:\Python36\lib\sqlalchemy\pool.py”, line 461, in __init__
self.__connect(first_connect_check=True)
File “C:\Python36\lib\sqlalchemy\pool.py”, line 651, in __connect
connection = pool._invoke_creator(self)
File “C:\Python36\lib\sqlalchemy\engine\strategies.py”, line 105, in connect
return dialect.connect(*cargs, **cparams)
File “C:\Python36\lib\sqlalchemy\engine\default.py”, line 393, in connect
return self.dbapi.connect(*cargs, **cparams)
File “pymssql.pyx”, line 641, in pymssql.connect (pymssql.c:10824)
sqlalchemy.exc.OperationalError: (pymssql.OperationalError) (20009, b'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (localhost:1433)\nNet-Lib error during Unknown error (10060)\n')
Process finished with exit code 1