<class 'sqlite3.OperationalError'> table auth_user already exists

309 views
Skip to first unread message

Andrea Fae'

unread,
Jan 18, 2017, 11:22:24 AM1/18/17
to web2py-users
Why if I delete xxxxxxxxxxxx.table files and log file inside database folder sqlite I have this error? sqlite is or not a only one file? Is it something regarding migrate=true or false? Can I have a better explanation than the book? Thank you

Richard Vézina

unread,
Jan 18, 2017, 12:21:06 PM1/18/17
to web2py-users
databases/*files are the "memory" of web2py to know which tables have been created in the backend and which have not... If you delete it, web2py think the related table is not defined in the backend and will try to create it, which will lead to the error message you have as the table is already created in your sqlite database...

To fix that you have to migrate=false and fake_migrate=True then set back migrate=True between these change you have to make a page reload (any page) of you app... It will force web2py to reanalyse and sync web2py with the backend. 

Note: In production, you should set migrate to false....

Richard

On Wed, Jan 18, 2017 at 11:22 AM, Andrea Fae' <and...@gmail.com> wrote:
Why if I delete xxxxxxxxxxxx.table files and log file inside database folder sqlite I have this error? sqlite is or not a only one file? Is it something regarding migrate=true or false? Can I have a better explanation than the book? Thank you

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrea Fae'

unread,
Jan 19, 2017, 9:07:38 AM1/19/17
to web2py-users
It's not working. I want to rename the name of the tables but in production I don't want this tables. thanks
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.

Andrea Fae'

unread,
Jan 19, 2017, 9:26:44 AM1/19/17
to web2py-users
morevoer I want to rename the name of auth tables files but this tables are totally standard...I have to modify db.py?

Dave S

unread,
Jan 19, 2017, 1:47:42 PM1/19/17
to web2py-users
On Thursday, January 19, 2017 at 6:26:44 AM UTC-8, Andrea Fae' wrote:
morevoer I want to rename the name of auth tables files but this tables are totally standard...I have to modify db.py?

Il giorno giovedì 19 gennaio 2017 15:07:38 UTC+1, Andrea Fae' ha scritto:
It's not working. I want to rename the name of the tables but in production I don't want this tables. thanks


What is the goal of what you're trying to do?   

Is this a case of starting with one schema of the database and finding that you need a different one?  If there's a radical change in the schema, but you have data you want to preserve, perhaps what you should do is export that data, make a backup just in case, and then delete everything from yourapp/databases.  This will result in a new sqlite file (I think you said you were using sqlite) as well as table files, and when you have database looking the way it needs to be, you can massage the exported data and import it into the new tables.

/dps
Reply all
Reply to author
Forward
0 new messages