Skip to content

Add model defaults at the subfolder level within the models/ directory #4996

@sungchun12

Description

@sungchun12

Let's make it easy to add model defaults to different subfolders within a sqlmesh project. We have it at the project level and individual model level, but nothing in between. This will be helpful for granting permissions, grouping together pre/post-statements, etc.

Similar to this recent PR: #4995

Model config override behavior: model > subfolder > project

Quick and dirty mockup for config.yaml:

model_defaults:
  dialect: duckdb
  pre_statements:
    - "SET timeout = 300000"
  post_statements:
    - "@IF(@runtime_stage = 'evaluating', ANALYZE @this_model)"
  on_virtual_update:
    - "GRANT SELECT ON @this_model TO ROLE analyst_role"
  subfolder_a:
      dialect: snowflake
      pre_statements:
        - "SET timeout = 200000"
  subfolder_b:
      pre_statements:
        - "SET timeout = 400000"

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureAdds new functionalityUXIssues related to user experience such as config setting, cli output, debugging

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions