Skip to content

Commit ff32a8a

Browse files
committed
Fix review finding. Use KeywordHelper::WriteOptionallyQuoted
1 parent b690066 commit ff32a8a

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

src/duckdb_py/pyrelation.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,6 @@
2424
#include "duckdb_python/arrow/arrow_export_utils.hpp"
2525

2626
namespace duckdb {
27-
namespace {
28-
std::string QuoteIdentifier(const std::string &name) {
29-
std::string out;
30-
out.reserve(name.size() + 2);
31-
out.push_back('"');
32-
for (char c : name) {
33-
if (c == '"') {
34-
out.push_back('"'); // escape " as ""
35-
}
36-
out.push_back(c);
37-
}
38-
out.push_back('"');
39-
return out;
40-
}
41-
} // namespace
4227

4328
DuckDBPyRelation::DuckDBPyRelation(shared_ptr<Relation> rel_p) : rel(std::move(rel_p)) {
4429
if (!rel) {
@@ -168,7 +153,7 @@ unique_ptr<DuckDBPyRelation> DuckDBPyRelation::ProjectFromTypes(const py::object
168153
if (!projection.empty()) {
169154
projection += ", ";
170155
}
171-
projection += QuoteIdentifier(names[i]);
156+
projection += KeywordHelper::WriteOptionallyQuoted(names[i]);
172157
}
173158
}
174159
if (projection.empty()) {

0 commit comments

Comments
 (0)