~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to db/db.copy/db.copy.html

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<h2>DESCRIPTION</h2>
 
2
 
 
3
<em>db.copy</em> allows the user to copy a table between two databases.
 
4
Databases can be connected through different drivers (see examples below).
 
5
 
 
6
<h2>NOTES</h2>
 
7
 
 
8
Attribute tables can be copied using <em>db.copy</em> and, when to be
 
9
associated to a vector map, assigned to the map with
 
10
<em><a href="v.db.connect.html">v.db.connect</a></em>. Current connection 
 
11
settings are saved in the file <em>$LOCATION/vector_map/dbln</em>.  
 
12
 
 
13
<h2>EXAMPLES</h2>
 
14
 
 
15
<h3>From DBF to PostgreSQL</h3>
 
16
 
 
17
<em>Storing table 'geonames.dbf' (in current directory) into PostgreSQL
 
18
through ODBC:</em><br>
 
19
 
 
20
<div class="code"><pre>
 
21
db.copy from_driver=dbf from_database='$GISDBASE/$LOCATION_NAME/PERMANENT/dbf' \
 
22
  from_table=geonames to_driver=pg to_database="host=pgserver,dbname=testdb" \
 
23
  to_table=geonames 
 
24
</pre></div>
 
25
 
 
26
 
 
27
<h3>From PostgreSQL to DBF</h3>
 
28
 
 
29
<div class="code"><pre>
 
30
db.copy from_driver=pg  from_database="host=pgserver.example.org,dbname=testdb" \
 
31
  from_table=origtable to_driver=dbf \
 
32
  to_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf' to_table=origtable
 
33
</pre></div>
 
34
 
 
35
 
 
36
<h3>From PostgreSQL to PostgreSQL with condition</h3>
 
37
 
 
38
<div class="code"><pre>
 
39
db.copy from_driver=pg  from_database="host=localhost,dbname=testdb" \
 
40
  from_table=geonames to_driver=pg to_database="host=localhost,dbname=testdb" \
 
41
  to_table=selection where="cat &lt; 500" 
 
42
</pre></div>
 
43
 
 
44
 
 
45
<h3>From DBF to SQLite</h3>
 
46
 
 
47
<div class="code"><pre>
 
48
db.copy from_driver=dbf from_database='$GISDBASE/$LOCATION_NAME/PERMANENT/dbf' \
 
49
   from_table=geonames_features to_driver=sqlite \
 
50
   to_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db' to_table=geonames_features
 
51
 
 
52
# convenient viewer:
 
53
sqlitebrowser $HOME/grassdata/nc_spm_08/user1/sqlite/sqlite.db
 
54
</pre></div>
 
55
 
 
56
 
 
57
<h3>From SQLite to DBF</h3>
 
58
 
 
59
<div class="code"><pre>
 
60
db.copy from_driver=sqlite from_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db' \
 
61
   from_table=ammprv to_driver=dbf to_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' \
 
62
   to_table=ammprv
 
63
</pre></div>
 
64
 
 
65
 
 
66
<h2>SEE ALSO</h2>
 
67
 
 
68
<em>
 
69
<a href="db.connect.html">db.connect</a>,
 
70
<a href="db.drivers.html">db.drivers</a>,
 
71
<a href="db.login.html">db.login</a>,
 
72
<a href="v.db.connect.html">v.db.connect</a>,
 
73
<a href="v.clean.html">v.clean</a>
 
74
</em>
 
75
<p>
 
76
<a href="sql.html">GRASS SQL interface</a>
 
77
 
 
78
<h2>AUTHOR</h2>
 
79
 
 
80
Radim Blazek, ITC-irst, Trento, Italy
 
81
 
 
82
<p><i>Last changed: $Date: 2014-11-28 10:58:18 +0100 (Fri, 28 Nov 2014) $</i>