Skip to content

DBT Macro: Register Glue Table

DBT macro name: trase_duckdb.register_glue_table

DBT details


Description

No description


Details

{% macro register_glue_table(table=none, database=none, path=none) -%}
  {%- set _path = path if path is not none else config.get('location') -%}
  {%- if _path and _path.startswith('s3://') -%}
    {%- set _name = this.identifier -%}
    {%- if _name.endswith('_gold') -%}
      {%- set _name = _name[:-5] -%}
    {%- endif -%}
    {%- set _table = table if table is not none else _name -%}
    {%- set _db = database if database is not none else '' -%}
    SELECT register_glue_table(
      {{ "'" ~ _db ~ "'" }},
      {{ "'" ~ _table ~ "'" }},
      {{ "'" ~ _path ~ "'" }}
    )
  {%- else -%}
    SELECT 'register_glue_table skipped: model output is not on S3' AS msg
  {%- endif -%}
{%- endmacro %}