<?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: Using variables in Spark SQL in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/using-variables-in-spark-sql/m-p/33158#M24234</link>
    <description>&lt;P&gt;Hi Hubert ,&lt;/P&gt;&lt;P&gt;As you have mentioned that it can not be used for everything , in my case also it doesn't suit as I have a lot variables declaration and having a function created for each variable doesn't look good.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Sep 2022 10:13:31 GMT</pubDate>
    <dc:creator>HariharaSam</dc:creator>
    <dc:date>2022-09-07T10:13:31Z</dc:date>
    <item>
      <title>Using variables in Spark SQL</title>
      <link>https://community.databricks.com/t5/data-engineering/using-variables-in-spark-sql/m-p/33154#M24230</link>
      <description>&lt;P&gt;Is there a way to declare variables in Spark SQL like we do it in T-SQL?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 09:38:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/using-variables-in-spark-sql/m-p/33154#M24230</guid>
      <dc:creator>HariharaSam</dc:creator>
      <dc:date>2022-08-30T09:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using variables in Spark SQL</title>
      <link>https://community.databricks.com/t5/data-engineering/using-variables-in-spark-sql/m-p/33155#M24231</link>
      <description>&lt;P&gt;Nice question. There was a discussion about the topic here &lt;A href="https://community.databricks.com/s/question/0D53f00001c9RUYCA2/whats-the-equivalent-of-declare-in-databricks-sql-" alt="https://community.databricks.com/s/question/0D53f00001c9RUYCA2/whats-the-equivalent-of-declare-in-databricks-sql-" target="_blank"&gt;https://community.databricks.com/s/question/0D53f00001c9RUYCA2/whats-the-equivalent-of-declare-in-databricks-sql-&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So there are functions, widgets, or just combining Python with SQL. Probably I would choose SQL functions as they are permanent and stay in metastore (but can not be used for everything).&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    CREATE OR REPLACE FUNCTION my_name(name STRING COMMENT 'my name')
      RETURNS STRING
      COMMENT 'just first name'
      CONTAINS SQL DETERMINISTIC
      RETURN name || 'Hubert'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 20:26:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/using-variables-in-spark-sql/m-p/33155#M24231</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-08-30T20:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using variables in Spark SQL</title>
      <link>https://community.databricks.com/t5/data-engineering/using-variables-in-spark-sql/m-p/33158#M24234</link>
      <description>&lt;P&gt;Hi Hubert ,&lt;/P&gt;&lt;P&gt;As you have mentioned that it can not be used for everything , in my case also it doesn't suit as I have a lot variables declaration and having a function created for each variable doesn't look good.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 10:13:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/using-variables-in-spark-sql/m-p/33158#M24234</guid>
      <dc:creator>HariharaSam</dc:creator>
      <dc:date>2022-09-07T10:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using variables in Spark SQL</title>
      <link>https://community.databricks.com/t5/data-engineering/using-variables-in-spark-sql/m-p/33156#M24232</link>
      <description>&lt;P&gt;Could you please follow the below link and let us know if this helps? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.databricks.com/s/question/0D53f00001HKHa3CAH/how-do-i-pass-parameters-to-my-sql-statements" target="test_blank"&gt;https://community.databricks.com/s/question/0D53f00001HKHa3CAH/how-do-i-pass-parameters-to-my-sql-statements&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 21:10:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/using-variables-in-spark-sql/m-p/33156#M24232</guid>
      <dc:creator>Debayan</dc:creator>
      <dc:date>2022-08-30T21:10:31Z</dc:date>
    </item>
  </channel>
</rss>

