z3z1ma / dbt-osmosis

Provides automated YAML management, a dbt server, streamlit workbench, and git-integrated dbt model output diff tools
https://z3z1ma.github.io/dbt-osmosis/
Apache License 2.0
422 stars 45 forks source link

Fix bug for UnboundLocalError: local variable 'database' referenced before assignment #87

Closed syou6162 closed 9 months ago

syou6162 commented 10 months ago

@z3z1ma I have fixed a bug for https://github.com/z3z1ma/dbt-osmosis/pull/85.

When I updated dbt-osmosis v0.12.0 I got the following error.

...
  File "/Users/yasuhisa.yoshida/.pyenv/versions/3.10.0/lib/python3.10/site-packages/dbt_osmosis/core/osmosis.py", line 617, in commit_project_restructure_to_disk
    blueprint = self.draft_project_structure_update_plan()
  File "/Users/yasuhisa.yoshida/.pyenv/versions/3.10.0/lib/python3.10/site-packages/dbt_osmosis/core/osmosis.py", line 593, in draft_project_structure_update_plan
    for unique_id, schema_file in self.build_schema_folder_mapping().items():
  File "/Users/yasuhisa.yoshida/.pyenv/versions/3.10.0/lib/python3.10/site-packages/dbt_osmosis/core/osmosis.py", line 471, in build_schema_folder_mapping
    self.bootstrap_sources()
  File "/Users/yasuhisa.yoshida/.pyenv/versions/3.10.0/lib/python3.10/site-packages/dbt_osmosis/core/osmosis.py", line 416, in bootstrap_sources
    database=database,
UnboundLocalError: local variable 'database' referenced before assignment

dbt-osmosis yaml refactor fails the following case.

vars:
  dbt-osmosis:
    <source_name>: <path> 
z3z1ma commented 9 months ago

Oy good catch!

syou6162 commented 9 months ago

@z3z1ma Thank you! We look forward to the release of v0.12.1 with fixed bugs 🎉