Reputation: 441
I created a Databse with a table inside it in azure synaps which was an external table of sample azure data.
I run the code below to get access to the data in this table through pyspark
df = spark.sql("select * FROM greentaxidb.dbo.taxitable")
when I run the code above I get:
pyspark.sql.utils.AnalysisException: The namespace in session catalog must have exactly one name part: greentaxidb.dbo.taxitable
Upvotes: 1
Views: 2403
Reputation: 5074
Load the data into dataframe with saveAsTable to run it in pyspark notebook.
%%pyspark
df = spark.read.load('abfss://<container-name>@<storage-account-name>.dfs.core.windows.net/<filename>', format='parquet')
df.write.mode("overwrite").saveAsTable("testdb.test1")
--
%%pyspark
df = spark.sql("select * from testdb.test1")
display(df)
You can go through the links from here and here for more details.
Upvotes: 1