1db.copy(1) Grass User's Manual db.copy(1)
2
3
4
6 db.copy - Copy a table. Either 'from_table' (optionaly with 'where')
7 can be used or 'select' option, but not 'from_table' and 'select' at
8 the same time.
9
11 database, SQL
12
14 db.copy
15 db.copy help
16 db.copy [from_driver=string] [from_database=string] [from_ta‐
17 ble=string] [to_driver=string] [to_database=string] to_ta‐
18 ble=string [where=string] [select=string]
19
20 Parameters:
21 from_driver=string
22 Input driver name Options: dbf,mysql,ogr,pg,sqlite,mesql,odbc
23
24 from_database=string
25 Input database name
26
27 from_table=string
28 Input table name (only, if 'select' is not used)
29
30 to_driver=string
31 Output driver name Options: dbf,mysql,ogr,pg,sqlite,mesql,odbc
32
33 to_database=string
34 Output database name
35
36 to_table=string
37 Output table name
38
39 where=string
40 Optional where condition (without WHERE key word), e.g.:
41 obec = 'Liptakov'
42
43 select=string
44 Full select statement (only, if 'from_table' and 'where' is not
45 used), e.g.:
46 SELECT dedek FROM starobince WHERE obec = 'Frimburg'
47
49 db.copy allows the user to copy a table between two databases. Data‐
50 bases can be connected through different drivers (see example).
51
53 Attribute tables can be copied manually using db.copy and v.db.connect.
54 Current connection settings are saved in $LOCATION/vector_map/dbln.
55
57 DBF -> PG
58 Storing table 'markveggy.dbf' (in current directory) into PostgreSQL
59 through ODBC:
60
61 db.copy from_driver=dbf from_database=$HOME/grass‐
62 data/spearfish60/user1/dbf \
63 from_table=markveggy to_driver=pg to_data‐
64 base="host=pgserver,dbname=grass6test" \
65 to_table=markveggy
66
67
68 PG -> DBF
69
70 db.copy from_driver=pg from_data‐
71 base="host=pgserver.itc.it,dbname=testdb" \
72 from_table=origtable to_driver=dbf \
73 to_database=$HOME/grassdata/spearfish60/user1/dbf to_table=origtable
74
75
76 PG -> PG with condition
77
78 db.copy from_driver=pg from_database="host=localhost,dbname=meteo" \
79 from_table=ukraine to_driver=pg to_database="host=local‐
80 host,dbname=meteo" \
81 to_table=selection where="cat < 500"
82
83
84 DBF -> SQLite
85
86 db.copy from_driver=dbf from_database=$HOME/grass‐
87 data/spearfish60/user1/dbf \
88 from_table=ammprv to_driver=sqlite \
89 to_database=$HOME/grassdata/spearfish60/user1/mysqlite.db to_ta‐
90 ble=ammprv
91 # convenient viewer:
92 sqlitebrowser $HOME/grassdata/spearfish60/user1/mysqlite.db
93
94
95 SQLite -> DBF
96
97 db.copy from_driver=sqlite from_database=$HOME/grass‐
98 data/spearfish60/user1/mysqlite.db \
99 from_table=ammprv to_driver=dbf to_database=$HOME/grass‐
100 data/spearfish60/user1/dbf \
101 to_table=ammprv
102
103
105 v.db.connect, db.drivers, db.login, v.clean, GRASS SQL interface
106
108 Radim Blazek, ITC-irst, Trento, Italy
109
110 Last changed: $Date: 2006/03/21 17:29:39 $
111
112 Full index
113
114
115
116GRASS 6.2.2 db.copy(1)