[GRASS-user] Change database type

Hi,

I have many vectors with tables and now I want to change my database from sqlite to pgsql.
I ran db.connect. And now I need to copy all the tables from sqlite to pgsql.
Is there an easy way to do that?

Thanks.

Pablo Torres Carreira

Hi,

I have many vectors with tables and now I want to change my database from sqlite to pgsql.
I ran db.connect. And now I need to copy all the tables from sqlite to pgsql.
Is there an easy way to do that?

Once you’ve set the database connection params, then g.copy will create a new vector with the attributes pushed into the new database. So you could loop thru all vectors something like:
for v in g.mlist vect; do
g.rename vect=$v,$v_sqlite # rename to temporary name
g.copy vect=$v_sqlite,$v # copy back to original name, but pgsql tables will be created
done

If everything looks good, then you can remove all the vectors *_sqlite:
g.remove vect=g.mlist vect sep=, pat="*_sqlite"

···
-- 
Micha Silver
Arava Development Co. +972-52-3665918
[http://surfaces.co.il](http://surfaces.co.il)