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

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
smpa01
Super User
Super User

Underlying files have been updated. Explicitly invalidate the cache in Spark by running 'REFRESH TAB

I need to read a DW table in a NB.

When I try to read this through a shortcut (of data warehouse table in a lakehouse), I am coming across following

 

// #1 - did not work
df_one = spark.read.format('delta').load("abfss://abcd@onelake.dfs.fabric.microsoft.com/StagingLakehouse.Lakehouse/Tables/dw_tbl")
df_two = df_one.collect()
print(df_two)

//#2 - did not work
df_one = spark.read.format('delta').load("abfss://abcd@onelake.dfs.fabric.microsoft.com/StagingLakehouse.Lakehouse/Tables/dw_tbl").createOrReplaceTempView('x1')
df_two = spark.table('x1')
print(df_two.collect())

//#3 - did not work
etl_df = DeltaTable.forName(spark, "dw_tbl").toDF()
print(etl_df.collect())

#4 - did not work
df_one = spark.read.format('delta').load("abfss://abcd@onelake.dfs.fabric.microsoft.com/StagingLakehouse.Lakehouse/Tables/dw_tbl")
df_two = df_one.toPandas()

 

I am getting an error here consistently

 

It is possible the underlying files have been updated. You can explicitly invalidate the cache in Spark by running 'REFRESH TABLE tableName' command in SQL or by recreating the Dataset/DataFrame involved.

 

I can also read the table directly from DW instaead of shortcut but I am not sure if I will be coming across this error

spark.read.format('delta').load('abfss://grpId@onelake.dfs.fabric.microsoft.com/dwID/Tables/dbo/info_etl')

 

Which method would be result in error free reading and will not generate error in succedding codes (not trying to write back in DW table using NB; the dw table works more of a lookup src table for lakehouse table manipulation).

 

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
Anonymous
Not applicable

HI @smpa01,

I test on my lakehouse to create a shortcut from data warehouse, and use your codes to read data from the shortcut path. These functions works well.

1.png

Have you setting the default the Lakehouse ? These notebook codes use some functions from library which not initialized and they will return the error. (setting default Lakehouse will attach some libraries and configurations such as the spark session)

BTW, it seems like you are working with source data from staging table, right? AFAIK, it is a tempoar table which used  in the Extract, Transform, and Load (ETL) process within a data warehouse.

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @smpa01,

I test on my lakehouse to create a shortcut from data warehouse, and use your codes to read data from the shortcut path. These functions works well.

1.png

Have you setting the default the Lakehouse ? These notebook codes use some functions from library which not initialized and they will return the error. (setting default Lakehouse will attach some libraries and configurations such as the spark session)

BTW, it seems like you are working with source data from staging table, right? AFAIK, it is a tempoar table which used  in the Extract, Transform, and Load (ETL) process within a data warehouse.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

May FBC25 Carousel

Fabric Monthly Update - May 2025

Check out the May 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.