v.db.reconnect.all(1)

πŸ’… v.db.reconnect.all β€” the GRASS GIS User's Manual glow-up

okay bestie, welcome to v.db.reconnect.all(1) from the GRASS GIS User's Manual β€” this is the tool that reconnects attribute tables for all vector maps in your current mapset over to a whole new database. it's giving "moving day but for your data" 🚚✨

🌸 NAME 🌸

v.db.reconnect.all β€” reconnects attribute tables for all vector maps from the current mapset to a new database.

🏷️ KEYWORDS 🏷️

vector, attribute table, database, DBF, SQLite


✨ 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 over to the target database if they don't exist there yet. no table left behind, periodt πŸ’–
  • -d β€” delete the attribute tables from the source database. (careful bestie, we'll get into that below πŸ‘€)
  • --help β€” prints the usage summary, for when you just need a lil refresher 🫢
  • --verbose β€” verbose module output, aka the module tells you everything it's doing πŸ“’
  • --quiet β€” quiet module output, aka it minds its business and stays silent 🀫
  • --ui β€” force launching the GUI dialog, for the visual girlies πŸŽ€

πŸŽ›οΈ Parameters πŸŽ›οΈ

  • old_database=name β€” name of the source database
  • old_schema=name β€” name of the source database schema. do not use this option if schemas aren't supported by your driver/database server 🚫
  • new_driver=string β€” name for the target driver
  • new_database=name β€” name for the target database
  • new_schema=name β€” name for the target database schema. again, do not use this option if schemas aren't supported by your driver/database server 🚫

πŸ’– DESCRIPTION πŸ’–

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. and if a link doesn't match the old_database? it's left completely untouched. we don't touch what isn't ours, no cap πŸ™…β™€οΈ

if no new database is given, the default database of the mapset is used β€” the one printed by db.connect -g. if no old database is given, then all layers that don't have a link in the new database will get linked to the new database. and if an old database is given, then only the links living in that old database get changed.

optionally, attribute tables in new_database can be created if they don't exist yet β€” that's the -c flag doing its thing ✨. in that case, v.db.reconnect.all also tries to create an index on the key column (usually the "cat" column). iconic behavior honestly.


πŸ“ NOTES πŸ“

the value of the old_database option needs to be the exact string that shows up as the fourth field printed by v.db.connect -g. like, exact exact.

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/’ (peep the examples below for that).

attribute tables from old_database are left untouched after reconnecting. v.db.reconnect.all only deletes those tables automatically when the -d flag is given.

also note that v.db.reconnect.all does not 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. so don't come for it about that, it's simply not its job πŸ’…


🌈 EXAMPLES 🌈

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

πŸ¦‹ Reconnect DBF attribute tables to SQLite database

reconnect DBF attribute tables linked to the vector maps in the current mapset over to a 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 the 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 copying DBF tables to a SQLite database and reconnecting them for all vector maps in the current mapset, you also have to define the -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 the original DBF attribute tables after reconnecting the vector maps, use the -d flag.

⚠️ note that attribute tables will be deleted permanently from the source database. this option should be used very carefully! like, think about it first bestie, that data is not coming back πŸ’€

🧚 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)

Accessed: Saturday Jan 17 05:41:52 2026

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


okay and that's the whole page, you ate that 🫢 main character energy all the way through. this was brought to you by GRASS 8.4.2 πŸ’– and the Β© 2003-2025 GRASS Development Team, from the GRASS GIS 8.4.2 Reference Manual β€” mwah, slay, go reconnect some tables bestie βœ¨πŸŒˆπŸ’…

πŸ“¦ where this page comes from