-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
Closed
Labels
IO SQLto_sql, read_sql, read_sql_queryto_sql, read_sql, read_sql_query
Milestone
Description
Feature request for supporting also Connection objects instead of only Engines.
Also reported in #8533, #10104
My use case - I often add a week's worth of data (stored in a pandas dataframe) to an existing table. Before I add the data, I want to be able to delete any existing data for this week from the table, but I want the whole thing to be wrapped in a transaction so I'm not left in a mess halfway through.
Here's what I therefore want to be able to do
# runs a transaction
with engine.begin() as connection:
r1 = connection.execute(table.delete().where(table.c[WEEK]==week))
data.to_sql(table.name, connection, if_exists='append')i.e. my change is that I want to be able to pass a SQLAlchemy Connection object into DataFrame.to_sql instead of an Engine. (The underlying Engine of the Connection object can be accessed as .engine, so we should still be able to pull metadata etc)
lematt1991
Metadata
Metadata
Assignees
Labels
IO SQLto_sql, read_sql, read_sql_queryto_sql, read_sql, read_sql_query