Skip to content

Commit

Permalink
Update sample macro for exporting data
Browse files Browse the repository at this point in the history
  • Loading branch information
Noel Gomez committed Nov 11, 2023
1 parent 649040c commit 30a4be8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions transform/macros/extracting/dump_data.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{# This macro exports Snowflake data to an external file on S3 #}
{#
To run:
dbt run-operation offload_table --args "{model_name: 'data_export', stage: 'DATACOVES_DB.ETL1.EXT_LINEITEM_STAGE'}" -t dev_xs
dbt run-operation offload_table --args "{model_name: 'personal_loans', stage: 'RAW.RAW.EXT_JSONFILES_STAGE'}" -t prd
#}

{% macro offload_table(model_name, stage = "DATACOVES_DB.ETL1.EXT_LINEITEM_STAGE") %}
Expand All @@ -11,9 +11,7 @@
{% set copy_sql %}
copy into @{{ stage }}/ng_test_{{ model_name }}/data_
from (
select
L_ORDERKEY, L_PARTKEY, L_SUPPKEY, L_LINENUMBER, L_QUANTITY, L_EXTENDEDPRICE, L_DISCOUNT, L_TAX, L_RETURNFLAG, L_LINESTATUS, L_SHIPDATE, L_COMMITDATE, L_RECEIPTDATE, L_SHIPINSTRUCT, L_SHIPMODE, L_COMMENT
from DATACOVES_DB.ETL1.DC_TC2_LINEITEM
select * from {{ ref(model_name) }}
)
header = true
overwrite = true
Expand Down

0 comments on commit 30a4be8

Please sign in to comment.