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

Feature/schema versions #2767

Merged
merged 4 commits into from
Sep 21, 2020
Merged

Conversation

beckjake
Copy link
Contributor

@beckjake beckjake commented Sep 17, 2020

resolves #2670

Description

Add schema versions and dbt versions dbt's artifact output.

Long-term, these belong in the metadata field described in #2761.

I think I would like to get some automated mechanism for this into either hologram or the class, rather than this method of manually inserting things.

We can definitely change the name to something better, I don't love dbt_schema_version.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind dbt_schema_version. That said, if you did want to change it, I'd support something even more explicit, like dbt_artifact_schema_version.

I tested locally and saw dbt_version and dbt_schema_version propagated in every artifact except sources.json. Is that known, and to come in a future PR?

For my own edification: would our plan be to keep schema versions consistent across all artifacts, even if we only need to change one or two? Or is there a possibility of (e.g.) a v4 manifest, v3 run results, v2 catalog?

self.manifest = WritableManifest.read(str(manifest_path))
try:
self.manifest = WritableManifest.read(str(manifest_path))
except IncompatibleSchemaException as exc:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


msg = (
f'Expected a schema version of "{self.expected}" in '
f'{self.filename}, but found {found_str}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of offering a hint to users who might be initially confused about what schema version means?

  Expected a schema version of "https://schemas.getdbt.com/dbt/manifest/v1.json" in
.state/manifest.json, but found "https://schemas.getdbt.com/dbt/manifest/v2.json".
Are you running with a different version of dbt?

@beckjake
Copy link
Contributor Author

propagated in every artifact except sources.json. Is that known, and to come in a future PR?

This will be fixed in the metadata PR. I didn't realize it was relevant here, but the freshness output has its own special schema that isn't the freshness results, which is used solely for writing, and that doesn't get the schema version. I'm going to coerce it into the standard-ish format as part of that.

would our plan be to keep schema versions consistent across all artifacts, even if we only need to change one or two? Or is there a possibility of (e.g.) a v4 manifest, v3 run results, v2 catalog?

I hadn't planned on keeping them consistent, though I can see the value in it. I think mixed versions are pretty reasonable things to have. If we change the catalog and your code only cares about the manifest, why should you get an error? This is especially relevant for defer, I think.

@jtcohen6
Copy link
Contributor

If we change the catalog and your code only cares about the manifest, why should you get an error? This is especially relevant for defer, I think.

Fair!

@beckjake beckjake merged commit 4994cc0 into dev/kiyoshi-kuromiya Sep 21, 2020
@beckjake beckjake deleted the feature/schema-versions branch September 21, 2020 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add schema versions and dbt versions to json output
3 participants