The delete file action deletes a file from the Databricks Unity Catalog (UC)using a specified session.
Prerequisites
- The file to be deleted must be in a UC-managed volume.
- The authenticating identity must hold the appropriate UC permissions to
delete from the target volume or path. The required permissions are:
Object Minimum privilege Databricks navigation Catalog USE CATALOG- In your Databricks workspace, click Catalog and select the catalog.
- Go to the Permissions tab and click Grant.
- Enter the email address for a user or the name of a group.
- Select the permissions to grant, select
USE CATALOGand click Grant.
Schema USE SCHEMA- In Catalog Explorer, expand the catalog and select the target schema.
- Go to the Permissions tab, click Grant.
- Select the principal, select
USE SCHEMA, and click Grant.
Volume READ VOLUME,WRITE VOLUME- In your Databricks workspace, click Catalog and search or browse for the volume and select it.
- Click the Permissions tab and click Grant.
- Type to search for a principal and select the principal.
- Select the privileges that you want to grant and click Grant.
Important: Databricks recommends grantingREAD VOLUMEandWRITE VOLUMEat the catalog or schema level to cascade privileges to all contained volumes rather than granting per-volume.For more details about privileges, see Databricks privileges.
Settings
- Use the Session field to select
one of the following options:
- Session name: Enter the name of the session
used during Connect
action.
Click the Insert a value icon to select an existing variable that you have used to store the default session name.
- Variable: Enter the name of the variable that you have used to store the session name.
- Session name: Enter the name of the session
used during Connect
action.
- Specify the UC aware file path of the file that you
want to delete from the Databricks.
For example, /Volumes/workspace/default/myfolder/file.txt
Click the Insert a value icon to select an existing variable.
- Select a variable that you want to use to store the output (Boolean value)
from the Assign the output to variable list.
Click the Create variable icon on the right to create a variable. See Create a variable.
Result: If the file is deleted, the output is True. Otherwise, the output is False.