diff --git a/pyproject.toml b/pyproject.toml index 3e36393..af90336 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dbt-jobs-as-code" -version = "0.9.0" +version = "0.10.0" description = "A CLI to allow defining dbt Cloud jobs as code" authors = ["dbt Labs "] license = "Apache License 2.0" diff --git a/src/dbt_jobs_as_code/schemas/job.py b/src/dbt_jobs_as_code/schemas/job.py index 7b8c34f..a480c08 100644 --- a/src/dbt_jobs_as_code/schemas/job.py +++ b/src/dbt_jobs_as_code/schemas/job.py @@ -38,6 +38,7 @@ class JobDefinition(BaseModel): description: str = "" state: int = 1 run_compare_changes: bool = False + compare_changes_flags: str = "--select state:modified" # we don't want to enforce the list in case we add more, but still want to get those in the JSON schema job_type: str = Field( json_schema_extra={"enum": ["scheduled", "merge", "ci", "other"]}, diff --git a/src/dbt_jobs_as_code/schemas/load_job_schema.json b/src/dbt_jobs_as_code/schemas/load_job_schema.json index 2f7341c..19b5648 100644 --- a/src/dbt_jobs_as_code/schemas/load_job_schema.json +++ b/src/dbt_jobs_as_code/schemas/load_job_schema.json @@ -178,11 +178,7 @@ "$ref": "#/$defs/Settings" }, "execution": { - "allOf": [ - { - "$ref": "#/$defs/Execution" - } - ], + "$ref": "#/$defs/Execution", "default": { "timeout_seconds": 0 } @@ -253,6 +249,11 @@ "title": "Run Compare Changes", "type": "boolean" }, + "compare_changes_flags": { + "default": "--select state:modified", + "title": "Compare Changes Flags", + "type": "string" + }, "job_type": { "default": "scheduled", "enum": [ diff --git a/tests/exporter/test_export.py b/tests/exporter/test_export.py index 263df2b..818fdfc 100644 --- a/tests/exporter/test_export.py +++ b/tests/exporter/test_export.py @@ -48,6 +48,7 @@ def test_export_jobs_yml(capsys): on_merge: false description: '' run_compare_changes: false + compare_changes_flags: --select state:modified job_type: scheduled triggers_on_draft_pr: false job_completion_trigger_condition: diff --git a/tests/loader/test_loader.py b/tests/loader/test_loader.py index ad28b97..8ab07b8 100644 --- a/tests/loader/test_loader.py +++ b/tests/loader/test_loader.py @@ -7,6 +7,7 @@ "jobs": { "job1": { "account_id": 43791, + "compare_changes_flags": "--select state:modified", "custom_environment_variables": [], "dbt_version": None, "deferring_environment_id": None, @@ -45,6 +46,7 @@ }, "job2": { "account_id": 43791, + "compare_changes_flags": "--select state:modified", "custom_environment_variables": [ { "display_value": None,