Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Connections executemany implementation is not a prepared statement.  #196

Copy link
Copy link
@martinitus

Description

@martinitus
Issue body actions

While PEP249 says

Modules are free to implement this method using multiple calls to the .execute() method or by using array operations to have the database process the sequence as a whole in one call.

Just reading the docstring from the connection class is maximally misleading:

def executemany(self, operation, seq_of_parameters):
"""
Prepare a database operation (query or command) and then execute it against all parameter
sequences or mappings found in the sequence ``seq_of_parameters``.
Only the final result set is retained.
:returns self
"""
for parameters in seq_of_parameters:
self.execute(operation, parameters)
return self

As a user, I (of course) assumed that databricks-sql-connector does something smart like e.g. batched inserts for a insert query. Instead I find that I have many thousand sequentially executed individual insert requests, one for each row.

I suggest to change the docstring to point out that behaviour!

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.