Skip to content

Instantly share code, notes, and snippets.

@YiLi225
Created February 6, 2022 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YiLi225/dc65687cb637f0bd58eb1cc664c8681f to your computer and use it in GitHub Desktop.
Save YiLi225/dc65687cb637f0bd58eb1cc664c8681f to your computer and use it in GitHub Desktop.
import sqlalchemy as sa
import urllib
params = urllib.parse.quote_plus("DRIVER={SQL Server Native Client 11.0};"
"SERVER=localhost\SQLEXPRESS;"
"DATABASE=master;"
"Trusted_Connection=yes")
## Connect using the specified parameters
engine = sa.create_engine("mssql+pyodbc:///?odbc_connect={}".format(params))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment