<?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: databricks sql create function - input table name as parameter and returns complete table. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128735#M48335</link>
    <description>&lt;P&gt;Thanks for kind words&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/146924"&gt;@BS_THE_ANALYST&lt;/a&gt;&amp;nbsp;. I think you're doing really well so far and I remember your first post on community (Zero to Hero). Actually, it's really impressive how quickly you became proficient with databricks and valuable member of community.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Aug 2025 12:13:54 GMT</pubDate>
    <dc:creator>szymon_dybczak</dc:creator>
    <dc:date>2025-08-18T12:13:54Z</dc:date>
    <item>
      <title>databricks sql create function - input table name as parameter and returns complete table.</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128705#M48320</link>
      <description>&lt;P&gt;hi ,&amp;nbsp;&lt;BR /&gt;I am trying to create a databricks sql unity catalog function which will take table_name as input parameter and returns the full table as output. I am getting error, kindly help&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CREATE OR REPLACE&lt;/SPAN&gt; &lt;SPAN&gt;FUNCTION&lt;/SPAN&gt; &lt;SPAN&gt;catalog&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;schema&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;get_table&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;table_name &lt;/SPAN&gt;&lt;SPAN&gt;STRING&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;RETURNS&lt;/SPAN&gt; &lt;SPAN&gt;TABLE&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; (&lt;BR /&gt;select * from&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;IDENTIFIER(&lt;/SPAN&gt;&lt;SPAN&gt;'catalog.schema.'&lt;/SPAN&gt; &lt;SPAN&gt;||&lt;/SPAN&gt; &lt;SPAN&gt;get_table&lt;/SPAN&gt;&lt;SPAN&gt;.table_name&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;error ---&lt;BR /&gt;[&lt;FONT color="#FF6600"&gt;NOT_A_CONSTANT_STRING.NOT_CONSTANT] The expression concat('kdp_bronze_prod.salesforce.', outer(get_table.user_id)) used for the routine or clause IDENTIFIER must be a constant STRING which is NOT NULL. To be considered constant the expression must not depend on any columns, contain a subquery, or invoke a non deterministic function such as rand(). SQLSTATE: 42601&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 18 Aug 2025 07:41:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128705#M48320</guid>
      <dc:creator>saurabh_aher</dc:creator>
      <dc:date>2025-08-18T07:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: databricks sql create function - input table name as parameter and returns complete table.</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128710#M48322</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/177478"&gt;@saurabh_aher&lt;/a&gt;&amp;nbsp;if you're referring to an object i.e. a table I think you should be using backticks `` and not single quotes ''.&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;However, based on the error message: &lt;STRONG&gt;concat('kdp_bronze_prod.salesforce.', outer(get_table.user_id)).&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;I think in the concat function, it often helps to wrap a string in a &lt;STRONG&gt;LIT&lt;/STRONG&gt; function.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;All the best,&lt;BR /&gt;BS&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 08:29:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128710#M48322</guid>
      <dc:creator>BS_THE_ANALYST</dc:creator>
      <dc:date>2025-08-18T08:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: databricks sql create function - input table name as parameter and returns complete table.</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128712#M48323</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/177478"&gt;@saurabh_aher&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;It looks like this is a limitation of identifier clause.&amp;nbsp;The identifier requires a constant STRING expression. When you're passing table_name as an input of that function it's no longer considered as a constant (known at complied time), but rather runtime value.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="szymon_dybczak_0-1755506028398.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19154i058223EA5391D3F5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="szymon_dybczak_0-1755506028398.png" alt="szymon_dybczak_0-1755506028398.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 08:35:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128712#M48323</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-18T08:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: databricks sql create function - input table name as parameter and returns complete table.</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128717#M48326</link>
      <description>&lt;P&gt;any workaround for this ??&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 09:02:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128717#M48326</guid>
      <dc:creator>saurabh_aher</dc:creator>
      <dc:date>2025-08-18T09:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: databricks sql create function - input table name as parameter and returns complete table.</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128719#M48328</link>
      <description>&lt;P&gt;Unfortunately, if we're talking about databricks sql functions I don't know workaround.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 09:19:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128719#M48328</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-18T09:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: databricks sql create function - input table name as parameter and returns complete table.</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128721#M48329</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/177478"&gt;@saurabh_aher&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;As a workaround maybe you can use SQL procedures, a quick example I created:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE OR REPLACE PROCEDURE workspace.default.get_table_proc(IN p_fqn STRING)
LANGUAGE SQL
SQL SECURITY INVOKER
AS
BEGIN
  DECLARE sql_str STRING;
  SET sql_str = CONCAT('SELECT * FROM ', p_fqn);
  EXECUTE IMMEDIATE sql_str;
END;

&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then you can call it like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CALL workspace.default.get_table_proc('workspace.default.sample_trips_test');&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Hope that helps a bit.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best, Ilir&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 09:24:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128721#M48329</guid>
      <dc:creator>ilir_nuredini</dc:creator>
      <dc:date>2025-08-18T09:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: databricks sql create function - input table name as parameter and returns complete table.</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128723#M48330</link>
      <description>&lt;P&gt;Yep, that will work. Now, if that's okay with you&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/177478"&gt;@saurabh_aher&lt;/a&gt;&amp;nbsp;that can be solution. If you want to stick to using databricks sql function then what I wrote before still applies.&lt;BR /&gt;&lt;BR /&gt;"&lt;SPAN&gt;Unfortunately, &lt;STRONG&gt;if we're talking about databricks sql functions&lt;/STRONG&gt; I don't know workaround. "&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 10:00:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128723#M48330</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-18T10:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: databricks sql create function - input table name as parameter and returns complete table.</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128730#M48334</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp;I admire that you always find the appropriate information in the documentation. I will try my best to emulate this behaviour with other posts &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/177478"&gt;@saurabh_aher&lt;/a&gt;&amp;nbsp;great workaround suggestion with a stored procedure.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Lots of lessons learned here, for me, thanks guys &lt;span class="lia-unicode-emoji" title=":clapping_hands:"&gt;👏&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;All the best,&lt;BR /&gt;BS&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 11:31:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128730#M48334</guid>
      <dc:creator>BS_THE_ANALYST</dc:creator>
      <dc:date>2025-08-18T11:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: databricks sql create function - input table name as parameter and returns complete table.</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128735#M48335</link>
      <description>&lt;P&gt;Thanks for kind words&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/146924"&gt;@BS_THE_ANALYST&lt;/a&gt;&amp;nbsp;. I think you're doing really well so far and I remember your first post on community (Zero to Hero). Actually, it's really impressive how quickly you became proficient with databricks and valuable member of community.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 12:13:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-create-function-input-table-name-as-parameter-and/m-p/128735#M48335</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-18T12:13:54Z</dc:date>
    </item>
  </channel>
</rss>

