.TH db.copy 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBdb.copy\fR\fR - Copy a table. .br Either 'from_table' (optionally with 'where') can be used or 'select' option, but not 'from_table' and 'select' at the same time. .SH KEYWORDS database, attribute table, SQL .SH SYNOPSIS \fBdb.copy\fR .br \fBdb.copy help\fR .br \fBdb.copy\fR [\fBfrom_driver\fR=\fIname\fR] [\fBfrom_database\fR=\fIname\fR] [\fBfrom_table\fR=\fIname\fR] [\fBto_driver\fR=\fIname\fR] [\fBto_database\fR=\fIname\fR] \fBto_table\fR=\fIname\fR [\fBwhere\fR=\fIsql_query\fR] [\fBselect\fR=\fIstring\fR] [\-\-\fBoverwrite\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-\-overwrite\fR" 4m .br Allow output files to overwrite existing files .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBfrom_driver\fR=\fIname\fR" 4m .br Input driver name .br Options: \fIpg,dbf,ogr,odbc,mysql,sqlite\fR .br Default: \fIdbf\fR .IP "\fBfrom_database\fR=\fIname\fR" 4m .br Input database name .br Default: \fI$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\fR .IP "\fBfrom_table\fR=\fIname\fR" 4m .br Input table name (only, if 'select' is not used) .IP "\fBto_driver\fR=\fIname\fR" 4m .br Output driver name .br Options: \fIpg,dbf,ogr,odbc,mysql,sqlite\fR .br Default: \fIdbf\fR .IP "\fBto_database\fR=\fIname\fR" 4m .br Output database name .br Default: \fI$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\fR .IP "\fBto_table\fR=\fIname\fR" 4m .br Output table name .IP "\fBwhere\fR=\fIsql_query\fR" 4m .br WHERE conditions of SQL statement without 'where' keyword .br Example: income = 10000 .IP "\fBselect\fR=\fIstring\fR" 4m .br Full select statement (only, if 'from_table' and 'where' is not used) .br E.g.: SELECT dedek FROM starobince WHERE obec = 'Frimburg' .PP .SH DESCRIPTION \fIdb.copy\fR allows the user to copy a table between two databases. Databases can be connected through different drivers (see example). .SH NOTES Attribute tables can be copied using \fIdb.copy\fR and, when to be associated to a vector map, assigned to the map with \fIv.db.connect\fR. Current connection settings are saved in the file \fI$LOCATION/vector_map/dbln\fR. .SH EXAMPLES .SS DBF -> PG \fIStoring table 'markveggy.dbf' (in current directory) into PostgreSQL through ODBC:\fR .br \fC .DS .br db.copy from_driver=dbf from_database=$HOME/grassdata/spearfish60/user1/dbf \(rs .br from_table=markveggy to_driver=pg to_database="host=pgserver,dbname=grass6test" \(rs .br to_table=markveggy .br .DE \fR .SS PG -> DBF \fC .DS .br db.copy from_driver=pg from_database="host=pgserver.itc.it,dbname=testdb" \(rs .br from_table=origtable to_driver=dbf \(rs .br to_database=$HOME/grassdata/spearfish60/user1/dbf to_table=origtable .br .DE \fR .SS PG -> PG with condition \fC .DS .br db.copy from_driver=pg from_database="host=localhost,dbname=meteo" \(rs .br from_table=ukraine to_driver=pg to_database="host=localhost,dbname=meteo" \(rs .br to_table=selection where="cat < 500" .br .DE \fR .SS DBF -> SQLite \fC .DS .br db.copy from_driver=dbf from_database=$HOME/grassdata/spearfish60/user1/dbf \(rs .br from_table=ammprv to_driver=sqlite \(rs .br to_database=$HOME/grassdata/spearfish60/user1/sqlite.db to_table=ammprv .br .br # convenient viewer: .br sqlitebrowser $HOME/grassdata/spearfish60/user1/sqlite.db .br .DE \fR .SS SQLite -> DBF \fC .DS .br db.copy from_driver=sqlite from_database=$HOME/grassdata/spearfish60/user1/sqlite.db \(rs .br from_table=ammprv to_driver=dbf to_database=$HOME/grassdata/spearfish60/user1/dbf \(rs .br to_table=ammprv .br .DE \fR .SH SEE ALSO \fIv.db.connect, db.drivers, db.login, v.clean, GRASS SQL interface\fR .SH AUTHOR Radim Blazek, ITC-irst, Trento, Italy .PP \fILast changed: $Date: 2013-03-18 18:51:35 +0100 (Mon, 18 Mar 2013) $\fR .PP Full index .PP © 2003-2014 GRASS Development Team