FATMA BERRAK GUNGOR
FATMA BERRAK GUNGOR

Reputation: 71

Delete record from databricks DBFS

I am trying to delete some records in Databricks Delta Lake that is located in DBFS. I only have path . Not saved as a table, is there any way to delete record from delta files?

Thank you

Upvotes: 4

Views: 2056

Answers (1)

Alex Ott
Alex Ott

Reputation: 87069

Updated answer:

Delta Lake is able to perform deletes using the DELETE FROM command, so you just need to come with correct WHERE condition to match your record that you want to remove (put the real path instead of <path-to-delta-table>):

DELETE FROM delta.`<path-to-delta-table>` WHERE your_condition

First version of answer, before update:

DBFS is the file system, and items on it are files & directories. You can remove files & directories either using %fs rm file_name (docs), or corresponding dbutils.fs.rm("file_name") command in Python or Scala (see docs). You can even do it via Databricks CLI, directly from your computer or via REST API.

Another object in DBFS is a mount point, for which there are special commands. You can unmount mount point if necessary

Upvotes: 3

Related Questions