Skip to content

Commit 4f2790f

Browse files
authored
Merge pull request #229 from preset-io/dbt-schema
Making dbt schemas more flexible
2 parents d8b7212 + 4e00958 commit 4f2790f

File tree

1 file changed

+18
-15
lines changed
  • src/preset_cli/api/clients

1 file changed

+18
-15
lines changed

src/preset_cli/api/clients/dbt.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ class ConnectionSchema(PostelSchema):
317317
Schema for connection information.
318318
"""
319319

320-
id = fields.Integer()
320+
id = fields.Integer(allow_none=True)
321321
account_id = fields.Integer()
322322
project_id = fields.Integer()
323323
name = fields.String()
@@ -358,12 +358,12 @@ class RepositorySchema(PostelSchema):
358358
Schema for a repository.
359359
"""
360360

361-
id = fields.Integer()
361+
id = fields.Integer(allow_none=True)
362362
account_id = fields.Integer()
363-
remote_url = fields.String()
363+
remote_url = fields.String(allow_none=True)
364364
remote_backend = fields.String(allow_none=True)
365365
git_clone_strategy = PostelEnumField(GitCloneStrategy)
366-
deploy_key_id = fields.Integer()
366+
deploy_key_id = fields.Integer(allow_none=True)
367367
github_installation_id = fields.Integer(allow_none=True)
368368
state = fields.Integer()
369369
created_at = fields.DateTime()
@@ -377,7 +377,7 @@ class RepositorySchema(PostelSchema):
377377
pull_request_url_template = fields.String(allow_none=True)
378378
git_provider_id = fields.Integer(allow_none=True)
379379
git_provider = fields.String(allow_none=True)
380-
project_id = fields.Integer()
380+
project_id = fields.Integer(allow_none=True)
381381
deploy_key = fields.Nested(DeployKeySchema)
382382
github_repo = fields.String(allow_none=True)
383383

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

390-
id = fields.Integer()
390+
id = fields.Integer(allow_none=True)
391391
account_id = fields.Integer()
392-
connection = fields.Nested(ConnectionSchema)
393-
connection_id = fields.Integer()
392+
connection = fields.Nested(ConnectionSchema, allow_none=True)
393+
connection_id = fields.Integer(allow_none=True)
394394
dbt_project_subdirectory = fields.String(allow_none=True)
395395
name = fields.String()
396-
repository = fields.Nested(RepositorySchema)
397-
repository_id = fields.Integer()
396+
repository = fields.Nested(RepositorySchema, allow_none=True)
397+
repository_id = fields.Integer(allow_none=True)
398398
state = fields.Integer()
399-
created_at = fields.DateTime()
400-
updated_at = fields.DateTime()
399+
created_at = fields.DateTime(allow_none=True)
400+
updated_at = fields.DateTime(allow_none=True)
401401

402402
# not present in the spec
403-
group_permissions = fields.List(fields.Nested(GroupPermissionSchema))
403+
group_permissions = fields.List(
404+
fields.Nested(GroupPermissionSchema),
405+
allow_none=True,
406+
)
404407
docs_job = fields.Nested("JobSchema", allow_none=True)
405408
docs_job_id = fields.Integer(allow_none=True)
406409
freshness_job_id = fields.Integer(allow_none=True)
407410
freshness_job = fields.Nested("JobSchema", allow_none=True)
408-
skipped_setup = fields.Boolean()
411+
skipped_setup = fields.Boolean(allow_none=True)
409412

410413

411414
class TriggerSchema(PostelSchema):
@@ -525,7 +528,7 @@ class JobSchema(PostelSchema):
525528
cron_humanized = fields.String()
526529
created_at = fields.DateTime()
527530
next_run = fields.DateTime(allow_none=True)
528-
lifecycle_webhooks = fields.Boolean()
531+
lifecycle_webhooks = fields.Boolean(allow_none=True)
529532
next_run_humanized = fields.String(allow_none=True)
530533
deferring_job_definition_id = fields.Integer(allow_none=True)
531534
deactivated = fields.Boolean()

0 commit comments

Comments
 (0)