mjirv / dbt-datamocktool

A dbt package for unit testing your SQL analytics models
Apache License 2.0
162 stars 20 forks source link

Ability to write mock_model_relation to custom schema #75

Open jack-cook-repo opened 1 year ago

jack-cook-repo commented 1 year ago

Describe the feature

(Caveat: not sure if this functionality already exists!)

I would like to be able to write the mock_model_relation to a separate schema to the model.

Currently, the model_dmt_{timestamp} models are showing up in our production dataset (alongside model) which are being surfaced in our BI tool. I'd like to put these into a separate schema. Happy to use the custom_schema_name with the generate_schema_name macro if this is possible.

I've done this with the seed files in dbt_project.yml using the seeds/dmt/schema config in my own project.

Describe alternatives you've considered

Tried a few things:

Additional context

Working on BigQuery

Are you interested in contributing this feature?

Happy to make the change given some pointers.

mjirv commented 1 year ago

Hmm, these should be getting created as temporary tables so that this kind of clutter doesn't happen.

{% macro default___get_model_to_mock(model, suffix) %}
    {{ return(make_temp_relation(model.incorporate(type='table'), suffix=suffix)) }}
{% endmacro %}

Can you confirm what dbt, dbt-bigquery, and datamocktool versions you're on?