-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
dbt-cloud project update
command (#101)
* Add DbtCloudProjectUpdateCommand class * Add test_cli_project_update integration test * Fix id payload field * Add unit test * Update README --------- Co-authored-by: Simo Tumelius <[email protected]>
- Loading branch information
1 parent
bf3002d
commit e6f5e19
Showing
8 changed files
with
112 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import requests | ||
from pydantic import Field | ||
from dbt_cloud.command.project.create import DbtCloudProjectCreateCommand | ||
|
||
|
||
class DbtCloudProjectUpdateCommand(DbtCloudProjectCreateCommand): | ||
"""Updates a project in a given account.""" | ||
|
||
project_id: int = Field(description="ID of the project to update.") | ||
|
||
@property | ||
def api_url(self) -> str: | ||
return f"{super().api_url}/{self.project_id}" | ||
|
||
def execute(self) -> requests.Response: | ||
payload = self.get_payload(exclude_empty=True) | ||
# Rename project_id to id | ||
payload["id"] = payload.pop("project_id") | ||
response = requests.post( | ||
url=self.api_url, headers=self.request_headers, json=payload | ||
) | ||
return response |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"status": { | ||
"code": 200, | ||
"is_success": true, | ||
"user_message": "Success!", | ||
"developer_message": "" | ||
}, | ||
"data": { | ||
"name": "My project renamed", | ||
"account_id": 123456, | ||
"connection_id": null, | ||
"repository_id": null, | ||
"semantic_layer_config_id": null, | ||
"id": 273745, | ||
"created_at": "2023-08-02 08:09:57.922958+00:00", | ||
"updated_at": "2023-08-21 08:31:36.941327+00:00", | ||
"skipped_setup": false, | ||
"state": 1, | ||
"dbt_project_subdirectory": null, | ||
"connection": null, | ||
"repository": null, | ||
"group_permissions": [], | ||
"docs_job_id": null, | ||
"freshness_job_id": null, | ||
"docs_job": null, | ||
"freshness_job": null | ||
} | ||
} |
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