1v.db.reconnect.all(1)       GRASS GIS User's Manual      v.db.reconnect.all(1)
2
3
4

NAME

6       v.db.reconnect.all   -  Reconnects attribute tables for all vector maps
7       from the current mapset to a new database.
8

KEYWORDS

10       vector, attribute table, database
11

SYNOPSIS

13       v.db.reconnect.all
14       v.db.reconnect.all --help
15       v.db.reconnect.all   [-cd]    [old_database=name]     [old_schema=name]
16       [new_driver=string]        [new_database=name]        [new_schema=name]
17       [--help]  [--verbose]  [--quiet]  [--ui]
18
19   Flags:
20       -c
21           Copy attribute tables to the target database if not exist
22
23       -d
24           Delete attribute tables from the source database
25
26       --help
27           Print usage summary
28
29       --verbose
30           Verbose module output
31
32       --quiet
33           Quiet module output
34
35       --ui
36           Force launching GUI dialog
37
38   Parameters:
39       old_database=name
40           Name of source database
41
42       old_schema=name
43           Name of source database schema
44           Do not use this option if schemas are not supported by driver/data‐
45           base server
46
47       new_driver=string
48           Name for target driver
49
50       new_database=name
51           Name for target database
52
53       new_schema=name
54           Name for target database schema
55           Do not use this option if schemas are not supported by driver/data‐
56           base server
57

DESCRIPTION

59       v.db.reconnect.all changes database connection of  all  layers  of  all
60       vector maps in the current mapset from the source (old_database) to the
61       target (new_database) database. If a link does not match the  old_data‐
62       base it is left untouched.
63
64       If  no  new database is given, the default datase of the mapset is used
65       as printed by db.connect -g. If no old database is  given,  all  layers
66       without a link in the new database will be liniked to the new database.
67       If an old database is given, only links in the  old  database  will  be
68       changed.
69
70       Optionally attribute tables in new_database can be created if not exist
71       by -c flag. In this case v.db.reconnect.all also tries to create an in‐
72       dex on key column (usually "cat" column).
73

NOTES

75       The value of the old_database option needs to be the exact string which
76       appears as the fourth field printed by v.db.connect -g.
77       v.db.connect -g map=census
78       1/census|census|cat|/home/user/grassdata/nc_spm_base/PERMANENT/dbf/|dbf
79       v.db.reconnect.all respect also variables to be substituted. In the ex‐
80       ample  above,  database /home/user/grassdata/nc_spm_base/PERMANENT/dbf/
81       can be also defined as ’$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/’ (see ex‐
82       amples).
83
84       Attribute  tables  from  old_database  are  after reconnecting left un‐
85       touched. v.db.reconnect.all deletes  those  tables  automatically  only
86       when -d flag is given.
87
88       Also  note  that  v.db.reconnect.all  doesn’t  change  default database
89       driver or database (db.connect -p). Default  database  connection  set‐
90       tings for newly created attribute data can be defined by db.connect.
91

EXAMPLES

93       In  the examples below are assumed, that attribute tables are linked to
94       the vector maps through DBF database driver.
95
96   Reconnect DBF attribute tables to SQLite database
97       Reconnect DBF attribute tables linked to the vector maps in the current
98       mapset to SQLite database:
99       v.db.reconnect.all old_database=’$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/’ \
100        new_driver=sqlite new_database=’$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db’
101       If  attribute table doesn’t exist in the target database (new_database)
102       then the module prints an error message.
103
104   Convert DBF attribute tables to SQLite database
105       For coping DBF tables to SQLite database and reconnecting them for  all
106       vector maps in the current mapset must be defined also -c flag.
107       v.db.reconnect.all -c old_database=’$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/’ \
108        new_driver=sqlite new_database=’$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db’
109       or alternatively
110       # set default connection (sqlite)
111       db.connect -d
112       # verify default connection
113       db.connect -g
114       # reconnect
115       v.db.reconnect.all -c old_database=’$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/’
116       To  automatically remove original DBF attribute tables after reconnect‐
117       ing the vector maps use -d flag. Note that  attribute  tables  will  be
118       deleted  permanently  from  the  source database. This option should be
119       used very carefully!
120
121   Convert GRASS 6 vector map to GRASS 7 including attribute transfer from DBF
122       to SQLite
123       To become usable in GRASS 7, all vector maps in a mapset need to be up‐
124       dated:
125       # first rebuild topology for all vector maps
126       v.build.all
127       # set new default db connection (to SQLite default)
128       db.connect -d
129       # copy attribute tables from old DB to new SQLite DB, delete old tables in DBF format
130       v.db.reconnect.all -cd
131

SEE ALSO

133        v.db.connect, db.connect, db.copy, db.createdb, db.droptable
134
135        GRASS SQL interface
136

AUTHORS

138       Radim Blazek
139       Major update by Martin Landa, Czech  Technical  University  in  Prague,
140       Czech Republic
141

SOURCE CODE

143       Available at: v.db.reconnect.all source code (history)
144
145       Accessed: Mon Jun 20 16:47:46 2022
146
147       Main  index  | Vector index | Topics index | Keywords index | Graphical
148       index | Full index
149
150       © 2003-2022 GRASS Development Team, GRASS GIS 8.2.0 Reference Manual
151
152
153
154GRASS 8.2.0                                              v.db.reconnect.all(1)
Impressum