Skip to content
Snippets Groups Projects
Commit acd41f39 authored by Jedrzej Rybicki's avatar Jedrzej Rybicki
Browse files

connection id as parameter

parent e369af37
No related branches found
No related tags found
No related merge requests found
Pipeline #81812 passed
......@@ -50,12 +50,13 @@ def taskflow_example():
print(f"Total files downloaded: {len(files)}")
params = kwargs['params']
target = params.get('target', '/tmp/')
connection_id = params.get('connection', 'default_ssh')
ssh_hook = SSHHook(ssh_conn_id='default_ssh')
ssh_hook = SSHHook(ssh_conn_id=connection_id)
with ssh_hook.get_conn() as ssh_client:
sftp_client = ssh_client.open_sftp()
for [truename, local] in files.items():
print(f"Copying {local} --> {os.path.join(target, truename)}")
print(f"Copying {local} --> {connection_id}:{os.path.join(target, truename)}")
sftp_client.put(local, os.path.join(target, truename))
data = extract()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment