[CONPY-137] cursor.execute does not work with "indicators" Created: 2020-12-29 Updated: 2020-12-29 Resolved: 2020-12-29 |
|
| Status: | Closed |
| Project: | MariaDB Connector/Python |
| Component/s: | Generic |
| Affects Version/s: | 1.0.5 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Marcelo Titonelli Pio da Cruz | Assignee: | Georg Richter |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
WIndows 10 64bits |
||
| Description |
|
Sample modified from Official doc:
Expected output: Current output: Execute does not insert default value for Apple Cake when using execute alone, but it works after one row is inserted through executemany because it buffers the default values. Executemany is not a full alternative due to this another bug, which breaks trigger, but it may be a temporary work around if used on one row before using multiple execute. |
| Comments |
| Comment by Georg Richter [ 2020-12-29 ] | ||||||||||||||||||||||
|
"When using executemany(), there are a few restrictions: - All tuples must have the same types as in first tuple. E.g. the parameter [(1),(1.0)] or [(1),(None)] are invalid. - Special values like None or column default value needs to be indicated by an indicator." execute() uses a different client/server protocol (COM_STMT_EXECUTE) and doesn't support indicator variables. | ||||||||||||||||||||||
| Comment by Marcelo Titonelli Pio da Cruz [ 2020-12-29 ] | ||||||||||||||||||||||
|
Thanks again, Georg. https://mariadb-corporation.github.io/mariadb-connector-python/usage.html#using-indicators Official docs sample below:
It looks like a bug because if executemany is called, even without indicators, at same session, before execute, execute works correctly with indicators, but if executemany is omitted, indicators will not work with execute. Note that, in below sample, I'm only passing one row to executemany, with no indicator.
Can a note be added to docs mentioning execute does not work correctly with indicators? |