I want to create a blank file in abfss using databricks dbutils command. The reason is I want to open a blank file to write filenames and the below command is not working saying file does not exist. manifestfilePath is the abfss_path+filename
with open(manifestfilePath, 'w') as manifestfile:
Big thanks for your help
I want to create a blank file in abfss using databricks dbutils command. The reason is I want to open a blank file to write filenames and the below command is not working saying file does not exist. manifestfilePath is the abfss_path+filename
with open(manifestfilePath, 'w') as manifestfile:
Big thanks for your help
Share Improve this question asked Jan 20 at 18:52 Raj RRaj R 11 bronze badge 1- you can use dbutils.fs.put() to create a blank file and write content to it. – Dileep Raj Narayan Thumula Commented Jan 21 at 3:31
1 Answer
Reset to default 0I have tried the below approach:
spark.conf.set("fs.azure.account.key.allnewsynp.dfs.core.windows.net", "<YOUR ADLS ACCESS KEY>")
file_path = "abfss://[email protected]/output/manifest.txt"
dbutils.fs.put(file_path, "", overwrite=True)
Results:
Wrote 0 bytes.
True
In the above code setting the configuration for ADLS using access key. Defining the file path Next creating a blank file at the specified path.