Tuesday, 15 September 2015

python - pymssql.connect() seems to ignore database string argument -



python - pymssql.connect() seems to ignore database string argument -

i have 3 dbs in azure tried connecting 1 of them.

conn = pymssql.connect(server='hostname.database.windows.net', user='username@hostname', password='*****', database='my_db', timeout=0, login_timeout=60, charset='utf-8', as_dict=false, host='', port='1433') cursor = conn.cursor() cursor.execute('select db_name()') #to name of db (which should "my_db") result = cursor.fetchone() print result

but i've got "master" default azure database. shouldn't happen because i've specify 'databse' string argument "my_db".

please advice.

your problem version of pymssql. latest version on pip 2.1.0, version supports azure 2.1.1. so, if install source, work. also, create sure have freetds > 0.91

python sql azure pymssql

No comments:

Post a Comment