Issue
I imported some SQL libraries to be used on jupyter notebook, the SQL Server Management Studio credential is a Window Authentication (i.e i do not need a password to use SQL SSMS).
Below is the code snippet and an image that shows the output.
import sqlalchemy
import pyodbc
SERVER = 'SERVERNAME'
DATABASE = 'DATEBASENAME'
DRIVER = 'SQL Server Native Client 11.0'
USERNAME = 'MyUserName'
PASSWORD = ''
engine = sqlalchemy.create_engine('mssql+pyodbc://@' + SERVER + '/' + DATABASE + '?trusted_connection=yes&driver=ODBC+Driver+13+for+SQL+Server')
connection = engine.connect()
%reload_ext sql
%sql mssql+pyodbc://@SERVERNAME/DATABASENAME?driver=ODBC+Driver+13+for+SQL+Server&trusted_connection=yes
team_query = """
SQL_QUERY
"""
team = %sql $team_query
team = team.DataFrame()
How do i hide the output generated from the image above.
Solution
Maybe you could use the cell magic function %%capture --no-display
:
Answered By - edg
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.