Giter Site home page Giter Site logo

Comments (3)

nicor88 avatar nicor88 commented on May 30, 2024 1

I don't think that you need a specific adapter implementation for this.

I achieve what you suggested simply with the following approach:

  • overwridde the get_schema_macro
{% macro generate_schema_name(custom_schema_name, node) -%}
  {%- set default_schema = target.schema -%}

  {%- if 'development' in target.name or 'ci' in target.name -%}
    {{ default_schema | trim }}
  {%- else -%}
    {%- if custom_schema_name is none -%}
      {{ default_schema | trim}}
    {%- else -%}
      {{ custom_schema_name | trim }}
    {%- endif -%}
  {%- endif -%}

{%- endmacro %}
  • use a specific profile for development e.g. development e.g.
config:
  send_anonymous_usage_stats: false

zolar:
  outputs:
    development:
      aws_profile_name: your-aws-profile
      database: awsdatacatalog
      region_name: eu-central-1
      s3_staging_dir: "...."
      s3_data_dir: "...."
      s3_data_naming: table_unique
      schema: "{{ env_var('DBT_DEFAULT_DB')}}"
      type: athena
      threads: 3
      num_retries: 0
      work_group: "dbt-development"
  target: "development_staging"

The above config requires an .env file with a variable DBT_DEFAULT_DB that must be sourced by every developer to allow to use the proper dbt database.

Doing the above the people working with dbt have their own database, therefore name collision won't never happen.
At the same time ref still works, and tables are created and referenced from the developer database.

from dbt-athena.

nicor88 avatar nicor88 commented on May 30, 2024

Another way to achieve what you suggested is overwriting generate_alias_name, could be more suitable if you don't want to have a dbt database for developer.
I found the solution proposed above better on scale.
I have more than 10 people working with dbt, therefore I believe that table aliases/prefix per developer are not cleaner.

https://docs.getdbt.com/docs/build/custom-aliases

from dbt-athena.

dacreify avatar dacreify commented on May 30, 2024

Thanks for the suggestions! Looks like we can accomplish this at the project level by overriding macros. 👍

from dbt-athena.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.