Hello, I'm trying to read a serverless view from a pySpark notebook. I originally thought that I could using the synapsesql method from the com.microsoft.spark.sqlanalytics driver. I was encouraged because I authenticated and it read the database metadata. But it failed to convert the actual data. Now I assume that particular driver only works with Dedicated Pools.
So now I've switched back to the com.microsoft.sqlserver.jdbc.spark driver to use for my serverless connection. I'm trying AD authentication with this driver but have been unsuccessful thus far. I receive error message ": com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user '<token-identified principal>'. Incorrect or invalid token." My code to retrieve the token and use it is:
server_name = "jdbc:sqlserver://bi-synapse-dev-workspace-ondemand.sql.azuresynapse.net"
database_name = "Bronze"
url = server_name + ":1433;" + "databaseName=" + database_name + ";"
print(url)
table_name = "fo.CustTable"
accessToken = mssparkutils.credentials.getToken('Synapse')
df = (spark.read \
.format("com.microsoft.sqlserver.jdbc.spark") \
.option("url", url) \
.option("dbtable", table_name) \
.option("accessToken", accessToken) \
.load())