z3z1ma / dbt-osmosis

Provides automated YAML management, a dbt server, streamlit workbench, and git-integrated dbt model output diff tools

Home Page:https://z3z1ma.github.io/dbt-osmosis/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Support stable column order

sadahry opened this issue · comments

Database column index order are vary on environments and situations.

e.g.,

  • environment: prodution/staging/development/ci
  • situations: schema_on_change: . build with --defer or not

So, we would like to introduce "stable column order" option to dbt-osmosis.

Feature spec (image)

The option will be introduced to

  • dbt-osmisis yaml refactor
  • dbt-osmisis yaml document

and the option identifer will be --sort-columns-by SORT_TYPE.

Default SORT_TYPE is index (same as current logic) .
The other is name which sorts columns by column's name.

Our usecase

We are considering using dbt-osmosis in CI to auto-commit column state.
But these commits will be unstable because database column index are vary on environments and situations.
Therefore, stable generation is required in CI and developer environments.

If you have better ideas other than "stable column order", please let me know.

(Edited) Workaround

In our case, by using --full-refresh, database column can be stable in CI environments.

Workaround is enough in our case, so close this issue 🙏