<?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: Paramter Type while Executing Rest API of Execute a SQL statement POST /api/2.0/sql/statements/ in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/paramter-type-while-executing-rest-api-of-execute-a-sql/m-p/84244#M37170</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/117483"&gt;@A4Ashish&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Currently complex data types are not supported in parameters. Have a look at below snippet from documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/api/workspace/statementexecution/executestatement" target="_blank"&gt;https://docs.databricks.com/api/workspace/statementexecution/executestatement&lt;/A&gt;&lt;/P&gt;&lt;P&gt;"If the type is given, parameters will be checked for type correctness according to the given type. &lt;STRONG&gt;A value is correct if the provided string can be converted to the requested type using the cast function. The exact semantics are described in the section cast function of the SQL language reference."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So&lt;/STRONG&gt;, according to documentation the only valid values are ones that can be casted to the target type using cast function. Now, take a look on below matrix from cast function documentation. As you can see, you cannot cast string to array using cast function, thus you cannot use it in this API.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot_20240826-212945.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10601i6F08230941401563/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="Screenshot_20240826-212945.png" alt="Screenshot_20240826-212945.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Aug 2024 19:34:00 GMT</pubDate>
    <dc:creator>szymon_dybczak</dc:creator>
    <dc:date>2024-08-26T19:34:00Z</dc:date>
    <item>
      <title>Paramter Type while Executing Rest API of Execute a SQL statement POST /api/2.0/sql/statements/</title>
      <link>https://community.databricks.com/t5/data-engineering/paramter-type-while-executing-rest-api-of-execute-a-sql/m-p/84209#M37160</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;So previously I was using Old Preview Databricks API version. Now I have switched to v1 of the API which usage&amp;nbsp;&lt;BR /&gt;Execute a SQL statement POST /api/2.0/sql/statements/&lt;BR /&gt;&lt;BR /&gt;I wanted to know how to pass the parameter class when my value is list of string for Eg&lt;BR /&gt;OLD Method&lt;BR /&gt;SQL - Select * from Table where columnName in ({{someName}})&lt;BR /&gt;parameter - new ParametersList {Name = "someName", Value = someNameList, Type = "enum", MultiValuesOptions = new MultiValuesListParameter { Prefix = "", Suffix = "", Separator = "," }, EnumOptions = string.Join("\n", someNameList)}&lt;BR /&gt;&lt;BR /&gt;Now I need to convert this in new Databricks API&lt;BR /&gt;SQL - Select * from Table where columnName in (:someName)&lt;BR /&gt;parameter - new ParametersList {Name = "someName", Value = someNameList, Type = "string")}&lt;BR /&gt;&lt;BR /&gt;this new parameter structure I go from the official link here&amp;nbsp;&lt;BR /&gt;&lt;A href="https://docs.databricks.com/api/azure/workspace/statementexecution/executestatement" target="_blank"&gt;Execute a SQL statement | Statement Execution API | REST API reference | Azure Databricks&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Im not sure how to pass this parameter as the request is getting Bad request in response, I mainly wanted to know what to give Type when Value is a list&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 11:59:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/paramter-type-while-executing-rest-api-of-execute-a-sql/m-p/84209#M37160</guid>
      <dc:creator>A4Ashish</dc:creator>
      <dc:date>2024-08-26T11:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Paramter Type while Executing Rest API of Execute a SQL statement POST /api/2.0/sql/statements/</title>
      <link>https://community.databricks.com/t5/data-engineering/paramter-type-while-executing-rest-api-of-execute-a-sql/m-p/84244#M37170</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/117483"&gt;@A4Ashish&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Currently complex data types are not supported in parameters. Have a look at below snippet from documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/api/workspace/statementexecution/executestatement" target="_blank"&gt;https://docs.databricks.com/api/workspace/statementexecution/executestatement&lt;/A&gt;&lt;/P&gt;&lt;P&gt;"If the type is given, parameters will be checked for type correctness according to the given type. &lt;STRONG&gt;A value is correct if the provided string can be converted to the requested type using the cast function. The exact semantics are described in the section cast function of the SQL language reference."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So&lt;/STRONG&gt;, according to documentation the only valid values are ones that can be casted to the target type using cast function. Now, take a look on below matrix from cast function documentation. As you can see, you cannot cast string to array using cast function, thus you cannot use it in this API.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot_20240826-212945.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10601i6F08230941401563/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="Screenshot_20240826-212945.png" alt="Screenshot_20240826-212945.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 19:34:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/paramter-type-while-executing-rest-api-of-execute-a-sql/m-p/84244#M37170</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2024-08-26T19:34:00Z</dc:date>
    </item>
  </channel>
</rss>

