Skip to content

ST_Read: add normalize_names option (like read_csv) #819

Description

@virgesmith

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:

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions