Skip to content

Commit 3d73752

Browse files
committed
QualifiedName and ProfilerPrintFormat
1 parent 4c63e39 commit 3d73752

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

src/duckdb_py/pyconnection.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ shared_ptr<DuckDBPyConnection> DuckDBPyConnection::UnregisterUDF(const string &n
413413
auto &catalog = Catalog::GetCatalog(context, SYSTEM_CATALOG);
414414
DropInfo info;
415415
info.type = CatalogType::SCALAR_FUNCTION_ENTRY;
416-
info.name = Identifier(name);
416+
info.NameMutable() = Identifier(name);
417417
info.allow_drop_internal = true;
418418
info.cascade = false;
419419
info.if_not_found = OnEntryNotFound::THROW_EXCEPTION;
@@ -1651,11 +1651,12 @@ unique_ptr<DuckDBPyRelation> DuckDBPyConnection::RunQuery(const py::object &quer
16511651
unique_ptr<DuckDBPyRelation> DuckDBPyConnection::Table(const string &tname) {
16521652
auto &connection = con.GetConnection();
16531653
auto qualified_name = QualifiedName::Parse(tname);
1654-
if (qualified_name.schema.empty()) {
1655-
qualified_name.schema = DEFAULT_SCHEMA;
1654+
if (qualified_name.Schema().empty()) {
1655+
qualified_name.SchemaMutable() = DEFAULT_SCHEMA;
16561656
}
16571657
try {
1658-
return CreateRelation(connection.Table(qualified_name.catalog, qualified_name.schema, qualified_name.name));
1658+
return CreateRelation(
1659+
connection.Table(qualified_name.Catalog(), qualified_name.Schema(), qualified_name.Name()));
16591660
} catch (const CatalogException &) {
16601661
// CatalogException will be of the type '... is not a table'
16611662
// Not a table in the database, make a query relation that can perform replacement scans

src/duckdb_py/pyexpression.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,13 @@ shared_ptr<DuckDBPyExpression> DuckDBPyExpression::ColumnExpression(const py::ar
325325
}
326326

327327
auto qualified_name = QualifiedName::Parse(column_name);
328-
if (!qualified_name.catalog.empty()) {
329-
column_names.push_back(qualified_name.catalog);
328+
if (!qualified_name.Catalog().empty()) {
329+
column_names.push_back(qualified_name.Catalog());
330330
}
331-
if (!qualified_name.schema.empty()) {
332-
column_names.push_back(qualified_name.schema);
331+
if (!qualified_name.Schema().empty()) {
332+
column_names.push_back(qualified_name.Schema());
333333
}
334-
column_names.push_back(qualified_name.name);
334+
column_names.push_back(qualified_name.Name());
335335
} else {
336336
for (auto &part : names) {
337337
column_names.push_back(Identifier(py::str(part)));

src/duckdb_py/pyrelation.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,7 @@ DuckDBPyRelation &DuckDBPyRelation::Execute() {
15811581
void DuckDBPyRelation::InsertInto(const string &table) {
15821582
AssertRelation();
15831583
auto parsed_info = QualifiedName::Parse(table);
1584-
auto insert = rel->InsertRel(parsed_info.catalog, parsed_info.schema, parsed_info.name);
1584+
auto insert = rel->InsertRel(parsed_info.Catalog(), parsed_info.Schema(), parsed_info.Name());
15851585
PyExecuteRelation(insert);
15861586
}
15871587

@@ -1645,7 +1645,7 @@ void DuckDBPyRelation::Insert(const py::object &params) const {
16451645
void DuckDBPyRelation::Create(const string &table) {
16461646
AssertRelation();
16471647
auto parsed_info = QualifiedName::Parse(table);
1648-
auto create = rel->CreateRel(parsed_info.schema, parsed_info.name, false);
1648+
auto create = rel->CreateRel(parsed_info.Schema(), parsed_info.Name(), false);
16491649
PyExecuteRelation(create);
16501650
}
16511651

@@ -1747,7 +1747,7 @@ string DuckDBPyRelation::Explain(ExplainType type, const string &format) {
17471747

17481748
// An empty format means "auto": the default format, or HTML when running under Jupyter.
17491749
const bool auto_format = format.empty();
1750-
auto explain_format = auto_format ? GetExplainFormat(type) : ProfilerPrintFormat::FromString(format);
1750+
auto explain_format = auto_format ? GetExplainFormat(type) : ProfilerPrintFormat(format);
17511751
auto res = rel->Explain(type, explain_format);
17521752
D_ASSERT(res->type == duckdb::QueryResultType::MATERIALIZED_RESULT);
17531753
auto &materialized = res->Cast<MaterializedQueryResult>();

0 commit comments

Comments
 (0)