Skip to content

[Feat] db.in.ogr should recognize column data types when importing CSV files #4593

@cmbarton

Description

@cmbarton

The problem
CSV is one of the most commonly and widely used formats for exchanging tabular data across platforms. However, it is difficult to import csv files into GRASS. Currently, db.in.ogr imports csv files but transforms all columns to text. The suggested work around is to create an accompanying *.csvt file that specifies the data types for each column. This is very cumbersome, especially for files with many columns. But OGR will automatically recognize column data types if a file open option is set
-oo AUTODETECT_TYPE=YES
This makes importing csv files much easier. This can be manually entered into the gdal_oo argument in db.in.ogr but this is not mentioned in the manual. It would be even better if this is the default behavior of db.in.ogr

Proposed solution
-oo AUTODETECT_TYPE=YES should be the default for importing a csv file using db.in.ogr
a "csvt" flag should be added to enable a user to create a csvt file to override this default behavior

See #4450 for additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    PythonRelated code is in PythondatabaseRelated to database managementenhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions