Created
July 2, 2024 12:52
-
-
Save j-thepac/282c76dbd028cde20dc0e204db0b62d9 to your computer and use it in GitHub Desktop.
Read Views / Tables in Azure Synapse using Notebooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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