v.db.reconnect.all(1grass)

πŸ’… v.db.reconnect.all β€” the GRASS manual page, bestie edition

okay so. you found v.db.reconnect.all(1grass), and honestly? it's lowkey a baddie. this is the GRASS tool that reconnects attribute tables for all vector maps from the current mapset to a new database. no cap. let's get into it. πŸ¦‹


✨ KEYWORDS ✨

vector, attribute table, database, DBF, SQLite

iykyk πŸ’–


🌸 SYNOPSIS 🌸

v.db.reconnect.all
v.db.reconnect.all --help
v.db.reconnect.all [-cd] [old_database=name] [old_schema=name]
[new_driver=string] [new_database=name] [new_schema=name] [--help]
[--verbose] [--quiet] [--ui]

πŸŽ€ Flags

  • -c β€” Copy attribute tables to the target database if not exist. (if they're not there yet, we make them. periodt.)
  • -d β€” Delete attribute tables from the source database. (⚠️ she's destructive. we'll talk.)
  • --help β€” Print usage summary.
  • --verbose β€” Verbose module output. (she talks more.)
  • --quiet β€” Quiet module output. (she talks less.)
  • --ui β€” Force launching GUI dialog.

🧚 Parameters

  • old_database=name β€” Name of source database. (where the tables are at right now.)
  • old_schema=name β€” Name of source database schema. Do not use this option if schemas are not supported by driver/database server.
  • new_driver=string β€” Name for target driver. (like sqlite, bestie.)
  • new_database=name β€” Name for target database. (where you want them to live.)
  • new_schema=name β€” Name for target database schema. Do not use this option if schemas are not supported by driver/database server.

✨ DESCRIPTION ✨

so what does she actually do. v.db.reconnect.all changes the database connection of all layers of all vector maps in the current mapset, moving them from the source (old_database) to the target (new_database) database. the way that it works is: if a link does not match the old_database, it is left untouched. we respect boundaries in this house πŸ’…

if no new database is given, the default database of the mapset is used, as printed by db.connect -g. if no old database is given, then all layers without a link in the new database will be linked to the new database. and if an old database is given, only links in the old database get changed. choose your own adventure, honestly.

optionally, attribute tables in new_database can be created if they don't exist yet, and that's what the -c flag is for. in that case v.db.reconnect.all also tries to create an index on the key column (usually the "cat" column). she's thorough like that. πŸ”₯


πŸ’œ NOTES πŸ’œ

  • the value of the old_database option needs to be the exact string which appears as the fourth field printed by v.db.connect -g.
v.db.connect -g map=census
1/census|census|cat|/home/user/grassdata/nc_spm_base/PERMANENT/dbf/|dbf
  • v.db.reconnect.all respects variables to be substituted too. in the example above, the database /home/user/grassdata/nc_spm_base/PERMANENT/dbf/ can also be defined as '$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' (see examples). iconic variable behaviour, fr fr.
  • attribute tables from old_database are left untouched after reconnecting. v.db.reconnect.all deletes those tables automatically only when the -d flag is given.
  • also note that v.db.reconnect.all doesn't change the default database driver or database (db.connect -p). default database connection settings for newly created attribute data can be defined by db.connect.

🌈 EXAMPLES 🌈

in the examples below are assumed, that attribute tables are linked to the vector maps through DBF database driver.

πŸ“ Reconnect DBF attribute tables to SQLite database

Reconnect DBF attribute tables linked to the vector maps in the current mapset to SQLite database:

v.db.reconnect.all old_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' \
 new_driver=sqlite new_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db'

If attribute table doesn't exist in the target database (new_database) then the module prints an error message. 😭

πŸŽ€ Convert DBF attribute tables to SQLite database

For coping DBF tables to SQLite database and reconnecting them for all vector maps in the current mapset must be defined also -c flag.

v.db.reconnect.all -c old_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' \
 new_driver=sqlite new_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db'

or alternatively

# set default connection (sqlite)
db.connect -d
# verify default connection
db.connect -g
# reconnect
v.db.reconnect.all -c old_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'

To automatically remove original DBF attribute tables after reconnecting the vector maps use -d flag.

Note that attribute tables will be deleted permanently from the source database. This option should be used very carefully! πŸ’€ like genuinely bestie, read that twice.

πŸ¦‹ Convert GRASS 6 vector map to GRASS 7 including attribute transfer from DBF to SQLite

To become usable in GRASS 7, all vector maps in a mapset need to be updated:

# first rebuild topology for all vector maps
v.build.all
# set new default db connection (to SQLite default)
db.connect -d
# copy attribute tables from old DB to new SQLite DB, delete old tables in DBF format
v.db.reconnect.all -cd

πŸ‘‘ SEE ALSO πŸ‘‘

v.db.connect, db.connect, db.copy, db.createdb, db.droptable

GRASS SQL interface


πŸ’– AUTHORS πŸ’–

Radim Blazek Major update by Martin Landa, Czech Technical University in Prague, Czech Republic


⭐ SOURCE CODE ⭐

Available at: v.db.reconnect.all source code (history)

Latest change: Wednesday Nov 12 08:25:04 2025 in commit: 631d74bc6dbc09177e9c50eaf5debf9b107f7401

Main index | Vector index | Topics index | Keywords index | Graphical index | Full index


okay that's the whole page, you ate that 🫢

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual β€” that's the footer energy, and this doc is serving GRASS 8.5.0, v.db.reconnect.all(1grass). go reconnect something, bestie. πŸ’…βœ¨

πŸ“¦ where this page comes from