1

I created a Databse with a table inside it in azure synaps which was an external table of sample azure data.

enter image description here

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

1

1 Answer 1

1

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)

enter image description here

You can go through the links from here and here for more details.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.