File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424#include " duckdb_python/arrow/arrow_export_utils.hpp"
2525
2626namespace duckdb {
27-
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+ out.push_back (c);
36+ }
37+ out.push_back (' "' );
38+ return out;
39+ }
40+ } // namespace
2841DuckDBPyRelation::DuckDBPyRelation (shared_ptr<Relation> rel_p) : rel(std::move(rel_p)) {
2942 if (!rel) {
3043 throw InternalException (" DuckDBPyRelation created without a relation" );
@@ -153,7 +166,7 @@ unique_ptr<DuckDBPyRelation> DuckDBPyRelation::ProjectFromTypes(const py::object
153166 if (!projection.empty ()) {
154167 projection += " , " ;
155168 }
156- projection += names[i];
169+ projection += QuoteIdentifier ( names[i]) ;
157170 }
158171 }
159172 if (projection.empty ()) {
You can’t perform that action at this time.
0 commit comments