write to Delta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 08:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 10:50 PM
@SSV_dataeng
What is the question here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 03:45 AM
1. I was trying to create a file in Delta format. After Delta File creation at the verification step getting Assertion Error: No data written.
could you please let me know how to fix this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 04:49 AM
I see the error is part of the assertion part of your code. Do you see any other error when writing the data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2023 05:06 AM
Hi @SSV_dataeng ,
Please check with this (you would have to indent it correctly for python)
productsOutputPath = DA.workingDir + "/delta/products"
(productsDF
.write
.format("delta")
.mode("overwrite")
.save(productsOutputPath)
)
verify_files = dbutils.fs.ls(productsOutputPath)
verify_delta_format = False
verify_num_data_files = 0
for f in verify_files:
if f.name == '_delta_log/':
verify_delta_format = True
elif f.name.endswith('.parquet'):
verify_num_data_files += 1
assert verify_delta_format, "Data not written in Delta format"
assert verify_num_data_files > 0, "No data written"
del verify_files, verify_delta_format, verify_num_data_files