Error upload file csv database

39 views
Skip to first unread message

Kimus

unread,
Oct 15, 2019, 9:40:24 AM10/15/19
to web...@googlegroups.com
Hello !!! 


I need help , I have four tables in DB, but I migrated for other domain so i stored the information in another DB, but it returned error, inconpatible foreing key. 
This ocorred because when uploaded the file "example auth_user" the column ID is modifyed to other number, that is diferent from the original table.

someone could me help me, please, I need this ID to be not modifyed,  there is some way ??  

thanks :)


PS : I do not speak english, so i'm so sorry :( 

Massimo Di Pierro

unread,
Oct 16, 2019, 2:43:47 AM10/16/19
to web2py-users
Do you have the original database. If you do you should export it from the web2py shell with db.export_to_csv_file and reimport it with db.import_from_csv_file. This is documented in the manual. The import will automatically fix your keys.

If you use postgres you can use pgdump and pgrestore.

If you do not have the original database then this may be hopeless.

Massimo




P.S. I do not speak english very well either but as long as we understand each other we are fine. :-)

Kimus

unread,
Oct 16, 2019, 7:21:15 AM10/16/19
to web2py-users
well, the importation  automatically dont fixed the keys, i don't understand why end the importantion manual dont work because my code not use the common functions or methods the web2py like SQLFORM or FORM, so the relation is forced like ex 
 propriedade = db(db.PropriedadeRural.id == request.vars.propriedade).select().first()
      
db.Despesas.insert (propriedade = propriedade.id)

there is any idea for help me ?
Reply all
Reply to author
Forward
0 new messages