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

users should be able to call config multiple times within the same model #558

Closed
3 tasks done
jthandy opened this issue Oct 11, 2017 · 1 comment
Closed
3 tasks done
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jthandy
Copy link
Member

jthandy commented Oct 11, 2017

Issue

dbt's clobber configuration fields (eg. materialized', bind', etc) can be currently be specified in multiple config() blocks. This looks like:

{{ config(materialized='view') }}
{{ config(materialized='table') }}

Here, the model is correctly built as a table. A more realistic use case might involve a macro that itself calls config() with some default arguments. Subsequent calls to config() may override some of this behavior. Eg:

-- macros/config.sql
{% macro base_config() %}
  {{ config(materialized='table', sort='timestamp', dist='id') }}
{% endmacro %}

-- models/some_model.sql

{{ base_config() }}
{{ config(dist='all') }}

While the paradigm works for dbt's clobber configs, it does not currently work for the append- and extend- configs (like post-hooks and vars, for instance).

Append configs

Given:

{{ config({"post-hook": 'select 1 as id'}) }}
{{ config({"post-hook": 'select 2 as id'}) }}

Expected:

post-hooks == ["select 1 as id", "select 2 as id"]

Extend configs

Given:

{{ config({"vars": {"abc": 123}) }}
{{ config({"vars": {"def": 456}) }}

Expected:

vars == {"abc": 123, "def": 456}

Todo:

  • Support the specification of append configs multiple times
  • Support the specification of extend configs multiple times
  • add test for multiple specifications of clobber, append, and extend configs
@drewbanin drewbanin modified the milestones: Orchestration, 0.9.1 Nov 10, 2017
@drewbanin drewbanin removed this from the 0.9.1 milestone Dec 14, 2017
@drewbanin drewbanin added this to the Jinja Improvements milestone Mar 6, 2018
@drewbanin drewbanin added the good_first_issue Straightforward + self-contained changes, good for new contributors! label Mar 12, 2018
@cmcarthur

This comment has been minimized.

@drewbanin drewbanin added this to the Stephen Girard milestone Oct 18, 2018
@drewbanin drewbanin modified the milestones: Stephen Girard, Grace Kelly Nov 2, 2018
@drewbanin drewbanin added bug Something isn't working and removed good_first_issue Straightforward + self-contained changes, good for new contributors! labels Nov 14, 2018
@beckjake beckjake self-assigned this Nov 23, 2018
beckjake added a commit that referenced this issue Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants