[GRASS-user] Import sqlite table using db.in.ogr

Moritz Lennert mlennert at club.worldonline.be
Thu Aug 4 03:49:47 PDT 2016

On 03/08/16 23:04, Johannes Radinger wrote:
> Hi all,
> the database is the original sqlite database the ships with the the NC
> grass7 location (nc_spm_08_grass7). I want to import a single table (e.g
> 'streams') from that NC grass7 database (source, sqlite) into my new
> location (target) using db.in.ogr. As far as I understand, for the
> module db.in.ogr the database scheme of the target location should not
> be of relevance?! Interestingly, the database scheme (either sqlite, dbf
> etc) of the source db/table is not explicitly specified in db.in.ogr?!

Well, it is specified implicitely in the input= parameter, and ogr 
automagically identifies the file type on its own.

The issue is not really with file type. In your original message you had 
this error:

> db.in.ogr
> input=/media/grassgis_data/GRASS_locations/nc_spm_08_grass7/PERMANENT/sqlite/sqlite.db
> db_table=streams output=my_test
> ERROR: Unable to open data source <streams>
> ERROR: Input table <streams> not found or not readable

So, apparently there is no table streams in the sqlite.db you give in 
the input parameter. So I suggest to run

v.db.connect -p streams at PERMANENT to see which table this map is 
connected to.

You can also run

db.tables -p driver=sqlite 

to see which tables are in that database.


More information about the grass-user mailing list