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

Support `--profile` in subcommands of `dbt-osmosis yaml` #101

Closed yu-iskw closed 9 months ago

yu-iskw commented 9 months ago

Partially resolves: https://github.com/z3z1ma/dbt-osmosis/issues/59

Overview

We support the --profile options in the sub commands of dbt-osmosis yaml refactor so that we use a custom dbt profile instead of the default value defined in dbt_project.yaml.

Execute the command locally

I made sure the both cases with/without the --profile option with dbt-osmosis yaml refactor commands.

dbt-osmosis yaml refactor without --profile

$ dbt-osmosis yaml refactor --profiles-dir . --project-dir .
INFO     � Executing dbt-osmosis                                                                                                    main.py:186

INFO     � Searching project stucture for required updates and building action plan                                              osmosis.py:619
INFO     ...building project structure mapping in memory                                                                          osmosis.py:507
INFO     � Project structure approved                                                                                            osmosis.py:653
INFO     ...building project structure mapping in memory                                                                          osmosis.py:507
INFO     � Processing model: model.jaffle_shop.orders                                                                            osmosis.py:867
INFO     � Resolving columns in database                                                                                         osmosis.py:878
INFO     � Processing model: model.jaffle_shop.customers_alias                                                                   osmosis.py:867
INFO     � Resolving columns in database                                                                                         osmosis.py:878
INFO     � Processing model: model.jaffle_shop.stg_customers                                                                     osmosis.py:867
INFO     � Resolving columns in database                                                                                         osmosis.py:878
INFO     � Processing model: model.jaffle_shop.stg_payments                                                                      osmosis.py:867
INFO     � Resolving columns in database                                                                                         osmosis.py:878
INFO     � Processing model: model.jaffle_shop.stg_orders                                                                        osmosis.py:867
INFO     � Resolving columns in database                                                                                         osmosis.py:878
INFO     ✨ Schema file is up to date for model model.jaffle_shop.orders                                                          osmosis.py:971
INFO     � Looking for actions for model.jaffle_shop.stg_orders                                                                 osmosis.py:1150
INFO     ✨ Schema file is up to date for model model.jaffle_shop.stg_orders                                                      osmosis.py:971
INFO     � Looking for actions for model.jaffle_shop.stg_payments                                                               osmosis.py:1150
INFO     ✨ Schema file is up to date for model model.jaffle_shop.stg_payments                                                    osmosis.py:971
INFO     � Looking for actions for model.jaffle_shop.stg_customers                                                              osmosis.py:1150
INFO     ✨ Schema file is up to date for model model.jaffle_shop.stg_customers                                                   osmosis.py:971
INFO     � Looking for actions for model.jaffle_shop.customers_alias                                                            osmosis.py:1150
INFO     ✨ Schema file is up to date for model model.jaffle_shop.customers_alias                                                 osmosis.py:971

dbt-osmosis yaml refactor with --profile

$ dbt-osmosis yaml refactor --profiles-dir . --project-dir . --profile jaffle_shop
INFO     � Executing dbt-osmosis                                                                                                    main.py:186

INFO     � Searching project stucture for required updates and building action plan                                              osmosis.py:619
INFO     ...building project structure mapping in memory                                                                          osmosis.py:507
INFO     � Project structure approved                                                                                            osmosis.py:653
INFO     ...building project structure mapping in memory                                                                          osmosis.py:507
INFO     � Processing model: model.jaffle_shop.orders                                                                            osmosis.py:867
INFO     � Resolving columns in database                                                                                         osmosis.py:878
INFO     � Processing model: model.jaffle_shop.customers_alias                                                                   osmosis.py:867
INFO     � Resolving columns in database                                                                                         osmosis.py:878
INFO     � Processing model: model.jaffle_shop.stg_customers                                                                     osmosis.py:867
INFO     � Resolving columns in database                                                                                         osmosis.py:878
INFO     � Processing model: model.jaffle_shop.stg_payments                                                                      osmosis.py:867
INFO     � Resolving columns in database                                                                                         osmosis.py:878
INFO     � Processing model: model.jaffle_shop.stg_orders                                                                        osmosis.py:867
INFO     � Resolving columns in database                                                                                         osmosis.py:878
INFO     � Looking for actions for model.jaffle_shop.stg_payments                                                               osmosis.py:1150
INFO     ✨ Schema file is up to date for model model.jaffle_shop.stg_payments                                                    osmosis.py:971
INFO     � Looking for actions for model.jaffle_shop.stg_orders                                                                 osmosis.py:1150
INFO     ✨ Schema file is up to date for model model.jaffle_shop.stg_orders                                                      osmosis.py:971
INFO     � Looking for actions for model.jaffle_shop.stg_customers                                                              osmosis.py:1150
INFO     ✨ Schema file is up to date for model model.jaffle_shop.stg_customers                                                   osmosis.py:971
INFO     � Looking for actions for model.jaffle_shop.customers_alias                                                            osmosis.py:1150
INFO     ✨ Schema file is up to date for model model.jaffle_shop.customers_alias                                                 osmosis.py:971
INFO     ✨ Schema file is up to date for model model.jaffle_shop.orders                                                          osmosis.py:971
z3z1ma commented 9 months ago

Once we rebase and resolve conflicts, I will merge and cut a release.

yu-iskw commented 9 months ago

I will resolve the conflicts as soon as possible.

yu-iskw commented 9 months ago

@z3z1ma Can you review it again? The conflicts have been resolved. We probably have to format files with pre-commit after merging #100.

z3z1ma commented 9 months ago

LGTM 🚀

yu-iskw commented 9 months ago

@z3z1ma Thank you for merging this. I look forward to the next release!