Declarative Automation Bundles: Replace variables in an SQL file

Daniel_dlh
New Contributor II

Hi all,

I want to deploy a workflow that has an SQL task. The SQL in this tasks needs to be parametrized (as e.g. the catalog name is dependent on the environment).

I have this so far:

In .src/mysql.sql

SELECT * FROM {{ catalog }}.schema.table;

 And my resource definition:

(...)

variables:
  catalog:
    description: The catalog to use
    default: my_catalog

(...)

resources:
  jobs:
    test:
      name: "[test] SQL Varibles"
      tasks:
        - task_key: run_sql
          sql_task:
            warehouse_id: 123456789abc
            file:
              path: ../src/mysql.sql

Unfortunately the variables is not being replaced during deployment and/or execution.

Is that the expected behaviour?

If no, what could be the issue?

If yes, what would be a suggested work-around?

 

Thanks for your support!