Martin Peak
03/06/2024, 7:34 AMScout
03/06/2024, 7:34 AMdagster_ssh
library: python from dagster import asset, with_resources from dagster_ssh import ssh_resource @asset(required_resource_keys={'ssh'}) def my_asset(context): context.resources.ssh.sftp_get("/path/to/remote.csv", "path/to/local.csv") assets = with_resources([my_asset], resource_defs={ 'ssh': ssh_resource.configured({ 'remote_host': '<http://foo.com|foo.com>', 'key_file': 'path/to/id_rsa', }) })
In this example, my_asset
is an asset that uses an SSH resource to perform an SFTP operation. You can adapt this example to perform the file copying operation you need. By using assets, you can take advantage of Dagster's asset catalog, which provides observability into the production and consumption of your data assets. Remember that assets are the preferred abstraction in Dagster for defining data computations and dependencies, especially in the context of data pipelines where tracking and managing data is a primary concern.