Skip to content

pandas to_sql(if_exists='replace') should not commit after the drop query #32933

Open
@ma7555

Description

@ma7555

Code Sample, a copy-pastable example if possible

it is hard to generate a reproducible code for this problem as it would need parallel processes reading from a table, and another process that updates that table frequently.

Problem description

self.pd_sql.drop_table(self.name, self.schema)

self._execute_create()

The issue is that to_sql with (if_exists='replace') carries the two instructions separately and commits them serially into the database.

This causes 'table not found error' if multiple other processes are reading from the table as well.

The commit needs to happen after the second instruction only and not into the drop query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO SQLto_sql, read_sql, read_sql_queryMultithreadingParallelism in pandas

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions