Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Queria saber se existe alguma forma de truncar uma tabela delta do meu lakehouse?
Solved! Go to Solution.
Hi @italogomes
Here is one method with notebook.
# Step 1: Read the existing Delta table and get its schema
tablePath = "Tables/TableName"
read_df = spark.read.format("delta").load(tablePath)
schema = read_df.schema
# Step 2: Create an empty dataframe with the same structure
empty_df = spark.createDataFrame([], schema)
# Step 3: Save the empty dataframe to overwrite the existing Delta table
empty_df.write.format("delta").mode("overwrite").save(tablePath)
Result:
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
8 | |
6 | |
5 | |
2 | |
1 |
User | Count |
---|---|
15 | |
10 | |
5 | |
4 | |
4 |