Skip to content

Commit

Permalink
Merge pull request #229 from preset-io/dbt-schema
Browse files Browse the repository at this point in the history
Making dbt schemas more flexible
  • Loading branch information
Vitor-Avila committed Jul 26, 2023
2 parents d8b7212 + 4e00958 commit 4f2790f
Showing 1 changed file with 18 additions and 15 deletions.
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

0 comments on commit 4f2790f

Please sign in to comment.