In iPython I am using the following code to connect to a SQL server with SQLAlchemy:
import sqlalchemy as sa
import urllib
import pandas as pd
connection_string = "DRIVER={SQL Server};SERVER=myserver;DATABASE=mydatabase;TRUSTEDCONNECTION=Yes"
connection_string = urllib.quote_plus(connection_string)
connection_string = "mssql+pyodbc:///?odbc_connect=%s" % connection_string
engine = sa.create_engine(connection_string).connect()
I am switching over to Beaker notebook because I enjoy its features, but am unsure how to get the SQL cells to connect to the SQL database, as it does above. I know you are supposed to put driver information in the "Default Data Source" box in Language Manager, but if I try to put the connection_string
in there it spits an error.
Suggestions?