I have a set of .parquet files in my local machine that I am trying to upload to a container in Data Lake Gen2.
I cannot do the following:
def upload_file_to_directory():
try:
file_system_client = service_client.get_file_system_client(file_system="my-file-system")
directory_client = file_system_client.get_directory_client("my-directory")
file_client = directory_client.create_file("uploaded-file.parquet")
local_file = open("C:\\file-to-upload.parquet",'r')
file_contents = local_file.read()
file_client.append_data(data=file_contents, offset=0, length=len(file_contents))
file_client.flush_data(len(file_contents))
except Exception as e:
print(e)
because the .parquet file cannot read by the .read() function.
When I try do this:
def upload_file_to_directory():
file_system_client = service_client.get_file_system_client(file_system="my-file-system")
directory_client = file_system_client.get_directory_client("my-directory")
file_client = directory_client.create_file("uploaded-file.parquet")
file_client.upload_file("C:\\file-to-upload.txt",'r')
I get the following error:
AttributeError: 'DataLakeFileClient' object has no attribute 'upload_file'
Any suggestions?