[GRASS-user] Best way to reconnect tables in grass' databse

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Wed Nov 26 15:33:11 EST 2008


On Wed, 2008-11-26 at 18:52 +0100, Nikos Alexandris wrote:
> Hi All!
> 
> I think I have questioned something similar but not quite the same
> several months ago.
> 
> I moved the "grassdb" foldes (with all of its locations of course) in
> another directory and thus, the absolute database path has been changed.
> 
> I need to re-connect all database tables. I think I am doing the right
> thing by trying to use the v.db.reconnect.all module. However, I am a
> bit confused about the appropriate format to be used for the
> "old_database", "new_database" parameters.
> 
> Isn't it the absolute paths that are required?
> 
> Is there a better way to ensure integrity of the grass database while
> moving it on another place(=directory)?
> 
> Thank you, Nikos

*** NOTE ***
Feel really tired today and I was writing The Text (below) before
Glynn's reply showed-up in my Inbox!
I hope you see it's comical side and don't get offended :-)
*** NOTE ***


OK,

I don't understand or the descriptions and the names of the modules
v.db.connect and v.db.reconnect.all are a bit "cryptic" :-p

* v.db.connect is to be used on one map. And gives with "-g" the
following information: layer[/layer name] table key database driver

* v.db.reconnect.all is to be used for all vector maps present on the
database (as the name of this modules implies).

Question: How should a beginner understand how to fill in the
"old_database", "new_database" parameters if the print out of
v.db.connect is for one map (including several variables) and
v.db.reconnect.all expects something (I suppose one variable or 2?) for
all maps?

I try different things but I only get errors.

An example:

# print current db.connect settings
db.connect -p

driver:sqlite
database:/geo/grassdb/peloponnese/hgrs87/PERMANENT/sqlite.db

# some table present in the database
db.tables -p | grep water

samples_water

# connection settings of this table (as it was set before moving grassdb
in another directory
v.db.connect -g samples_water

1 samples_water
cat /home/nik/grassdb/peloponnese/hgrs87/PERMANENT/sqlite.db sqlite

# of course the old database contains several tables/vector maps
# How would I go about to v.db.reconnect.all at once?

# Trying to figure-out how this module works
# reading the description
v.db.reconnect.all help

[...]
Usage:
 v.db.reconnect.all old_database=string new_database=string
   [old_schema=string] [new_schema=string] [--verbose] [--quiet]
[...]
old_database   Name of old database. The database must be in form
printed by v.db.connect -g, i.e. with substituted variables
[...]

# shrug!
# hmmm, ok... so I need to look the "v.db.connect -g" result... !?
# wait a second, the v.db.connect -g result gives for one map several
stuff
# ok... I am a beginner on this. But some programer wrote it, he tested
it, others use it. It should work. Yes, it works! I've read it in one
message in the mailing list. There was no example though. It doesn't
matter. So, Niko, think logical :-)
# What on earth should I fill in in the old_database parameter. But it's
clearly stated: "The database must be in form printed by v.db.connect
-g, i.e. with substituted variables"

# ok, lets try
# I will use the output of "v.db.connect -g" from some map. I'll take my
"water_samples"
# OK, I think I'll pick all variables that refer clearly to the database
itself.

# ??? -- What am I talking now... ?
# Ahh, go ahead and try it.
...
...

# STOP-STOP-STOP here. STOP right here - right now.
# I just read Glynn's mail :-) Let's read first carefuly his reply.
# Oh... I really like this community.
# I have to admit that beginners/intermediate end-users (including me)
ask sometimes things for which they could easily get an answer if they
tried a bit more :-)

(*possibly* to be continued ;-)

Cheers, Nikos



More information about the grass-user mailing list