~olly/yoyo#103: 
oracle batch script migrations

From cx_oracle documentation: https://cx-oracle.readthedocs.io/en/latest/user_guide/batch_statement.html

You need to use cursor.executemany(sql, data)

the following patch works for me..

--- /python3.7/site-packages/yoyo/migrations.py 2024-05-08 14:41:38.000000000 +0200 +++ /python3.7/site-packages/yoyo/migrations.py_new 2024-05-20 13:35:13.209572376 +0200 @@ -375,7 +375,7 @@ logger.debug(" - executing %r", stmt.encode("ascii", "replace")) else: logger.debug(" - executing %r", stmt)

  •    cursor.execute(stmt)
    
  •    cursor.executemany(stmt, [])
       if cursor.description:
           result = [[str(value) for value in row] for row in cursor.fetchall()]
           column_names = [desc[0] for desc in cursor.description]
    
Status
REPORTED
Submitter
~ralcini
Assigned to
No-one
Submitted
2 months ago
Updated
2 months ago
Labels
No labels applied.

~ralcini 2 months ago

It's not the best patch, but I've not analyzed where to build and define a more clean piece of code

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