Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

connect sql alchemy to sql server

# SQL ALCHEMY - Establishing connection to mssql
from flask_sqlalchemy import SQLAlchemy
import urllib
params = urllib.parse.quote_plus('DRIVER={SQL Server};SERVER=localhost;DATABASE=myDB;Trusted_Connection=yes;')
app.config['SQLALCHEMY_DATABASE_URI'] = "mssql+pyodbc:///?odbc_connect=%s" % params
db = SQLAlchemy()
db.init_app(app)
Source by docs.sqlalchemy.org #
 
PREVIOUS NEXT
Tagged: #connect #sql #alchemy #sql #server
ADD COMMENT
Topic
Name
1+8 =