123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <!-- meta page description: Database management in GRASS GIS -->
- <!-- meta page index: database -->
- <h3>Attribute management in general</h3>
- GRASS can be linked to one or many database management systems (DBMS).
- The <em>db.*</em> set of commands provides basic SQL support for
- attribute management, while the <em>v.db.*</em> set of commands operates
- on the vector map (see <a href="vectorintro.html">Vector introduction</a>).
- <h3>Available drivers</h3>
- Available drivers are listed in <a href="sql.html">SQL support in GRASS GIS</a>.
- <p>
- <b>Notes</b>:<br>
- The DBF driver provides only very limited SQL
- support (as DBF is not an SQL DB) while the other DBMS backends (such
- as SQLite, PostgreSQL, MySQL etc) provide full SQL support since the SQL
- commands are sent directly to the DBMS. For this reason, the SQLite driver
- is the default DBMI backend.
- <h3>DB connection management</h3>
- The current database management settings are shown or modified with
- <a href="db.connect.html">db.connect</a> for current mapset. Available DBMI drivers
- are listed with <a href="db.drivers.html">db.drivers</a>. Some DBMI backends
- require a user/password for driver/database to be set with <a href="db.login.html">db.login</a>.
- In order to test a driver, run <a href="db.test.html">db.test</a>.
- <h3>Attribute data import and export</h3>
- Attribute data can be imported with <a href="db.in.ogr.html">db.in.ogr</a> from
- various formats and exported with <a href="db.out.ogr.html">db.out.ogr</a>. To internally
- copy a a full table or selectively parts of it, use <a href="db.copy.html">db.copy</a>.
- <p>
- Further conversion tools:
- <ul>
- <li><a href="http://sourceforge.net/projects/mdbtools">MDB Tools</a>: Convert MS-Access data to SQL, DBF, etc.</li>
- <li><a href="https://grasswiki.osgeo.org/wiki/Openoffice.org_with_SQL_Databases">Using OpenOffice.org with SQL Databases</a>
- </ul>
- <h3>SQL commands</h3>
- GRASS supports two main SQL operations, execution of an SQL statement
- (<a href="db.execute.html">db.execute</a>) and selection
- of data from a table (<a href="db.select.html">db.select</a>).
- See the <a href="sql.html">SQL help page</a> for examples.
- <h3>Managing the default DBMI settings</h3>
-
- Per default vector map attributes are stored in SQLite tables. This default
- definition can be modified with <a href="db.connect.html">db.connect</a>. If an
- external DBMS is used, <a href="db.login.html">db.login</a> may be required.
- <h3>Creating a database</h3>
- Specific commands are explained on the individual driver pages (these
- pages are only available if driver was compiled in this installation):
- <ul>
- <li>DBF: see <a href="grass-dbf.html">DBF</a> page</li>
- <li>SQLite: <a href="grass-sqlite.html">SQLite</a> page</li>
- <li>mySQL: <a href="grass-mysql.html">mySQL</a> and <a href="grass-mesql.html">meSQL</a> pages</li>
- <li>ODBC: <a href="grass-odbc.html">ODBC</a> page (connect to Oracle, etc.)</li>
- <li>PostgreSQL: <a href="grass-pg.html">PostgreSQL</a> and PostGIS page</li>
- </ul>
- <h3>Metadata</h3>
- All columns for a given table are listed with <a href="db.columns.html">db.columns</a>.
- The command <a href="db.describe.html">db.describe</a> describes a table in detail. To
- list all available tables for a given database, run <a href="db.tables.html">db.tables</a>.
- <h3>Table maintenance</h3>
- To drop a column from a selected attribute table, use <a href="db.dropcolumn.html">db.dropcolumn</a>.
- With <a href="db.droptable.html">db.droptable</a> an attribute table can be deleted.
- <h3>Database Schema</h3>
- Currently schema support only works for PostgreSQL connections. Default schema
- can be set with <a href="db.connect.html">db.connect</a>. Note that the default
- schema will be used by all db.* modules.
- <p>
- <a href="db.tables.html">db.tables</a> returns 'schema.table' if schemas are
- available in the database.
- <h3>Migrating to a different database engine</h3>
- To migrate a GRASS database table (or a GRASS vector map) to a different DBMI engine,
- the best solution is to create a new MAPSET, define the DBMI settings accordingly
- with <a href="db.connect.html">db.connect</a> and if needed, <a href="db.login.html">db.login</a>.
- Then the table of interest can be copied over with <a href="db.copy.html">db.copy</a> from
- the original MAPSET. Likewise, a vector map including its table(s) are copied from
- the original MAPSET to the current MAPSET with <a href="g.copy.html">g.copy</a>.
- <h3>See also</h3>
- <ul>
- <li><a href="rasterintro.html">Introduction into raster data processing</a></li>
- <li><a href="raster3dintro.html">Introduction into 3D raster data (voxel) processing</a></li>
- <li><a href="vectorintro.html">Introduction into vector data processing</a></li>
- <li><a href="imageryintro.html">Introduction into image processing</a></li>
- <li><a href="temporalintro.html">Introduction into temporal data processing</a></li>
- <li><a href="projectionintro.html">Projections and spatial transformations</a></li>
- </ul>
|