Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making dbt schemas more flexible #229

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions src/preset_cli/api/clients/dbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class ConnectionSchema(PostelSchema):
Schema for connection information.
"""

id = fields.Integer()
id = fields.Integer(allow_none=True)
account_id = fields.Integer()
project_id = fields.Integer()
name = fields.String()
Expand Down Expand Up @@ -358,12 +358,12 @@ class RepositorySchema(PostelSchema):
Schema for a repository.
"""

id = fields.Integer()
id = fields.Integer(allow_none=True)
account_id = fields.Integer()
remote_url = fields.String()
remote_url = fields.String(allow_none=True)
remote_backend = fields.String(allow_none=True)
git_clone_strategy = PostelEnumField(GitCloneStrategy)
deploy_key_id = fields.Integer()
deploy_key_id = fields.Integer(allow_none=True)
github_installation_id = fields.Integer(allow_none=True)
state = fields.Integer()
created_at = fields.DateTime()
Expand All @@ -377,7 +377,7 @@ class RepositorySchema(PostelSchema):
pull_request_url_template = fields.String(allow_none=True)
git_provider_id = fields.Integer(allow_none=True)
git_provider = fields.String(allow_none=True)
project_id = fields.Integer()
project_id = fields.Integer(allow_none=True)
deploy_key = fields.Nested(DeployKeySchema)
github_repo = fields.String(allow_none=True)

Expand All @@ -387,25 +387,28 @@ class ProjectSchema(PostelSchema):
Schema for a dbt project.
"""

id = fields.Integer()
id = fields.Integer(allow_none=True)
account_id = fields.Integer()
connection = fields.Nested(ConnectionSchema)
connection_id = fields.Integer()
connection = fields.Nested(ConnectionSchema, allow_none=True)
connection_id = fields.Integer(allow_none=True)
dbt_project_subdirectory = fields.String(allow_none=True)
name = fields.String()
repository = fields.Nested(RepositorySchema)
repository_id = fields.Integer()
repository = fields.Nested(RepositorySchema, allow_none=True)
repository_id = fields.Integer(allow_none=True)
state = fields.Integer()
created_at = fields.DateTime()
updated_at = fields.DateTime()
created_at = fields.DateTime(allow_none=True)
updated_at = fields.DateTime(allow_none=True)

# not present in the spec
group_permissions = fields.List(fields.Nested(GroupPermissionSchema))
group_permissions = fields.List(
fields.Nested(GroupPermissionSchema),
allow_none=True,
)
docs_job = fields.Nested("JobSchema", allow_none=True)
docs_job_id = fields.Integer(allow_none=True)
freshness_job_id = fields.Integer(allow_none=True)
freshness_job = fields.Nested("JobSchema", allow_none=True)
skipped_setup = fields.Boolean()
skipped_setup = fields.Boolean(allow_none=True)


class TriggerSchema(PostelSchema):
Expand Down Expand Up @@ -525,7 +528,7 @@ class JobSchema(PostelSchema):
cron_humanized = fields.String()
created_at = fields.DateTime()
next_run = fields.DateTime(allow_none=True)
lifecycle_webhooks = fields.Boolean()
lifecycle_webhooks = fields.Boolean(allow_none=True)
next_run_humanized = fields.String(allow_none=True)
deferring_job_definition_id = fields.Integer(allow_none=True)
deactivated = fields.Boolean()
Expand Down
Loading