Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/duckdb_py/pyrelation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ unique_ptr<DuckDBPyRelation> DuckDBPyRelation::ProjectFromTypes(const py::object
if (!projection.empty()) {
projection += ", ";
}
projection += names[i];
projection += KeywordHelper::WriteOptionallyQuoted(names[i]);
}
}
if (projection.empty()) {
Expand Down
7 changes: 7 additions & 0 deletions tests/fast/test_relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,3 +688,10 @@ def create_view(con, view_name: str) -> None:

res = con.sql("select * from vw").fetchall()
assert res == expected

def test_relation_select_dtypes_quotes_identifiers_with_spaces(self, duckdb_cursor):
df = pd.DataFrame({"na me": ["alice", "bob"], "x": [1, 2]})
rel = duckdb_cursor.from_df(df)
out = rel.select_dtypes([duckdb.sqltypes.VARCHAR]).fetchdf()
assert list(out.columns) == ["na me"]
assert out["na me"].tolist() == ["alice", "bob"]