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

Bug: Error when running dbt-osmosis yaml organize because of dict when string is expected #72

Closed tobiascadee closed 10 months ago

tobiascadee commented 1 year ago

When running dbt-osmosis yaml organize I get an error:

Traceback (most recent call last): File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/bin/dbt-osmosis", line 8, in sys.exit(cli()) File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/click/core.py", line 1130, in call return self.main(args, kwargs) File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(args, *kwargs) File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/dbt_osmosis/main.py", line 80, in wrapper return func(args, **kwargs) File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/dbt_osmosis/main.py", line 245, in organize runner.commit_project_restructure_to_disk() File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/dbt_osmosis/core/osmosis.py", line 595, in commit_project_restructure_to_disk blueprint = self.draft_project_structure_update_plan() File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/dbt_osmosis/core/osmosis.py", line 571, in draft_project_structure_update_plan for unique_id, schema_file in self.build_schema_folder_mapping().items(): File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/dbt_osmosis/core/osmosis.py", line 458, in build_schema_folder_mapping osmosis_schema_path = self.get_target_schema_path(dbt_node) File "/Users/tobiascadee/Documents/Ticketswap/Github/data-transformations/data-transformations/lib/python3.10/site-packages/dbt_osmosis/core/osmosis.py", line 271, in get_target_schema_path schema = osmosis_path_spec.format(node=node, model=node.name, parent=node.fqn[-2]) AttributeError: 'dict' object has no attribute 'format'

This is because when getting the target schema path and the source config is specified with path and schema separated, it does not just select the path. It is easily fixed by adding the same logic as in 'bootstrap_sources'

chraltro commented 11 months ago

+1 to this solution. It renders the sources part useless for our project at the moment. Is there possibly a dbt_project.yml workaround known?

AleksandrsJuskaVisma commented 10 months ago

+1 on this

z3z1ma commented 10 months ago

Fixed in #85