I have been trying to move from sqlite to postgres without any success.
At the end of my experimenting unfortunately i have just modified my code 
and fill my tables  manually:(((( I guess I did some thing no entirely 
correctly but it is very little I could find in the web and in the docs 
about the case. Honestly It was the first time I feel very bad about w2p as 
such a simple task turned to the headache.

*My case: I had 2 models: db.py and db1.py.*
*I had all my tables **in db1.py**. I used w2p job scheduler with 
associated tables. Kept all data in sqlite and wanted to move from sqlite 
to postgres.*

*Task1: copy all data from db1(sqlite) to db2(postgres):*
*Every time I tried to run cpdb.py command I got error:*

c:\Users\power\PycharmProjects\test_test\web2py>python scripts/cpdb.py  -d 
gluon
-f applications/idna/databases -y sqlite://dbs.sqlite -Y 
postgres://postgres:hohoho@localhost/sex
creating tables...
EXCEPTION: could not make a copy of the database
relation "scheduler_task" does not exist

*I had applyed people suggestiones to 1.stop w2p, create new pg db, empty 
all .table files from myapp/database.* After runing web2py and accessing my 
app in browser, I've got following error:
<class 'sqlite3.OperationalError'> table scheduler_task already exists
I was lucky as when I copied back all .table in databases folder - my app 
run again.



*Task2: generate empty tables from db1(sqlite) to db2 (postgres):*
When I used db.py and db1.py together, start of web2py did not bring all 
tables from sqlite to postgres - only standart but not those that were in 
db1.py. I wonder why?
When I moved all tables description from db1.py to db.py - w2p finally 
generated all necessary *empty* tables as it spoused to do from the 
beggining.

*My suggestions for docs:*
I would suggest to add more documentation about exect steps on how to move 
from db1 to db2 in w2p ebook. Also add info to section on cpdb.py with 
additional steps if things does not work. The db move experience really 
kills a lot of love to w2p in one go. At least docs  should say that it 
might be a problem so user better select db source first properly -don't 
just go with sqlite as a tmp db source.

On Monday, January 27, 2014 1:24:22 PM UTC+3, Alan Etkin wrote:
>
>
> I have check sql.tmp - it contains only 'END'. After adding the print line 
>> I have got following message, with no tables([]):
>>
>
> Have you run the app connecting to sqlite once? You must do it so web2py 
> automatically creates the table files. cpdb reads those files from the 
> database folder to build the table definitions. There is no data to copy 
> since the script does not find the tables (it should log a message about 
> it).
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to