2323#include " duckdb/common/arrow/physical_arrow_collector.hpp"
2424#include " duckdb_python/arrow/arrow_export_utils.hpp"
2525
26- #include < duckdb/main/relation/table_relation.hpp>
27-
2826namespace duckdb {
2927
3028DuckDBPyRelation::DuckDBPyRelation (shared_ptr<Relation> rel_p) : rel(std::move(rel_p)) {
@@ -1517,10 +1515,6 @@ void DuckDBPyRelation::InsertInto(const string &table) {
15171515 PyExecuteRelation (insert);
15181516}
15191517
1520- static bool IsAcceptedInsertRelationType (const Relation &relation) {
1521- return relation.type == RelationType::TABLE_RELATION;
1522- }
1523-
15241518void DuckDBPyRelation::Update (const py::object &set_p, const py::object &where) {
15251519 AssertRelation ();
15261520 unique_ptr<ParsedExpression> condition;
@@ -1565,7 +1559,7 @@ void DuckDBPyRelation::Update(const py::object &set_p, const py::object &where)
15651559 return rel->Update (std::move (names), std::move (expressions), std::move (condition));
15661560}
15671561
1568- void DuckDBPyRelation::Insert (const py::object ¶ms) {
1562+ void DuckDBPyRelation::Insert (const py::object ¶ms) const {
15691563 AssertRelation ();
15701564 if (this ->rel ->type != RelationType::TABLE_RELATION) {
15711565 throw InvalidInputException (" 'DuckDBPyRelation.insert' can only be used on a table relation" );
@@ -1574,17 +1568,7 @@ void DuckDBPyRelation::Insert(const py::object ¶ms) {
15741568
15751569 D_ASSERT (py::gil_check ());
15761570 py::gil_scoped_release release;
1577- // Grab table info
1578- auto table_relation = static_cast <TableRelation *>(this ->rel .get ());
1579- auto catalog = table_relation->description ->database ;
1580- auto schema = table_relation->description ->schema ;
1581- auto table = table_relation->description ->table ;
1582- // Create a value relation
1583- vector<string> column_names;
1584- auto value_rel =
1585- make_shared_ptr<ValueRelation>(this ->rel ->context ->GetContext (), values, std::move (column_names), " values" );
1586- // Now insert
1587- value_rel->Insert (catalog, schema, table);
1571+ rel->Insert (values);
15881572}
15891573
15901574void DuckDBPyRelation::Create (const string &table) {
0 commit comments