-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into allow-python-3.13
- Loading branch information
Showing
14 changed files
with
258 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from dataclasses import dataclass | ||
from typing import Optional | ||
|
||
from dbt_jobs_as_code.client import DBTCloud, DBTCloudException | ||
from dbt_jobs_as_code.schemas.job import JobDefinition | ||
|
||
|
||
@dataclass | ||
class LinkableCheck: | ||
can_be_linked: bool | ||
message: str | ||
linked_job: Optional[JobDefinition] = None | ||
|
||
|
||
def can_be_linked( | ||
job_identifier: str, job_definition: JobDefinition, dbt_cloud: DBTCloud | ||
) -> LinkableCheck: | ||
if job_definition.linked_id is None: | ||
return LinkableCheck( | ||
False, f"Job '{job_identifier}' doesn't have an ID in YAML. It cannot be linked" | ||
) | ||
|
||
try: | ||
cloud_job = dbt_cloud.get_job(job_id=job_definition.linked_id) | ||
except DBTCloudException as e: | ||
return LinkableCheck( | ||
False, | ||
f"Job {job_definition.linked_id} doesn't exist in dbt Cloud. It cannot be linked", | ||
) | ||
|
||
if cloud_job.identifier is not None: | ||
return LinkableCheck( | ||
False, | ||
f"Job {job_definition.linked_id} is already linked with the identifier {cloud_job.identifier}. You should unlink it before if you want to link it to a new identifier.", | ||
) | ||
|
||
return LinkableCheck(True, "", cloud_job) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.