How to use copy into

The problem I’m having

The context of why I’m trying to do this

I have a data in snowflake stage and I need to use copy into to load the data in

What I’ve already tried

{% macro unload_data_to_snowflake() %}

    {{ log("Unloading data", True) }}
    BEGIN;
    COPY INTO anaplan_raw.quarterly_cashflow_master_project
    FROM @my_azure_stage/QuaterlyMasterProjectDDQ.csv
    FILE_FORMAT = (TYPE = 'CSV' SKIP_HEADER = 1 field_optionally_enclosed_by='"')
    COMMIT;
    {{ log("Unloaded data", True) }}

{% endmacro %}`

Some example code or error messages

Put code inside backticks
  to preserve indentation
    which is especially important 
      for Python and YAML! 

I have no idea how to make this work as a macro. It just won’t load into it. Thanks

Hi @u9999xyz,

Can you try something like these?

{% macro unload_data_to_snowflake() %}

    {{ log("Unloading data", True) }}

    {% set copy_statement %}
      COPY INTO anaplan_raw.quarterly_cashflow_master_project
      FROM @my_azure_stage/QuaterlyMasterProjectDDQ.csv
      FILE_FORMAT = (TYPE = 'CSV' SKIP_HEADER = 1 field_optionally_enclosed_by='"')
    {% endset %}

    {% do run_query(copy_statement) %}

    {{ log("Unloaded data", True) }}

{% endmacro %}