It is a deprecationWarning of collections
, this alert has now started in version 3.7 of Python.
link
collections
In Python 3.8
, the abstract base classes in collections.abc
will no longer be exposed in the regular collections module. This will help create a clear distinction between the concrete classes and the abstract base classes. (Contributed by Serhiy Storchaka in bpo-25988.)
As of version 3.8, the old way of importing the module will no longer be supported.
If it is not you who are doing this import
the connector maintainer should update it at some point.
Regarding pymssql
it is listed as a connector option, however the official SQL server website says:
There are several Python SQL drivers available. However, Microsoft puts its testing efforts and its confidence in% driver%.
As Microsoft tests and helps with the development of pyodbc
, I think it is a more interesting option than pyodbc
.
Your connection string is different in the driver part too:
pyodbc
link
import pyodbc
# Some other example server values are
# server = 'localhost\sqlexpress' # for a named instance
# server = 'myserver,port' # to specify an alternate port
server = 'tcp:myserver.database.windows.net'
database = 'mydb'
username = 'myusername'
password = 'mypassword'
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
pymssql
link
import pymssql
conn = pymssql.connect(server='yourserver.database.windows.net', user='yourusername@yourserver', password='yourpassword', database='AdventureWorks')