Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] consistent YAML ordering #117

Open
manypozo opened this issue Nov 20, 2023 · 1 comment
Open

[feature request] consistent YAML ordering #117

manypozo opened this issue Nov 20, 2023 · 1 comment
Labels
good first issue Good for newcomers

Comments

@manypozo
Copy link

I find it useful to have consistent ordering on some sections of dbt, and default alphabetical ordering on some other sections.

The example below are sources, but the idea can be applied to other yaml documents too.

version: 2
sources:

# main keys are ordered consistently, where tables is the last key to ease file reading
- name: A
  description: 'description'
  database: 'DB'
  schema: 'SCHEMA'
  quoting:
   database: false
   schema: false
   identifier: false
  meta:
   key_1: 'a'
   key_2: 'b'

  freshness:
   warn_after: { count: 9999, period: day }
  loaded_at_field: updated_at::timestamp

  tags: []

  tables: # list of tables ordered Alphabetically
  - name: table_A
    description: 'description'
    columns:
    - name: col_a
      description: ' '        
      
    - name: col_b
      description: ' '     
      tests:
     
  - name: table_B
  - name: table_C
    
# if other sources in the file, then sources list is also ordered alphabetically
- name: B

Also, I would challenge the fact of ordering columns as the order coming from the DB. I would say alphabetical order makes reading easier.

I am not very familiar with dbt-osmosis code base yet, but happy to take a look at how could the be implemented if it is of any interest

@z3z1ma
Copy link
Owner

z3z1ma commented Dec 7, 2023

I think configurability here would make sense -- there is one place in the code base where we do the yaml dumping.
I am fairly strongly of the opinion that DB ordering is better for a number of reasons. But I also think that folks will have differing opinions and needs to my own. So maybe a CLI flag is sufficient.

@z3z1ma z3z1ma added the good first issue Good for newcomers label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants