Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested enhancement in regular expression for cursor.executemany #281

Closed
kdasoulas opened this issue Apr 23, 2019 · 1 comment
Closed
Labels

Comments

@kdasoulas
Copy link
Contributor

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.

@kdasoulas kdasoulas changed the title Suggested enchancement in regular expression for cursor.executemany Suggested enhancement in regular expression for cursor.executemany Apr 23, 2019
@sitingren sitingren added the bug label Apr 23, 2019
@sitingren
Copy link
Member

@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
Fix in regular expression for issue vertica#281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants