[GRASS-user] Change database type

Micha Silver micha at arava.co.il
Thu Oct 21 16:38:01 EDT 2010


On 10/21/2010 07:23 PM, Pablo Carreira wrote:
> 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"`

> Thanks.
>
> Pablo Torres Carreira
>
>
>
> This mail was received via Mail-SeCure System.
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
> This mail was received via Mail-SeCure System.
>
>
>    


-- 
Micha Silver
Arava Development Co. +972-52-3665918
http://surfaces.co.il


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20101021/cbe69149/attachment.html


More information about the grass-user mailing list