Forum Discussion
DELETE Managed DELTA Table
During a DEV, I am trying to ingest rows in a delta table and then refining the code further and then delete the rows from the table before running the next ingestion for a follow-up code DEV.
I am observing that even though, I run the following, the table is not entirely deleting all the rows in a lot of instances. When I refresh the lakehouse and that delta table to verify if it actually deleted all the rows, to my suprise I see the default view of 1000 rows. In reality, I expect it to be 0 rows.
%%sql
--DELETE all rows
DELETE FROM Staging.Lakehouse.dev_ingestion_tbl
It is causing me (time) to manually Delete (SQL TRUNCATE) the table from Lakehouse, run a schema building code to build an empty table to be ready for next test ingestion for enhanced DEV code.
Why does it keep on happening. I expect DELETE to completely delete all the rows each time I run it, ithout having me to verify the action.
Do I need to run (e.g. VACCUM) anything in conjunction to DELETE to make sure it does what I expect it to do.
Thank you in advance.
7 Replies
- AnonymousNot applicable
Hi, smpa01
After testing, after executing this T-SQL, the data in this table can be deleted normally, and then refresh, there is no data in the table in Lakehouse.Delete works fine in Notebook. Make sure you have permission to modify the table, retry deleting and refreshing.
Notebook:
Lakehouse:
Best Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
- smpa01Community Champion
Anonymous I see this however.
" Make sure you have permission to modify the table, retry deleting and refreshing" - yes, I am the admin
- frithjof_vCommunity Champion
Perhaps it's the sync between Lakehouse and SQL Analytics Endpoint which is taking a long time in your case.
What if you run
%%sql
SELECT Count(*) FROM tableName
in the Notebook in the next cell after you run the truncate or delete rows. Perhaps this will show that the table is indeed empty, even if the SQL Analytics Endpoint doesn't know that yet.
https://learn.microsoft.com/en-us/fabric/data-warehouse/sql-analytics-endpoint-performance