How do I temporarily make an archive copy of a schema?

Thanks @joellabes .

For what concerns option 1: what is your suggested approach to temporarily archive a schema we’d like to keep for disaster recovery as we test for Blue / Green Deployment?

I couldn’t find a post specifically on this topic so far.

A couple of options:

  1. You could temporarily set a custom schema, configure everything to build as tables and then do a standard dbt run. You would wind up with a copy of every model in a separate schema
  2. You could do something with jinja, e.g. use dbt_utils.get_relations_by_pattern and then loop over its results with handwritten sql statements:
{% set relations = dbt_utils.get_relations_by_pattern(schema_pattern='original_schema', table_pattern='%') %}

{% for relation in relations %}
  create table original_schema_archive.{{ relation.identifier }} as (select * from {{ relation }})
{% endfor %}

I would go with option 1 personally!