duckdb / duckdb/duckdb-spatial
ST_Read: add normalize_names option (like read_csv)
- Dominant language
- C
- Stars
- 708
- Forks
- 96
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 5
Description
## Feature request
`read_csv` supports a `normalize_names` option that lowercases column names and replaces special characters with underscores. It would be useful if `ST_Read` supported the same option.
## Motivation
Many geospatial datasets (shapefiles, GeoPackages, etc.) use mixed-case column names — e.g. `RC_Name`, `Region_NM`, `H3_count`, `pctCloneTown`. When loading these into DuckDB alongside other tables that use snake_case, users must manually alias every column:
```sql
SELECT
rc.RC_ID AS rc_id,
rc.RC_Name AS rc_name,
rc.Region_NM AS region_nm,
...
FROM ST_Read('data.gpkg') rc
```
With `normalize_names := true` this would become:
```sql
SELECT * FROM ST_Read('data.gpkg', normalize_names := true)
-- columns: rc_id, rc_name, region_nm, ...
```
## Proposed behaviour
Consistent with `read_csv`:
- Lowercase all column names
- Replace spaces and special characters with `_`
- Default to `false` for backwards compatibility
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.