Is it possible to reference internal Snowflake stage in DBT source yml ?
I know this is possible with external stage using the module : https://github.com/dbt-labs/dbt-external-tables
But this does not work for internal stages.
This functionnality would enable to parse csv from stage directly in dbt, and access the metadata that come with snowflake stage.
Thanks for your help !
I have done that by leaving the @ outside the jinja code. Like this:
SELECT
$1 AS column1,
$2 AS column2
FROM @{{source('MY_SOURCE','MY_TABLE')}} (file_format => MY_DB.MY_SCHEMA.MY_FILE_FORMAT)
In the schema.yml put the information as usual:
version: 2
sources:
- name: MY_SOURCE
database: MY_DB
schema: MY_SCHEMA
tables:
- name: MY_TABLE
This can be done, but I don't recommend it (will break docs). You can reference your stage like this:
version: 2
sources:
- name: bi
database: '@raw'
schema: datalake
description: activation flat file data from s3
tables:
- name: power_bi_usage
identifier: 'DATALAKE_STAGE_FULL_DATALAKE/powerbi/activity-events/'
description: power bi usage information
It would act the same as if you queried the stage directly as such:
SELECT * FROM @RAW.DATALAKE.DATALAKE_STAGE_FULL_DATALAKE/powerbi/activity-events/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With