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

[PP] Bug when editing yaml file to add version #3567

Closed
jtcohen6 opened this issue Jul 13, 2021 · 2 comments · Fixed by #3618
Closed

[PP] Bug when editing yaml file to add version #3567

jtcohen6 opened this issue Jul 13, 2021 · 2 comments · Fixed by #3618
Assignees
Labels
bug Something isn't working partial_parsing
Milestone

Comments

@jtcohen6
Copy link
Contributor

Describe the bug

  1. Create a .yml file with nothing in it:
# models/schema.yml
  1. dbt parse
  2. Add version: 2 to the .yml file:
# models/schema.yml

version: 2
  1. dbt --partial-parse parse

Error message:

Partial parsing enabled: 0 files deleted, 0 files added, 1 files changed.
Encountered an error:
'version'

Stracktrace

2021-07-13 21:40:27.083754 (MainThread): Traceback (most recent call last):
  File "/usr/local/Cellar/dbt/0.20.0_1/libexec/lib/python3.8/site-packages/dbt/main.py", line 125, in main
    results, succeeded = handle_and_check(args)
  File "/usr/local/Cellar/dbt/0.20.0_1/libexec/lib/python3.8/site-packages/dbt/main.py", line 203, in handle_and_check
    task, res = run_from_args(parsed)
  File "/usr/local/Cellar/dbt/0.20.0_1/libexec/lib/python3.8/site-packages/dbt/main.py", line 256, in run_from_args
    results = task.run()
  File "/usr/local/Cellar/dbt/0.20.0_1/libexec/lib/python3.8/site-packages/dbt/task/parse.py", line 85, in run
    self.get_full_manifest()
  File "/usr/local/Cellar/dbt/0.20.0_1/libexec/lib/python3.8/site-packages/dbt/task/parse.py", line 64, in get_full_manifest
    manifest = loader.load()
  File "/usr/local/Cellar/dbt/0.20.0_1/libexec/lib/python3.8/site-packages/dbt/parser/manifest.py", line 212, in load
    project_parser_files = partial_parsing.get_parsing_files()
  File "/usr/local/Cellar/dbt/0.20.0_1/libexec/lib/python3.8/site-packages/dbt/parser/partial.py", line 125, in get_parsing_files
    self.change_schema_file(file_id)
  File "/usr/local/Cellar/dbt/0.20.0_1/libexec/lib/python3.8/site-packages/dbt/parser/partial.py", line 429, in change_schema_file
    saved_schema_file.pp_dict = {"version": saved_yaml_dict['version']}
KeyError: 'version'

The output of dbt --version:

$ dbt --version
installed version: 0.20.0
   latest version: 0.20.0

Up to date!
@jtcohen6 jtcohen6 added bug Something isn't working partial_parsing labels Jul 13, 2021
@jtcohen6 jtcohen6 added this to the 0.20.1 milestone Jul 13, 2021
@leahwicz
Copy link
Contributor

@gshank this might be a partial parsing bug. Could you please take a look?

@gshank
Copy link
Contributor

gshank commented Jul 19, 2021

The partial parsing code assumes that a SchemaSourceFile from the partial parse file has already been validated and so would have the 'version' key. Should be easy to fix.

gshank added a commit that referenced this issue Jul 27, 2021
[#3567] Fix partial parsing error with version key if previous file is empty
iknox-fa pushed a commit that referenced this issue Feb 8, 2022
empty


automatic commit by git-black, original commits:
  d7ea364
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working partial_parsing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants