From 27f54e5b5483c8b3bdf0abdfb7b49d2bf56188a5 Mon Sep 17 00:00:00 2001 From: Maxime Armstrong Date: Mon, 22 Jul 2024 16:05:41 -0400 Subject: [PATCH] Move Definitions to definitions.py --- pyproject.toml | 3 ++- quickstart_etl/__init__.py | 16 ---------------- quickstart_etl/definitions.py | 16 ++++++++++++++++ quickstart_etl_tests/test_defs.py | 2 +- workspace.yaml | 2 +- 5 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 quickstart_etl/definitions.py diff --git a/pyproject.toml b/pyproject.toml index db34245..ef6a022 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,4 +3,5 @@ requires = ["setuptools"] build-backend = "setuptools.build_meta" [tool.dagster] -module_name = "quickstart_etl" \ No newline at end of file +module_name = "quickstart_etl.definitions" +code_location_name = "quickstart_etl" \ No newline at end of file diff --git a/quickstart_etl/__init__.py b/quickstart_etl/__init__.py index 3070b3e..e69de29 100644 --- a/quickstart_etl/__init__.py +++ b/quickstart_etl/__init__.py @@ -1,16 +0,0 @@ -from dagster import ( - Definitions, - ScheduleDefinition, - define_asset_job, - load_assets_from_package_module, -) - -from . import assets - -daily_refresh_schedule = ScheduleDefinition( - job=define_asset_job(name="all_assets_job"), cron_schedule="0 0 * * *" -) - -defs = Definitions( - assets=load_assets_from_package_module(assets), schedules=[daily_refresh_schedule] -) diff --git a/quickstart_etl/definitions.py b/quickstart_etl/definitions.py new file mode 100644 index 0000000..3070b3e --- /dev/null +++ b/quickstart_etl/definitions.py @@ -0,0 +1,16 @@ +from dagster import ( + Definitions, + ScheduleDefinition, + define_asset_job, + load_assets_from_package_module, +) + +from . import assets + +daily_refresh_schedule = ScheduleDefinition( + job=define_asset_job(name="all_assets_job"), cron_schedule="0 0 * * *" +) + +defs = Definitions( + assets=load_assets_from_package_module(assets), schedules=[daily_refresh_schedule] +) diff --git a/quickstart_etl_tests/test_defs.py b/quickstart_etl_tests/test_defs.py index c389b7b..20bb90e 100644 --- a/quickstart_etl_tests/test_defs.py +++ b/quickstart_etl_tests/test_defs.py @@ -1,4 +1,4 @@ -from quickstart_etl import defs +from quickstart_etl.definitions import defs def test_def_can_load(): diff --git a/workspace.yaml b/workspace.yaml index c0fdb4b..359cb0b 100644 --- a/workspace.yaml +++ b/workspace.yaml @@ -1,3 +1,3 @@ load_from: - - python_package: quickstart_etl + - python_package: quickstart_etl.definitions