so, cpdb.py runs on its own (no need to invoque with web2py.py).

this is the short version of its usage:

usage: cpdb.py [-h] -f SOURCEFOLDER -F TARGETFOLDER -y
                  SOURCECONNECTIONSTRING -Y TARGETCONNECTIONSTRING
                  [-a AUTOIMPORT] -d DAL [-t {True,False}] [-b TABLES]
                  [-c CLEAN]



you can something like:

$ python cpdb.py -f ./blueLite/db_storage -F ./blueLite/blueP4 -y
sqlite://storage.sqlite -Y sqlite://storage2.sqlite -d ./blueLite/
pyUtils/sql/blueSQL


-f points to the folder of the source DB
-F points t0 the folder of the target DB (which doen't exist yet)
-y the source connection string
-Y the target connection string
-d points to the folder where dal.py lives (like .../gluon

-a is set to True by default

warning:
-c will delete the source db & tables!
-t will truncate all tables

i use this within scripts pn a daily basis and all works for me.
Please try it this way and let me know if you still have issues (i
have not tested from sqLite to postgres, but if the connection string
is correct and everything to connect to postgres is on the system then
all should work well)

Mart :)

On Jul 23, 4:43 am, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> Mart wrote it.Let's wait for his opinion first. ;-)
>
> On Jul 23, 3:26 am, Kenneth Lundström <kenneth.t.lundst...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > I guess we have to wait for maybe Massimo to look into this.
>
> > Kenneth
>
> > Hi Kenneth, Yes both the connection strings work in db.py which I too
> > find very puzzling. On Jul 23, 12:24 pm, Kenneth Lundstr m
>
> > <kenneth.t.lundst...@gmail.com> wrote:
> > >> It sounds like web2py is not able to open either the sqlite file or
> > >> postgres database. Have you tried to use both connection strings in a
> > >> model file to test that both works?
>
> > >> Kenneth
>
> > >>> I am having a hard time migrating data from sqlite to postgres
> > >>> This is the command that I use
> > >>> ./web2py.py -S testapp -M -N -R scripts/cpdb.py -A -f
> > >>> sqlite://applications/testapp/databases/storage.sqlite -y 'sqlite://
> > >>> applications/testapp/databases/storage.sqlite'  -Y 'postgres://
> > >>> puser:ppass@localhost/testdb'
> > >>> It says
> > >>> web2py Web Framework
> > >>> Created by Massimo Di Pierro, Copyright 2007-2011
> > >>> Version 1.97.1 (2011-06-26 19:25:44)
> > >>> Database drivers available: SQLite3, pymysql, PostgreSQL
> > >>> EXCEPTION: could not make a copy of the database
> > >>> Failure to connect, tried 5 times:
> > >>> unable to open database file
> > >>> Any idea how to make this work?

Reply via email to