1databaseintro(1)            GRASS GIS User's Manual           databaseintro(1)
2
3
4

Database management in GRASS GIS

6   Attribute management in general
7       GRASS  can be linked to one or many database management systems (DBMS).
8       The db.* set of commands provides basic SQL support for attribute  man‐
9       agement,  while  the  v.db.* set of commands operates on the vector map
10       (see Vector introduction).
11
12   Available drivers
13       Available drivers are listed in SQL support in GRASS GIS.
14
15       Notes:
16       The DBF driver provides only very limited SQL support (as DBF is not an
17       SQL  DB)  while  the  other  DBMS backends (such as SQLite, PostgreSQL,
18       MySQL etc) provide full SQL support since the  SQL  commands  are  sent
19       directly to the DBMS. For this reason, the SQLite driver is the default
20       DBMI backend.
21
22   DB connection management
23       The current database management settings are  shown  or  modified  with
24       db.connect  for  current mapset. Available DBMI drivers are listed with
25       db.drivers. Some DBMI backends require a user/password for driver/data‐
26       base to be set with db.login.  In order to test a driver, run db.test.
27
28   Attribute data import and export
29       Attribute  data can be imported with db.in.ogr from various formats and
30       exported with db.out.ogr. To internally copy a a full table  or  selec‐
31       tively parts of it, use db.copy.
32
33       Further conversion tools:
34
35           ·   MDB Tools: Convert MS-Access data to SQL, DBF, etc.
36
37           ·   Using OpenOffice.org with SQL Databases
38
39   SQL commands
40       GRASS  supports  two main SQL operations, execution of an SQL statement
41       (db.execute) and selection of data from a table (db.select).   See  the
42       SQL help page for examples.
43
44   Managing the default DBMI settings
45       Per  default  vector  map  attributes are stored in SQLite tables. This
46       default definition can be modified with db.connect. If an external DBMS
47       is used, db.login may be required.
48
49   Creating a database
50       Specific  commands  are explained on the individual driver pages (these
51       pages are only available if driver was compiled in this installation):
52
53           ·   DBF: see DBF page
54
55           ·   SQLite: SQLite page
56
57           ·   mySQL: mySQL and meSQL pages
58
59           ·   ODBC: ODBC page  (connect to Oracle, etc.)
60
61           ·   PostgreSQL: PostgreSQL and PostGIS page
62
63   Metadata
64       All columns for a given table are listed with db.columns.  The  command
65       db.describe  describes  a table in detail. To list all available tables
66       for a given database, run db.tables.
67
68   Table maintenance
69       To drop a column from a selected attribute  table,  use  db.dropcolumn.
70       With db.droptable an attribute table can be deleted.
71
72   Database Schema
73       Currently schema support only works for PostgreSQL connections. Default
74       schema can be set with db.connect. Note that the default schema will be
75       used by all db.* modules.
76
77       db.tables  returns ’schema.table’ if schemas are available in the data‐
78       base.
79
80   Migrating to a different database engine
81       To migrate a GRASS database table (or a GRASS vector map) to a  differ‐
82       ent  DBMI  engine,  the best solution is to create a new MAPSET, define
83       the DBMI settings accordingly with db.connect and if needed,  db.login.
84       Then  the  table  of  interest can be copied over with db.copy from the
85       original MAPSET. Likewise, a vector  map  including  its  table(s)  are
86       copied from the original MAPSET to the current MAPSET with g.copy.
87
88   See also
89           ·   Introduction into raster data processing
90
91           ·   Introduction into 3D raster data (voxel) processing
92
93           ·   Introduction into vector data processing
94
95           ·   Introduction into image processing
96
97           ·   Introduction into temporal data processing
98
99           ·   Projections and spatial transformations
100

SOURCE CODE

102       Available at: Database management in GRASS GIS source code (history)
103
104       Main index | Database index | Topics index | Keywords index | Graphical
105       index | Full index
106
107       © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
108
109
110
111GRASS 7.8.5                                                   databaseintro(1)
Impressum