~olly/yoyo#100: 
cx_oracle, db API and named param style

Hi, during yoyo initialization using cx_oracle drivers we had the below issue:

<<<<>>>>/lib/python3.7/site-packages/yoyo/backends/base.py", line 388, in execute cursor.execute(sql, params) TypeError: expecting a dictionary, sequence or keyword args

when executing the following statement:

CREATE TABLE "yoyo_lock" (locked INT DEFAULT 1, ctime TIMESTAMP,pid INT NOT NULL,PRIMARY KEY (locked))

I've a look to the sources and I suppose that the fix can be placed in yoyo/utils.py in method def change_param_style(target_style, sql, bind_parameters): assigning a default value to bind_parameters

if target_style == "named": return sql, bind_parameters if bind_parameters else {}

Status
RESOLVED FIXED
Submitter
~ralcini
Assigned to
No-one
Submitted
8 months ago
Updated
8 months ago
Labels
No labels applied.

~ralcini 8 months ago

let me know if you need some other details

~olly REPORTED FIXED 8 months ago

Thanks for the report, this should be fixed in changeset a38828e1ac85.

I don't have any way to test against Oracle, so it would be really useful for me if you could check out the latest version and let me know if it works now.

~ralcini 8 months ago

Hi, the target version is yoyo 9? It seems not working on python 3.7.9

File "----lib/python3.7/site-packages/yoyo/utils.py", line 133, in bind_parameters: t.Optional[abc.Mapping[str, t.Any]] TypeError: 'ABCMeta' object is not subscriptable

Register here or Log in to comment, or comment via email.