I have an external Delta table in Databricks with data files stored in an S3 backend. I want to completely remove(drop) this external Delta table, including all data files and Delta log files from the S3 location, using Databricks SQL commands (not Python).
I tried deleting the data with DELETE FROM TABLE_NAME, then dropped the external Delta table, and finally ran VACUUM with RETAIN 0 HOURS. This successfully removed all data files from S3, but the Delta log files remain. How can I remove Delta log files using SQL commands?
%sql
CREATE TABLE dev_catal_nm.dbx.table_name1(
id INT,
name STRING -- VARCHAR(25) is equivalent to STRING in Databricks SQL
)
USING DELTA
LOCATION 's3://my_bucket_test/poc/table_name1';
%sql
INSERT INTO dev_catal_nm.dbx.table_name1
VALUES (1, 'John');
%sql
SET spark.databricks.delta.retentionDurationCheck.enabled = false;
%sql
DROP TABLE IF EXISTS dev_catal_nm.dbx.table_name1;
%sql
VACUUM 's3://my_bucket_test/poc/table_name1' RETAIN 0 HOURS;
But log file still exists. I want to drop delta log file
CREATE EXTERNALfor this location? Can you try you commands for new location which was not (presumably) used before as external?