Skip to content

cx_oracle allows me to insert pyodbc.row object or objects in executemany() and execute. oracledb does not!  #205

@hl1

Description

@hl1
  1. What versions are you using?

V.1.3.1 on windows and linux

  1. Is it an error or a hang or a crash?

error

  1. What error(s) or behavior you are seeing?

DPY-2004: "parameters" argument should be a list of sequences or dictionaries, or an integer specifying the number of times to execute the statement

  1. Does your application call init_oracle_client()?
    does not work regardless if it is thin or thick mode.

  2. Include a runnable Python script that shows the problem.

import pyodbc
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=SQLSRV01;DATABASE=DATABASE;UID=USER;PWD=PASSWORD')
cursor = cnxn.cursor()
cursor.execute("SELECT 1, 2 UNION SELECT 3, 4")
results = cursor.fetchall()

with oracledb.connect(user=un, password=pw, dsn=cs) as connection:
    with connection.cursor() as oracle_cursor:
        oracle_cursor.executemany("insert into ParentTable values (:1, :2)", results)

I get the following error on the last line:
DPY-2004: "parameters" argument should be a list of sequences or dictionaries, or an integer specifying the number of times to execute the statement

more info:

type(results) -- returns <class 'list'>
type(results[0]) -- return <class 'pyodbc.Row'>

This works with no problem in cx_oracle!

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