db.in.ogr(1grass)

✨ db.in.ogr ✨

okay bestie, welcome to db.in.ogr from the GRASS User's Manual β€” it's the little import icon of the database world and honestly? iconic πŸ’–

πŸ’« NAME πŸ’«

db.in.ogr β€” imports attribute tables in various formats. slay.

🏷️ KEYWORDS 🏷️

database, import, attribute table


πŸŽ€ SYNOPSIS πŸŽ€

db.in.ogr
db.in.ogr --help
db.in.ogr input=name  [gdal_config=string]   [gdal_doo=string]
[db_table=name]   [output=name]   [key=string]   [encoding=string]
[--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

🚩 Flags 🚩

  • --overwrite β€” allow output files to overwrite existing files (yes it will just ✨replace✨ them, be aware)
  • --help β€” print usage summary, your little cheat sheet
  • --verbose β€” verbose module output, chatty mode activated
  • --quiet β€” quiet module output, shhh mode
  • --ui β€” force launching GUI dialog

🧚 Parameters 🧚

  • input=name [required] β€” table file to be imported, or a DB connection string. like, you literally cannot skip this one bestie
  • gdal_config=string β€” GDAL configuration options. comma-separated list of key=value pairs
  • gdal_doo=string β€” GDAL dataset open options. also a comma-separated list of key=value pairs
  • db_table=name β€” name of table from given DB to be imported
  • output=name β€” name for output table
  • key=string β€” name for auto-generated unique key column
  • encoding=string β€” encoding value for attribute data

🌸 DESCRIPTION 🌸

so db.in.ogr imports attribute tables in various formats, as supported by the OGR library on your local system β€” think DBF, CSV, PostgreSQL, SQLite, MySQL, ODBC, etc. πŸ’… and optionally? a unique key (ID) column can be added to the table. cute, right?


🌈 EXAMPLES 🌈

πŸ“ Import CSV file

limited type recognition can be done for Integer, Real, String, Date, Time and DateTime columns β€” through a descriptive file with same name as the CSV file, but with a .csvt extension (see details here). iykyk.

# NOTE: create koeppen_gridcode.csvt first for automated type recognition
db.in.ogr input=koeppen_gridcode.csv output=koeppen_gridcode gdal_doo="AUTODETECT_TYPE=YES"
db.describe koeppen_gridcode -c
db.select table=koeppen_gridcode

πŸ¦‹ Import DBF table

import of a DBF table with an additional unique key column (e.g., needed for v.in.db). like, that key column? she's doing important work.

db.in.ogr input=/path/to/mydata.dbf output=census_raleigh key=myid
db.describe -c census_raleigh

πŸ‘‘ Import of a SQLite table

db.in.ogr input=/path/to/sqlite.db db_table=census_raleigh output=census_raleigh

🫢 Import of a PostgreSQL table

# HINT: if the database contains spatial tables, but you want to import a non-spatial
table, set the environmental variable PG_LIST_ALL_TABLES to YES before importing
db.in.ogr input="PG:host=localhost dbname=ecad user=neteler" \
          db_table=ecad_verona_tmean output=ecad_verona_tmean
db.select table=ecad_verona_tmean
db.describe -c ecad_verona_tmean

πŸ“Š Import XLS file

to force reading headers, define the environmental variable OGR_XLS_HEADERS=’FORCE’. parameter db_table refers to the list within the XLS file.

export OGR_XLS_HEADERS=’FORCE’
db.in.ogr input=address.xls db_table=address_data

⭐ SEE ALSO ⭐

  • db.select, v.in.ogr, v.in.db
  • GRASS SQL interface

πŸ’œ AUTHOR πŸ’œ

Markus Neteler


πŸ”₯ SOURCE CODE πŸ”₯

available at: db.in.ogr source code (history)

latest change: Tuesday May 20 22:51:55 2025 in commit: 6f8ee15f43b0425f1bee79306540f3221004d255

main index | database index | topics index | keywords index | graphical index | full index

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual


okay that's the whole thing babes, no cap, every last flag accounted for πŸ’…βœ¨ GRASS 8.5.0, the db.in.ogr(1grass) page β€” go import something cute, bestie πŸ’–πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from