<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Declarative Automation Bundles: Replace variables in an SQL file in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/declarative-automation-bundles-replace-variables-in-an-sql-file/m-p/152001#M53736</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/216690"&gt;@Ashwin_DSA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;thanks for the quick answer!&lt;/P&gt;&lt;P&gt;This is actually working, great!&lt;/P&gt;&lt;P&gt;However, when the variable gets replace, the value is put into ' (single quotes) making the example statement I used above an incorrect SQL statement.&amp;nbsp;&lt;BR /&gt;Any idea how to get rid of those single quotes?&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Wed, 25 Mar 2026 11:54:58 GMT</pubDate>
    <dc:creator>Daniel_dlh</dc:creator>
    <dc:date>2026-03-25T11:54:58Z</dc:date>
    <item>
      <title>Declarative Automation Bundles: Replace variables in an SQL file</title>
      <link>https://community.databricks.com/t5/data-engineering/declarative-automation-bundles-replace-variables-in-an-sql-file/m-p/151973#M53729</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;I have this so far:&lt;/P&gt;&lt;P&gt;In .src/mysql.sql&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECT * FROM {{ catalog }}.schema.table;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And my resource definition:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(...)

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&lt;/LI-CODE&gt;&lt;P&gt;Unfortunately the variables is not being replaced during deployment and/or execution.&lt;/P&gt;&lt;P&gt;Is that the expected behaviour?&lt;/P&gt;&lt;P&gt;If no, what could be the issue?&lt;/P&gt;&lt;P&gt;If yes, what would be a suggested work-around?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your support!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2026 08:38:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/declarative-automation-bundles-replace-variables-in-an-sql-file/m-p/151973#M53729</guid>
      <dc:creator>Daniel_dlh</dc:creator>
      <dc:date>2026-03-25T08:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Declarative Automation Bundles: Replace variables in an SQL file</title>
      <link>https://community.databricks.com/t5/data-engineering/declarative-automation-bundles-replace-variables-in-an-sql-file/m-p/151981#M53732</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/215525"&gt;@Daniel_dlh&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I had recently responded to a similar query on this topic. You may want to check &lt;A href="https://community.databricks.com/t5/data-engineering/parametrizing-queries-in-dab-deployments/td-p/151106" target="_self"&gt;this&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At a high level, you’re combining two separate mechanisms.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bundle variables (variables: + ${var.name}) are resolved only in the bundle config (YAML/Python) at deploy/validate time.&lt;/P&gt;
&lt;P&gt;SQL task parameters (sql_task.parameters used as {{param}} in SQL) are what actually get substituted inside the .sql file at run time.&lt;/P&gt;
&lt;P&gt;So {{ catalog }} in the SQL file will only be replaced if catalog is defined under sql_task.parameters.&lt;/P&gt;
&lt;P&gt;Does this help?&lt;/P&gt;
&lt;P class="p1"&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;STRONG&gt;&lt;I&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/I&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2026 09:54:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/declarative-automation-bundles-replace-variables-in-an-sql-file/m-p/151981#M53732</guid>
      <dc:creator>Ashwin_DSA</dc:creator>
      <dc:date>2026-03-25T09:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Declarative Automation Bundles: Replace variables in an SQL file</title>
      <link>https://community.databricks.com/t5/data-engineering/declarative-automation-bundles-replace-variables-in-an-sql-file/m-p/152001#M53736</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/216690"&gt;@Ashwin_DSA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;thanks for the quick answer!&lt;/P&gt;&lt;P&gt;This is actually working, great!&lt;/P&gt;&lt;P&gt;However, when the variable gets replace, the value is put into ' (single quotes) making the example statement I used above an incorrect SQL statement.&amp;nbsp;&lt;BR /&gt;Any idea how to get rid of those single quotes?&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2026 11:54:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/declarative-automation-bundles-replace-variables-in-an-sql-file/m-p/152001#M53736</guid>
      <dc:creator>Daniel_dlh</dc:creator>
      <dc:date>2026-03-25T11:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Declarative Automation Bundles: Replace variables in an SQL file</title>
      <link>https://community.databricks.com/t5/data-engineering/declarative-automation-bundles-replace-variables-in-an-sql-file/m-p/152014#M53739</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/215525"&gt;@Daniel_dlh&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;No problem. Glad it works.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That quoting is expected. SQL task parameters are bound as values, so string params are always inserted as '...' literals. You can’t turn that off, but you can work around it by using IDENTIFIER() and building a full name as a string.&lt;/P&gt;
&lt;P&gt;For example, instead of:&lt;/P&gt;
&lt;DIV class="l8rrz21 _1ibi0s3dn" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-sql p8i6j0e hljs language-sql _12n1b832"&gt;&lt;SPAN class="hljs-keyword"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;*&lt;/SPAN&gt;
&lt;SPAN class="hljs-keyword"&gt;FROM&lt;/SPAN&gt; {{ catalog }}.schema.table;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="l8rrz23 _1ibi0s3d6 _1ibi0s332 _1ibi0s3do _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="lqznwq0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&lt;SPAN&gt;do:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="l8rrz21 _1ibi0s3dn" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-sql p8i6j0e hljs language-sql _12n1b832"&gt;&lt;SPAN class="hljs-keyword"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;*&lt;/SPAN&gt;
&lt;SPAN class="hljs-keyword"&gt;FROM&lt;/SPAN&gt; IDENTIFIER({{ catalog }} &lt;SPAN class="hljs-operator"&gt;||&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;'.schema.table'&lt;/SPAN&gt;);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="l8rrz23 _1ibi0s3d6 _1ibi0s332 _1ibi0s3do _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="l8rrz25 _1ibi0s3db"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;with catalog = my_catalog in your parameters. The engine sees IDENTIFIER('my_catalog.schema.table'), which is valid and resolves to the correct object.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Let me know if that works.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P class="p1"&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;I&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/I&gt;&lt;/FONT&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Mar 2026 13:03:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/declarative-automation-bundles-replace-variables-in-an-sql-file/m-p/152014#M53739</guid>
      <dc:creator>Ashwin_DSA</dc:creator>
      <dc:date>2026-03-25T13:03:51Z</dc:date>
    </item>
  </channel>
</rss>

