简体   繁体   中英

move file from azure data lake Gen 1 to a temp directory using python

how to move file from azure data lake Gen 1 to a temp directory using python? I need to find each file in the ADL, move it to temp directory to decrpt it and read it.

i am using

azure.datalake.store import core
core.AzureDLFileSystem(token, 'store_name')

#create a temp directory
 with tempfile.TemporaryDirectory() as tmpdirname:

Regarding the issue, please refer to the following code

from azure.datalake.store import core, lib, multithreaded

##auth
adlCreds = lib.auth(tenant_id = tenant,
                client_secret = client_secret,
                client_id = client_id,
                resource = RESOURCE)
subscriptionId = 'FILL-IN-HERE'
adlsAccountName = 'FILL-IN-HERE'

## Create a filesystem client object
adlsFileSystemClient = core.AzureDLFileSystem(adlCreds, store_name=adlsAccountName)


## Download a file
multithread.ADLDownloader(adlsFileSystemClient, lpath='<local path>', rpath='<path on adls>', nthreads=64, overwrite=True, chunksize=4194304,buffersize=4194304, blocksize=4194304)

##Move file between locations on ADL
adlsFileSystemClient.mv('<Source Path>','Destination path')

For more details, please refer to here and here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM