Skip to content

cx_Oracle 7.0 regression, param.getvalue() returning data as a list #224

Closed
@zzzeek

Description

@zzzeek

cx_Oracle 7.0 has changed the behavior of a parameter in the context of RETURNING in a breaking way, which breaks SQLAlchemy's support for RETURNING.

test case:

import cx_Oracle

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

cursor = conn.cursor()

try:
    cursor.execute("drop sequence my_seq")
except:
    pass

try:
    cursor.execute("drop table my_table")
except:
    pass

cursor.execute("create sequence my_seq")
cursor.execute("create table my_table (id integer primary key, data varchar(10))")

param = cursor.var(
    cx_Oracle.STRING,
    255,
    arraysize=cursor.arraysize,
    outconverter=int
)

cursor.execute(
    "insert into my_table(id, data) "
    "values (my_seq.nextval, :data) "
    "RETURNING my_table.id INTO :ret_0",
    {"data": "mydata", "ret_0": param}
)

val = param.getvalue()

# passes < cx_Oracle 7.0, cx_Oracle == 7.0 gets:
# AssertionError: [1]
assert val == 1, val

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions