Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix read_parquet bug #953

Merged
merged 1 commit into from
Oct 31, 2024
Merged
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
3 changes: 2 additions & 1 deletion leafmap/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12353,6 +12353,7 @@ def read_parquet(
raise ValueError("exclude_columns must be a list or a string.")
columns = f"{columns} EXCLUDE {exclude}"

result = None
if return_type in ["df", "numpy", "arrow", "polars"]:
if sql is None:
sql = f"SELECT {columns} FROM '{source}'"
Expand All @@ -12378,7 +12379,7 @@ def read_parquet(
# if src_crs is not None and dst_crs is not None:
# geom_sql = f"ST_AsText(ST_Transform(ST_GeomFromWKB({geometry}), '{src_crs}', '{dst_crs}', true)) AS {geometry}"
# else:
geom_sql = f"ST_AsText(ST_GeomFromWKB({geometry})) AS {geometry}"
geom_sql = f"ST_AsText(ST_GeomFromWKB(ST_AsWKB({geometry}))) AS {geometry}"
sql = f"SELECT {columns} EXCLUDE {geometry}, {geom_sql} FROM '{source}'"
if limit is not None:
sql += f" LIMIT {limit}"
Expand Down