Skip to content

Commit

Permalink
added schema override
Browse files Browse the repository at this point in the history
  • Loading branch information
AstrakhantsevaAA committed Oct 16, 2023
1 parent 5d3b255 commit 0cad169
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
17 changes: 10 additions & 7 deletions dlt/helpers/dbt_cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,24 @@ def run_dbt_cloud_job(
api_token=credentials.api_token,
account_id=credentials.account_id,
)
json_data = {}
json_data = {"cause": credentials.cause}

if credentials.package_sha:
json_data["git_sha"] = credentials.package_sha
if credentials.git_sha:
json_data["git_sha"] = credentials.git_sha

if credentials.package_repository_branch:
json_data["git_branch"] = credentials.package_repository_branch
elif credentials.git_branch:
json_data["git_branch"] = credentials.git_branch

if credentials.schema_override:
json_data["schema_override"] = credentials.schema_override

if data:
json_data.update(json_data)

run_id = operator.trigger_job_run(job_id=credentials.job_id, data=json_data)
status = operator.get_run_status(run_id)

status = {}
if wait_for_outcome:
if wait_for_outcome and status["in_progress"]:
while True:
status = operator.get_run_status(run_id)
if not status["in_progress"]:
Expand Down
2 changes: 1 addition & 1 deletion dlt/helpers/dbt_cloud/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def trigger_job_run(self, job_id: int | str, data: Optional[dict] = None) -> int
f"account_id and job_id are required, got account_id: {self.account_id} and job_id: {job_id}"
)

json_body = {"cause": "Triggered via API"}
json_body = {}
if data:
json_body.update(data)

Expand Down
6 changes: 4 additions & 2 deletions dlt/helpers/dbt_cloud/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ class DBTCloudConfiguration(BaseConfiguration):
environment_id: Optional[str]
run_id: Optional[str]

package_sha: Optional[str]
package_repository_branch: Optional[str]
cause: str = "Triggered via API"
git_sha: Optional[str]
git_branch: Optional[str]
schema_override: Optional[str]

0 comments on commit 0cad169

Please sign in to comment.