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

Feature request: Support stable column order #113

Closed sadahry closed 8 months ago

sadahry commented 8 months ago

Database column index order are vary on environments and situations.

e.g.,

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

Feature spec (image)

The option will be introduced to

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.

sadahry commented 8 months ago

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