<?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: List parameter in Python SQL connector 3.0.1 in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/list-parameter-in-python-sql-connector-3-0-1/m-p/55335#M30311</link>
    <description>&lt;P&gt;I should better read the documentation : &lt;A href="https://github.com/databricks/databricks-sql-python/blob/v3.0.0/docs/parameters.md" target="_blank"&gt;https://github.com/databricks/databricks-sql-python/blob/v3.0.0/docs/parameters.md&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Dec 2023 16:45:16 GMT</pubDate>
    <dc:creator>PetitLepton</dc:creator>
    <dc:date>2023-12-15T16:45:16Z</dc:date>
    <item>
      <title>List parameter in Python SQL connector 3.0.1</title>
      <link>https://community.databricks.com/t5/data-engineering/list-parameter-in-python-sql-connector-3-0-1/m-p/55333#M30310</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;up to recently in version of the Python SQL connector 2.9.3, I was using a list as a parameter in the cursor.execute(operation, parameters) method without any trouble. It seems that it is not possible anymore in version 3.0.1 as the parsing of parameters does not accept lists but only scalar types&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    def dbsql_parameter_from_primitive(
        value: TAllowedParameterValue, name: Optional[str] = None
    ) -&amp;gt; "TDbsqlParameter":
        """Returns a DbsqlParameter subclass given an inferrable value
    
        This is a convenience function that can be used to create a DbsqlParameter subclass
        without having to explicitly import a subclass of DbsqlParameter.
        """
    
        # This series of type checks are required for mypy not to raise
        # havoc. We can't use TYPE_INFERRENCE_MAP because mypy doesn't trust
        # its logic
    
        if type(value) is int:
            return dbsql_parameter_from_int(value, name=name)
        elif type(value) is str:
            return StringParameter(value=value, name=name)
        elif type(value) is float:
            return FloatParameter(value=value, name=name)
        elif type(value) is datetime.datetime:
            return TimestampParameter(value=value, name=name)
        elif type(value) is datetime.date:
            return DateParameter(value=value, name=name)
        elif type(value) is bool:
            return BooleanParameter(value=value, name=name)
        elif type(value) is decimal.Decimal:
            return DecimalParameter(value=value, name=name)
        elif value is None:
            return VoidParameter(value=value, name=name)
    
        else:
&amp;gt;           raise NotSupportedError(
                f"Could not infer parameter type from value: {value} - {type(value)} \n"
                "Please specify the type explicitly."
            )
E           databricks.sql.exc.NotSupportedError: Could not infer parameter type from value: ['TEMPERATURE'] - &amp;lt;class 'list'&amp;gt; 
E           Please specify the type explicitly.&lt;/LI-CODE&gt;&lt;P&gt;Did I miss something? How can I perform a request with a clause such as `WHERE metrics IN :metrics`?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 16:15:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/list-parameter-in-python-sql-connector-3-0-1/m-p/55333#M30310</guid>
      <dc:creator>PetitLepton</dc:creator>
      <dc:date>2023-12-15T16:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: List parameter in Python SQL connector 3.0.1</title>
      <link>https://community.databricks.com/t5/data-engineering/list-parameter-in-python-sql-connector-3-0-1/m-p/55335#M30311</link>
      <description>&lt;P&gt;I should better read the documentation : &lt;A href="https://github.com/databricks/databricks-sql-python/blob/v3.0.0/docs/parameters.md" target="_blank"&gt;https://github.com/databricks/databricks-sql-python/blob/v3.0.0/docs/parameters.md&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 16:45:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/list-parameter-in-python-sql-connector-3-0-1/m-p/55335#M30311</guid>
      <dc:creator>PetitLepton</dc:creator>
      <dc:date>2023-12-15T16:45:16Z</dc:date>
    </item>
  </channel>
</rss>

