[web2py] Re: Resetting the database

2018-01-29 Thread Alex Beskopilny
truncate with foreign-key depends on DB. for postgresql : def clear_tbls(): str1 = ','.join( [ t for t in db.tables() if "auth_" not in t] ) if len(str1): db.executesql( 'truncate {} RESTART IDENTITY'.format(str1) ) понедельник, 14 ноября 2011 г., 3:38:15 UTC+3

[web2py] Re: Resetting the database

2018-01-29 Thread Yoel Benitez Fonseca
I wan't to clean up my database trough an script with i want to use as a data generator for demo purposes it work's fine wth SQLite but with Mysql got a lot of error's: def limpiar_db(db, models): for m in models: l("Limpiando tabla: {}".format(m)) db[m].truncate()

[web2py] Re: Resetting the database

2017-04-21 Thread Massimo Di Pierro
In the case of sqlite it is easy enough to also delete the content of the databases/ folder. On Sunday, 16 April 2017 09:37:11 UTC-5, Matthew J Watts wrote: > > I had to log out of my webapp before deleting the database data, otherwise > i would get an error message > > cheers > > On Monday,

[web2py] Re: Resetting the database

2017-04-16 Thread 'Matthew J Watts' via web2py-users
I had to log out of my webapp before deleting the database data, otherwise i would get an error message cheers On Monday, November 14, 2011 at 1:38:15 AM UTC+1, Archibald Linx wrote: > > Dear Web2py users, > > How can I reset the database of my Web2py project ? > > Thanks, > Archibald --

[web2py] Re: Resetting the database

2011-11-14 Thread Archibald Linx
Thank you Bruno. I am using SQLite. I want to reset all the tables of my project. Thanks, Archibald On 14 nov, 01:44, Bruno Rocha rochacbr...@gmail.com wrote: which database engine? http://zerp.ly/rochacbruno Em 13/11/2011 22:38, Archibald Linx archibaldl...@gmail.com escreveu:

[web2py] Re: Resetting the database

2011-11-14 Thread DenesL
Hi Archibald, if you want to clear all records from a table do: db.table.truncate() To clear all just loop thru db.tables . db.commit() to finish. It should work for all DBs. On Nov 14, 7:56 am, Archibald Linx archibaldl...@gmail.com wrote: Thank you Bruno. I am using SQLite. I want

Re: [web2py] Re: Resetting the database

2011-11-14 Thread ~redShadow~
On Mon, 2011-11-14 at 06:02 -0800, DenesL wrote: Hi Archibald, if you want to clear all records from a table do: db.table.truncate() To clear all just loop thru db.tables . db.commit() to finish. It should work for all DBs. On Nov 14, 7:56 am, Archibald Linx

[web2py] Re: Resetting the database

2011-11-14 Thread apple
Web2py tries to redefine tables in line with changes in the model file but sometimes this is not possible with sqlite. Therefore you may want to delete the table definitions as well. If you do want a clean sheet of paper then do this: exclude=[] import os import glob import sys

Re: [web2py] Re: Resetting the database

2011-11-14 Thread Bruno Rocha
using sqlite. just go to /databases folder and delete everything there. web2py will create it all again. http://zerp.ly/rochacbruno Em 14/11/2011 10:56, Archibald Linx archibaldl...@gmail.com escreveu: Thank you Bruno. I am using SQLite. I want to reset all the tables of my project.

Re: [web2py] Re: Resetting the database

2011-11-14 Thread Vinicius Assef
SQLite? Just delete your database file. Web2py will recreate it next time you execute your app. If it doesn't help, try something like that in web2py shell: http://pastebin.com/w0q4yKkK -- Vinicius Assef. On Mon, Nov 14, 2011 at 10:56 AM, Archibald Linx archibaldl...@gmail.com wrote: Thank

[web2py] Re: Resetting the database

2011-11-14 Thread Archibald Linx
Thanks to everybody. Archibald On 14 nov, 21:33, Vinicius Assef vinicius...@gmail.com wrote: SQLite? Just delete yourdatabasefile. Web2py will recreate it next time you execute your app. If it doesn't help, try something like that in web2py shell:http://pastebin.com/w0q4yKkK --