You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In many cases the INSERT statement has many columns and as a result we need to break the statement across multiple lines.
However, if we pass the statement as a multi-line comment (which is much easier compared to having to concatenate a different string for each line), the regular expression in cursor.executemany fails and we cannot utilize it.
To be exact, it fails only when we use one or more newline characters between the parenthesis of the VALUES section.
Checking the code and more specifically the RE_BASIC_INSERT_STAT definition we see the part (?P<values>.*).
If the above part is changed to (?P<values>(.|\\s)*) or (?P<values>(\\S|\\s)*) the problem will be amended.
The text was updated successfully, but these errors were encountered:
kdasoulas
changed the title
Suggested enchancement in regular expression for cursor.executemany
Suggested enhancement in regular expression for cursor.executemany
Apr 23, 2019
@kdasoulas Thanks for reporting this issue. Feel free to open a pull request with your bugfix if you want (read up on our contributing guidelines first).
Alternatively, please try cursor.executemany(..., ..., use_prepared_statements=True) as the function would go through a different code path.
kdasoulas
added a commit
to kdasoulas/vertica-python
that referenced
this issue
Apr 23, 2019
In many cases the INSERT statement has many columns and as a result we need to break the statement across multiple lines.
However, if we pass the statement as a multi-line comment (which is much easier compared to having to concatenate a different string for each line), the regular expression in cursor.executemany fails and we cannot utilize it.
To be exact, it fails only when we use one or more newline characters between the parenthesis of the VALUES section.
Checking the code and more specifically the
RE_BASIC_INSERT_STAT
definition we see the part(?P<values>.*)
.If the above part is changed to
(?P<values>(.|\\s)*)
or(?P<values>(\\S|\\s)*)
the problem will be amended.The text was updated successfully, but these errors were encountered: