Closed
Description
When explicitly using the cast function to cast something into a sa.Float, the engine silently ignores this command and instead does nothing. This is especially dangerous when working with bind parameters as the implicit casting, does not work.
E.g:
metadata = sa.MetaData()
table = sa.Table(table_input, metadata, schema=schema_name, autoload_with=engine)
int_column_1 = table.int_column_1
int_column_2 = table.int_column_2
problem_query = sa.cast(int_column_1 / int_column_2, sa.Float) / 1_000_000
When now executing this query, one would expect a float outcome, however due to the way the
python-ibmdbsa/ibm_db_sa/base.py
Line 450 in fdb3618
What is the reasoning for only having a set number of types that casting is possible to?
Metadata
Metadata
Assignees
Labels
No labels