-
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 get
command (#62)
* Add 'dbt-cloud project get' command * Add unit test * Add integration test * Update README Co-authored-by: Simo Tumelius <[email protected]>
- Loading branch information
1 parent
63a99e6
commit 3cf8bf0
Showing
8 changed files
with
144 additions
and
4 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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
from .list import DbtCloudProjectListCommand | ||
from .get import DbtCloudProjectGetCommand |
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,17 @@ | ||
import requests | ||
from dbt_cloud.command.command import DbtCloudAccountCommand | ||
from dbt_cloud.field import PROJECT_ID_FIELD | ||
|
||
|
||
class DbtCloudProjectGetCommand(DbtCloudAccountCommand): | ||
"""Retrieves dbt Cloud project information.""" | ||
|
||
project_id: int = PROJECT_ID_FIELD | ||
|
||
@property | ||
def api_url(self) -> str: | ||
return f"{super().api_url}/projects/{self.project_id}" | ||
|
||
def execute(self) -> requests.Response: | ||
response = requests.get(url=self.api_url, headers=self.request_headers) | ||
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,85 @@ | ||
{ | ||
"status": { | ||
"code": 200, | ||
"is_success": true, | ||
"user_message": "Success!", | ||
"developer_message": "" | ||
}, | ||
"data": { | ||
"name": "jaffle_shop", | ||
"account_id": 123456, | ||
"repository_id": 123459, | ||
"connection_id": 123460, | ||
"id": 123457, | ||
"created_at": "2021-04-14 20:23:00.395285+00:00", | ||
"updated_at": "2021-11-16 16:32:43.960836+00:00", | ||
"skipped_setup": false, | ||
"state": 1, | ||
"dbt_project_subdirectory": null, | ||
"connection": { | ||
"id": 123460, | ||
"account_id": 123456, | ||
"project_id": 123457, | ||
"name": "Bigquery", | ||
"type": "bigquery", | ||
"created_by_id": 123461, | ||
"created_by_service_token_id": null, | ||
"details": { | ||
"project_id": "REDACTED", | ||
"timeout_seconds": 300, | ||
"private_key_id": "REDACTED", | ||
"client_email": "REDACTED", | ||
"client_id": "REDACTED", | ||
"auth_uri": "https://accounts.google.com/o/oauth2/auth", | ||
"token_uri": "https://oauth2.googleapis.com/token", | ||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", | ||
"client_x509_cert_url": "REDACTED", | ||
"priority": null, | ||
"retries": 1, | ||
"scopes": null, | ||
"location": null, | ||
"maximum_bytes_billed": 0, | ||
"execution_project": null, | ||
"impersonate_service_account": null, | ||
"job_retry_deadline_seconds": 0, | ||
"job_creation_timeout_seconds": 0, | ||
"is_configured_for_oauth": false | ||
}, | ||
"state": 1, | ||
"created_at": "2021-11-16 16:26:01.571115+00:00", | ||
"updated_at": "2022-05-18 06:27:34.729528+00:00" | ||
}, | ||
"repository": { | ||
"id": 123459, | ||
"account_id": 123456, | ||
"project_id": 123457, | ||
"full_name": "REDACTED", | ||
"remote_url": "REDACTED", | ||
"remote_backend": "github", | ||
"git_clone_strategy": "github_app", | ||
"deploy_key_id": 123458, | ||
"repository_credentials_id": null, | ||
"github_installation_id": 123462, | ||
"pull_request_url_template": "REDACTED", | ||
"state": 1, | ||
"created_at": "2021-11-16 16:26:24.412439+00:00", | ||
"updated_at": "2021-11-16 16:26:24.412455+00:00", | ||
"deploy_key": { | ||
"id": 123458, | ||
"account_id": 123456, | ||
"state": 1, | ||
"public_key": "REDACTED" | ||
}, | ||
"github_repo": "REDACTED", | ||
"name": "jaffle_shop", | ||
"git_provider_id": 123463, | ||
"gitlab": null, | ||
"git_provider": null | ||
}, | ||
"group_permissions": [], | ||
"docs_job_id": null, | ||
"freshness_job_id": null, | ||
"docs_job": null, | ||
"freshness_job": null | ||
} | ||
} |