Skip to content

Instantly share code, notes, and snippets.

@j-thepac
Created July 2, 2024 12:52
Show Gist options
  • Save j-thepac/282c76dbd028cde20dc0e204db0b62d9 to your computer and use it in GitHub Desktop.
Save j-thepac/282c76dbd028cde20dc0e204db0b62d9 to your computer and use it in GitHub Desktop.
Read Views / Tables in Azure Synapse using Notebooks
server_name = "jdbc:sqlserver://xxxx-dev-cca-weu-syn-01-ondemand.sql.azuresynapse.net"
database_name = "mydb"
url = server_name + ":1433;" + "databaseName=" + database_name + ";"
table_name = "T" #View / Table
accessToken = mssparkutils.credentials.getToken('DW')
df = (spark.read \
.format("com.microsoft.sqlserver.jdbc.spark") \
.option("url", url) \
.option("dbtable", table_name) \
.option("accessToken", accessToken) \
.load())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment