Hi,
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
def dbsql_parameter_from_primitive(
value: TAllowedParameterValue, name: Optional[str] = None
) -> "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:
> 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'] - <class 'list'>
E Please specify the type explicitly.
Did I miss something? How can I perform a request with a clause such as `WHERE metrics IN :metrics`?
Thanks in advance!