Azure Datalake Gen2 Rename File Issue
See original GitHub issue- azure.storage.filedatalake:
- **12.0.0.b **:
- Windows:
- 3.73:
Describe the bug
When trying to get azure.storage.filedatalake rename_file method working for an existing file_client I receive the following error:
file_client.rename_file(file_client.file_system_name+'/'+target_path) azure.core.exceptions.ResourceNotFoundError: Operation returned an invalid status 'The parent directory of the destination path does not exist.' ErrorCode:RenameDestinationParentPathNotFound error:{'code': 'RenameDestinationParentPathNotFound', 'message': 'The parent directory of the destination path does not exist.\nRequestId:889d285a-601f-001d-3afc-d9ef4b000000\nTime:2020-02-02T19:11:34.7429024Z'}
Provided is my code snippet: -Creating a file_client for an existing file -Creating target path name by taking the file_system name and appending it to the full path of the new file
logger.info("Now loading file: {0} into it's corresponding raw directory: {1}".format(filename, curated_path)) file_client = self.datalake_conn.file_system.get_file_client(filename) target_path = self.datalake_conn.file_system_name+'/'+curated_path+filename.split('/')[1] file_client.rename_file(target_path)
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Hi @markpearl , Here are the steps on how to use rename_file, your question appears in step3.: Step 1, create a DataLakeServiceClient Object.
Step 2, get file client.
step 3, create target path. step 4, rename file.
The detailed code is shown below for how to use rename_file (here is the official sample ):
@jongio
close this issue for now, feel free to reopen it if you have any question