Punyawee Chananan
12/14/2022, 2:31 AMfrom dagster import repository, with_resources, asset, define_asset_job, ScheduleDefinition
from dagster_airbyte import airbyte_resource, build_airbyte_assets, load_assets_from_airbyte_instance
import os
from dotenv import load_dotenv
# Get user/password env
load_dotenv()
airbyte_user = os.getenv('airbyte_user')
airbyte_password = os.getenv('airbyte_password')
airbyte_password = os.getenv('airbyte_password')
# Connect to Airbyte
airbyte_instance = airbyte_resource.configured(
{
"host": "localhost",
"port": "8000",
# If using basic auth, include username and password:
"username": airbyte_user,
"password": airbyte_password, # default password
}
)
# Use the airbyte_instance resource we defined in Step 1
airbyte_assets = load_assets_from_airbyte_instance(airbyte_instance)
# materialize all assets in the repository
run_everything_job = define_asset_job("run_everything", selection="*")
@repository
def my_repo():
return [
airbyte_assets,
ScheduleDefinition(
job=run_everything_job,
cron_schedule="@weekly",
),
]