[GRASS-dev] db.copy gives error

Dear devs,

I have a grassgis database with in the mapset 'Permanent' a table
'vegetation_lookup'. I want top copy this table to the current mapset.
The following used to work I think, but now gives me some errors:

db.copy from_driver=sqlite
from_database=/media/grassdb/biodiv/PERMANENT/sqlite/sqlite.db
from_table=vegetation_lookup to_driver=sqlite
to_database=$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
to_table=vegetation_lookup

ERROR: Unable to create directory '///sqlite' for sqlite database
dbmi: Protocol error
WARNING: Unable to open database <///sqlite/sqlite.db> by driver <sqlite>

Any idea what I am doing wrong here?

With kind regards,

Paulo

On Sat, Mar 14, 2020 at 3:27 PM Paulo van Breugel <p.vanbreugel@gmail.com> wrote:

Dear devs,

I have a grassgis database with in the mapset ‘Permanent’ a table
‘vegetation_lookup’. I want top copy this table to the current mapset.
The following used to work I think, but now gives me some errors:

db.copy from_driver=sqlite
from_database=/media/grassdb/biodiv/PERMANENT/sqlite/sqlite.db
from_table=vegetation_lookup to_driver=sqlite
to_database=$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db

to_table=vegetation_lookup

Looking at the code of db.copy, it is not possible that this ever worked, you need to replace the variables with their actual values.

Markus M

ERROR: Unable to create directory ‘///sqlite’ for sqlite database
dbmi: Protocol error
WARNING: Unable to open database <///sqlite/sqlite.db> by driver

Any idea what I am doing wrong here?

With kind regards,

Paulo


grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

On Sat, Mar 14, 2020 at 11:39 PM Markus Metz
<markus.metz.giswork@gmail.com> wrote:

On Sat, Mar 14, 2020 at 3:27 PM Paulo van Breugel <p.vanbreugel@gmail.com> wrote:
>
> Dear devs,
>
> I have a grassgis database with in the mapset 'Permanent' a table
> 'vegetation_lookup'. I want top copy this table to the current mapset.
> The following used to work I think, but now gives me some errors:
>
> db.copy from_driver=sqlite
> from_database=/media/grassdb/biodiv/PERMANENT/sqlite/sqlite.db
> from_table=vegetation_lookup to_driver=sqlite
> to_database=$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
> to_table=vegetation_lookup

Looking at the code of db.copy, it is not possible that this ever worked, you need to replace the variables with their actual values.

Yes, I did work with the actual values, which gave me the error below.
Then I tried the above, but that as you rightly noted, shouldn't, and
didn't work either. In the meantime I recreated the database and did a
fresh install of grass, and now my script works again. I am not sure
which of the two made it work again (should have done this more
systematically), but in any case, thanks for the feedback Markus.

Markus M
>
> ERROR: Unable to create directory '///sqlite' for sqlite database
> dbmi: Protocol error
> WARNING: Unable to open database <///sqlite/sqlite.db> by driver <sqlite>
>
> Any idea what I am doing wrong here?
>
> With kind regards,
>
> Paulo
> _______________________________________________
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev

Am 14. März 2020 23:38:58 MEZ schrieb Markus Metz <markus.metz.giswork@gmail.com>:

On Sat, Mar 14, 2020 at 3:27 PM Paulo van Breugel
<p.vanbreugel@gmail.com>
wrote:

Dear devs,

I have a grassgis database with in the mapset 'Permanent' a table
'vegetation_lookup'. I want top copy this table to the current

mapset.

The following used to work I think, but now gives me some errors:

db.copy from_driver=sqlite
from_database=/media/grassdb/biodiv/PERMANENT/sqlite/sqlite.db
from_table=vegetation_lookup to_driver=sqlite
to_database=$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
to_table=vegetation_lookup

Looking at the code of db.copy, it is not possible that this ever
worked,
you need to replace the variables with their actual values.

Well, it should work if you run

eval $(g.gisenv -s) before, no ?

Moritz

On Sat, 14 Mar 2020 at 15:27, Paulo van Breugel <p.vanbreugel@gmail.com> wrote:

Dear devs,

Dear Paulo,

I have a grassgis database with in the mapset 'Permanent' a table
'vegetation_lookup'. I want top copy this table to the current mapset.
The following used to work I think, but now gives me some errors:

db.copy from_driver=sqlite
from_database=/media/grassdb/biodiv/PERMANENT/sqlite/sqlite.db
from_table=vegetation_lookup to_driver=sqlite
to_database=$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
to_table=vegetation_lookup

ERROR: Unable to create directory '///sqlite' for sqlite database
dbmi: Protocol error
WARNING: Unable to open database <///sqlite/sqlite.db> by driver <sqlite>

Any idea what I am doing wrong here?

try to protect the to_database string value like
'$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db' otherwise the
variable are replaced with empty value

With kind regards,

Paulo

--
ciao
Luca

www.lucadelu.org

On Tue, Mar 24, 2020 at 10:24 AM Luca Delucchi <lucadeluge@gmail.com> wrote:

On Sat, 14 Mar 2020 at 15:27, Paulo van Breugel <p.vanbreugel@gmail.com> wrote:
>
> Dear devs,
>

Dear Paulo,

> I have a grassgis database with in the mapset 'Permanent' a table
> 'vegetation_lookup'. I want top copy this table to the current mapset.
> The following used to work I think, but now gives me some errors:
>
> db.copy from_driver=sqlite
> from_database=/media/grassdb/biodiv/PERMANENT/sqlite/sqlite.db
> from_table=vegetation_lookup to_driver=sqlite
> to_database=$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
> to_table=vegetation_lookup
>
> ERROR: Unable to create directory '///sqlite' for sqlite database
> dbmi: Protocol error
> WARNING: Unable to open database <///sqlite/sqlite.db> by driver <sqlite>
>
> Any idea what I am doing wrong here?
>

try to protect the to_database string value like
'$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db' otherwise the
variable are replaced with empty value

OK, will try that, thanks.

> With kind regards,
>
> Paulo
>

--
ciao
Luca

www.lucadelu.org