Skip to content

regression from 6.0.1 to 6.0.2 / numeric / executemany / setinputsizes: "expecting float" #75

@zzzeek

Description

@zzzeek

the changes related to numeric have broken existing behavior for executemany():

import cx_Oracle
import decimal

conn = cx_Oracle.connect(
    user="scott",
    password="tiger",
    dsn=cx_Oracle.makedsn(
        "oracle1120", 1521, sid="xe",
    )
)

cursor = conn.cursor()


cursor.execute("""
CREATE TABLE t (
    x NUMERIC(10, 2)
)
""")
try:
    # works
    cursor.setinputsizes(x=cx_Oracle.NUMBER)
    cursor.execute(
        "INSERT INTO t (x) VALUES (:x)",
        x=decimal.Decimal("25.8")
    )

    # fails: "expecting float"
    cursor.setinputsizes(x=cx_Oracle.NUMBER)
    cursor.executemany(
        "INSERT INTO t (x) VALUES (:x)",
       [{"x": decimal.Decimal("25.8")}, {"x": decimal.Decimal("30.0")}]
    )

finally:
    cursor = conn.cursor()
    cursor.execute("DROP TABLE t")
    cursor.close()

with cx_oracle 6.0.2:

Traceback (most recent call last):
File "test.py", line 32, in
[{"x": decimal.Decimal("25.8")}, {"x": decimal.Decimal("30.0")}]
TypeError: expecting float

succeeds with oracle 6.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions