Feat: allow configuring default formatting behavior in the UI via sql…#2064
Feat: allow configuring default formatting behavior in the UI via sql…#2064izeigerman merged 9 commits intoSQLMesh:mainfrom
Conversation
411ec81 to
6e1cc98
Compare
|
should we make format default_gateway: duckdb
gateways:
duckdb:
connection:
type: duckdb
model_defaults:
dialect: 'duckdb'
format:
pad: 4
indent: 4
leading_commas: true
max_text_width: 120
ui:
format_on_save: true |
|
I wondered the same, personally I think top level would be best. Then the CLI flags would just serve as overrides. |
bb55632 to
d9255b9
Compare
|
@izeigerman I cleaned it up a bit, renamed the newline option to make its intent clear, and made sure format_options is a top level config applicable to both the CLI and UI, and lastly that CLI flags take precedence over the config settings as would be expected. |
|
Seems like a pydantic inconsistency on v1? |
|
do we actually need an option to override global should we then do the same for ui:
format_on_save: true
format_options:
pad: 4
indent: 4
leading_commas: true
max_text_width: 120 |
|
@mykalmax I think the user-specific config in the home directory supported by sqlmesh will already solve for user specific overrides in the ui technically. i think longer term, there should be a modal in the UI with options preset based on the |
|
I also think CLI precedence is typical enough to expect in a tool, it allows for faster iteration -- or imperative flows which dont use the config.py/yaml. I dont think its necessary to constrain it personally 🤷 |
|
Thinking about it more @mykalmax , Since there is some simplification in the code then. And is easier to grok than stacking CLI flags. And its uniform with UI by default as you said. |
|
@z3z1ma would it make more sense to have |
|
I think thats fine to consolidate and drop flags if everyone agrees @mykalmax I would maybe nest the ui format-on-save option though. format:
pad: 4
indent: 4
normalize: false
ui:
enabled: true # auto format on saveI think being able to run I will await decision. (can always pivot later 😄) |
|
@izeigerman @z3z1ma my suggestion was to drop ...
format:
pad: 4
indent: 4
leading_commas: true
max_text_width: 120
ui:
format_on_save: true
... |
|
@izeigerman can you retrigger test. Seems to be hanging? Or I can do another commit I guess |
|
Looks great! Thanks a lot for addressing comments 👍 |
…mesh config. In subsequent iterations perhaps this serves as the "default options" while a modal allows overriding them for the session. But as a general source of truth, I think its better here since you have consistency across the entire team as well as version control.