cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a Python API for vacuum with dry run?

Shankar
New Contributor III

I have the below sql command where i am doing a dry run with vacuum.

%sql
VACUUM <table_name> RETAIN 500 HOURS DRY RUN;

wanted to check if there is a way to achieve this in python api?

I​ tried the below. But, not sure if there is a parameter that we can pass for dry run?

from delta.tables import DeltaTable
 
path = "path/to/delta_table"
dt = DeltaTable(spark, path)
 
vacuum_out = dt.vacuum(retentionHours=500)

L​ike retention hours do we have a parameter for dry run?

If it's not possible through python api, is there a pyspark sql equivalent of this ?

Thank you​

1 ACCEPTED SOLUTION

Accepted Solutions

venkatcrc
New Contributor III

Equivalent of sql command "VACUUM <table_name> RETAIN 500 HOURS DRY RUN;" in python is spark.sql("VACUUM <table_name> RETAIN 500 HOURS DRY RUN;")

View solution in original post

1 REPLY 1

venkatcrc
New Contributor III

Equivalent of sql command "VACUUM <table_name> RETAIN 500 HOURS DRY RUN;" in python is spark.sql("VACUUM <table_name> RETAIN 500 HOURS DRY RUN;")

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group