Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
smpa01
Super User
Super User

Registering Tables to lakehouse metastore

How can I register a delta table in metastore as I am getting the following error

Error reading or writing to the Metastore. Among other things the Metastore keeps track of information about Spark tables. While the Metastore doesn't store the information contained in the tables, it contains information for Spark to read and write to those tables. 1. Ensure that the table doesn't already exist if you're attempting to create a table. 2. Ensure that your user account has the correct permissions on the has "Storage Blob Data Contributor" role on the ADLS Gen2 storage account that is storing the Metadata information. 3. Check the logs for this Spark application. Inspect the logs for a clearer indication of which table relation is causing this issue.

 

if I do this

%%pyspark 
from pyspark.sql.types import *
 orderSchema = StructType([
     StructField("SalesOrderNumber", StringType())
     ])
some_df = spark.createDataFrame([], schema)

some_df.write.format("delta").mode("overwrite").save("abfss://xxxx@onelake.dfs.fabric.microsoft.com/StagingLakehouse.Lakehouse/Tables/test")

and then

%%sql

INSERT INTO test (SalesOrderNumber)
VALUES ('testString')

 

I know the alternative solution to the above but I am interested to know do I need to register this table for metastore ( if yes, how?) in order for INSERT to work.

 

Thank you in advance.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
1 ACCEPTED SOLUTION
smpa01
Super User
Super User

Can be resolved by using tablebuilder api

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

3 REPLIES 3
smpa01
Super User
Super User

Can be resolved by using tablebuilder api

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
frithjof_v
Super User
Super User

What is the default Lakehouse for your Notebook?

 

I think your lakehouse (it seems your lakehouse is named StagingLakehouse) needs to be the default lakehouse for your notebook in order for the SQL command to identify the table in the Lakehouse.

 

 

 

(Also, just want to ask, is the StagingLakehouse a so-called Dataflows Gen2 Staging Lakehouse (if so, that could maybe cause an issue))

AndyDDC
Super User
Super User

Can you use savetotable in the lakehouse?

Helpful resources

Announcements
December Fabric Update Carousel

Fabric Monthly Update - December 2025

Check out the December 2025 Fabric Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.