Re: [web2py] Switching sqlite/postgres

2012-06-14 Thread Niphlod
don't know precisely how dal works, but if a table have a field referenced in a table defined after that, wouldn't that cause a problem ? i.e. db.define_table('route', Field('photo_id', 'reference pictures', readable=False, writable=False) ) db.define_table('pictures', Field('name')) does not

Re: [web2py] Switching sqlite/postgres

2012-06-14 Thread Paolo
Hi all, Actually I cannot move the pictures table declaration because both off them have references to each other (mutual reference?) In route the field photo_id references pictures and in pictures the field route_id references route. -- Paolo Il 14.06.2012 09:56 Niphlod ha scritto: don't

Re: [web2py] Switching sqlite/postgres

2012-06-14 Thread Niphlod
hehe poor web2py (and maybe db schema) You should let create the two tables without references and then set the references to each other. I think that during the first creation if a foreign key is requested but there is no foreign table the db (rightfully) will prevent you to create such

Re: [web2py] Switching sqlite/postgres

2012-06-14 Thread Paolo
Hi Niphlod, again thanks for your suggestion, it worked very well. I removed all the reference fields, I run once and then again with all the reference fields without the former errors. To me is a bit strange that the reference type field doesn't work with an empty db :( Regards, -- Paolo

Re: [web2py] Switching sqlite/postgres

2012-06-14 Thread Niphlod
Gabriella, or Paolo. Maybe it's because I was born speaking of jobs in the SQL department, but have you ever tried manually to create two tables and set a mutual relationship within those two without first creating the tables without references? When you create the route table, how can

Re: [web2py] Switching sqlite/postgres

2012-06-14 Thread Paolo
I am paolo! I've just discovered that on google groups it is written gabriella :-( I will try to fix it, maybe because I am not using a google mail? Anyway, you are right! thanks again for the feedbacks paolo:-) Il 14.06.2012 15:35 Niphlod ha scritto: Gabriella, or Paolo. Maybe it's

Re: [web2py] Switching sqlite/postgres

2012-06-14 Thread Niphlod
No problem at all. PS: sql.log shows what web2py tries to do when creating tables with the status of each command if you want to trace this kind of errors in the future, just start from an empty database and use a normal database client to replay sql.log, statement after statement.

Re: [web2py] Switching sqlite/postgres

2012-06-14 Thread pbreit
I thought the 'reference mytable' version (vs db.mytable) was supposed to get around this issue? Or is that only for self-referencing: http://web2py.com/books/default/chapter/29/6#Self-Reference-and-aliases

Re: [web2py] Switching sqlite/postgres

2012-06-14 Thread Cliff Kachinske
Paolo, You said, I cannot move the pictures table declaration because both off them have references to each other (mutual reference?) Why would the tables have mutual references? What kind of relation would cause that? Here are the kinds of relations I know about. One to many; put the

[web2py] Switching sqlite/postgres

2012-06-13 Thread Paolo
Hi all, I am getting several errors switching from sqlite to postgres my connection string for sqlite was: db = DAL('sqlite://storage.sqlite', migrate=True) while for postgres is: db = DAL('postgres://web2py:web2py@localhost:5432/mydb', migrate=True) so far, I got tickets saying

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread Johann Spies
On 13 June 2012 10:55, Paolo ilva...@inventati.org wrote: Hi all, I am getting several errors switching from sqlite to postgres Are you starting out on PostgreSQL with an empty database? my connection string for sqlite was: db = DAL('sqlite://storage.sqlite', migrate=True) while for

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread Paolo
Hi Johann, Yes, I started the db in postgres is totally empty. As y suggested I've removed all the files in databases/ but I am still getting the same error. What do you mean with drop all the app-related-tables ? currently I am saving the db with db.export_to_csv_file() Regards, paolo Il

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread Johann Spies
On 13 June 2012 14:06, Paolo ilva...@inventati.org wrote: Hi Johann, Yes, I started the db in postgres is totally empty. As y suggested I've removed all the files in databases/ but I am still getting the same error. What do you mean with drop all the app-related-tables ? in pgadmin3 or in

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread Paolo
Johann thanks, it worked! but now I got a new error :( Ticket: Traceback (most recent call last): File /home/paolo/Desktop/git/web2py/gluon/restricted.py, line 205, in restricted exec ccode in environment File /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py, line 252,

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread Niphlod
yes, you're using end as column namethis is not allowed in postgres and oracle, and also on mssql. Bites me every time, but actually a good practice would be to create the model within a connection made this way: db = DAL(uri, check_reserved_keyword=['all']) it will stop your model

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread pbreit
Need to see the code near this line which is causing the error: /home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py, line 252, in module format='%(name)s (%(id)s)' It might be missing a comma or parentheses. On Wednesday, June 13, 2012 7:08:51 AM UTC-7, Gabriella Canavesi

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread Paolo
Hi Niphlod, thanks you for the suggestion I solved even that error and I added check_reserved=['common','postgres', 'sqlite'] to avoid future problems. Unfortunately now I am getting an error saying: relation pictures does not exist which is the first field set as reference. the table

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread Massimo Di Pierro
Do you have a db.define_table('pictures',) ? On Wednesday, 13 June 2012 17:21:52 UTC-5, Gabriella Canavesi wrote: Hi Niphlod, thanks you for the suggestion I solved even that error and I added check_reserved=['common','postgres', 'sqlite'] to avoid future problems. Unfortunately

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread Paolo
Yes off course :-) It is just below the route table definition, here: db.define_table('pictures', Field(picture, upload, requires=(IS_NOT_EMPTY(), IS_IMAGE())), Field(normal, upload, IS_IMAGE()), Field(thumbnail, upload, IS_IMAGE()),

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread Massimo Di Pierro
Sorry. I asked a stupid question. Not sure what is wrong. I am looking into possibilities. On Wednesday, 13 June 2012 17:38:07 UTC-5, Gabriella Canavesi wrote: Yes off course :-) It is just below the route table definition, here: db.define_table('pictures',

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread Ovidio Marinho
In my long walks migrate sqlite to postgres, I detected that the import_csv has problems when there is this relationship and the table with no records, made ​​the importation into the hand he behaves well. but definitely we know and know that Massimo has import_csv problems sqlite - to -

Re: [web2py] Switching sqlite/postgres

2012-06-13 Thread Cliff Kachinske
Gabriella, Does the problem go away if you define the pictures table before the route table? On Wednesday, June 13, 2012 6:38:07 PM UTC-4, Gabriella Canavesi wrote: Yes off course :-) It is just below the route table definition, here: db.define_table('pictures',