Another user is using a database she has created in a python session, lets call it user_db. I, in SSMS, delete a different database, lets call it other_db. After I delete other_db, her scripts claim they are unable to find the db id for user_db. If she drops user_db and recreates it, the issue still exists. If she uses a new name like new_user_db her scripts work again.
To me it seems like something on the unixodbc/freetdbs/pyodbc/python side is caching database IDs. Can anyone enlighten me as to which tools might be causing the issue and possibly a solution for it?
error:
pyodbc.ProgrammingError: ('42000', "[42000] [FreeTDS][SQL Server]Could not find database ID (id_number)
EDIT: Software Versions pyodbc -- 4.0.16 centos -- 6.6 unixODBC -- 2.2.14 freeTDS -- 0.91
Repeatable via: User 1 (In Python):
conn = pyodbc.connect(cxnstring)
cursor = conn.cursor()
cursor.execute('CREATE DATABASE test')
cursor.execute('CREATE DATABASE test_1')
cursor.execute('CREATE TABLE test_1.dbo.test_table (column_1 INT)')
cursor.execute('SELECT * FROM test_1.dbo.test_table')
User 2 (in SSMS):
DROP DATABASE test_1
User 1 (in Python):
conn = pyodbc.connect(cxnstring)
cursor = conn.cursor()
cursor.execute('CREATE DATABASE test_1')
cursor.execute('CREATE TABLE test_1.dbo.test_table (column_1 INT)')
cursor.execute('SELECT * FROM test_1.dbo.test_table')
Edit corrected SQL syntax