Re: [web2py] Best way to pre-populate a database on start-up

2016-09-01 Thread Richard Vézina
private/* would be a good place to store it. Richard On Wed, Aug 31, 2016 at 3:15 PM, Niphlod wrote: > same deal, "different" organization. > With an external script you can't call that function if not from an > external process. > Having it in a separated controller incurs in None performance-

Re: [web2py] Best way to pre-populate a database on start-up

2016-08-31 Thread Niphlod
same deal, "different" organization. With an external script you can't call that function if not from an external process. Having it in a separated controller incurs in None performance-penalties (having it in a standard controller has None to a handful of ms penalty when that controller is hi

Re: [web2py] Best way to pre-populate a database on start-up

2016-08-31 Thread Dave S
On Wednesday, August 31, 2016 at 5:33:15 AM UTC-7, Manuele wrote: > > Il 30/08/16 21:40, Niphlod ha scritto: > > +1 for Dave . > > > > with isempty() in a model you're executing a query for each and every > > request for absolutely NO REASON. > > I usually create a script directory and put t

Re: [web2py] Best way to pre-populate a database on start-up

2016-08-31 Thread Manuele Pesenti
Il 30/08/16 21:40, Niphlod ha scritto: > +1 for Dave . > > with isempty() in a model you're executing a query for each and every > request for absolutely NO REASON. I usually create a script directory and put there scripts with commands to be performed only once, such in the case of pre-populating

Re: [web2py] Best way to pre-populate a database on start-up

2016-08-30 Thread Dave S
On Tuesday, August 30, 2016 at 2:48:01 PM UTC-7, Niphlod wrote: > > fabfile ATM is a show-off, and we can't put in there code related to an > app which doesn't exist :P > It should be possible to put a comment block in the fabfile that shows what might be done, but it would still require knowi

Re: [web2py] Best way to pre-populate a database on start-up

2016-08-30 Thread Niphlod
fabfile ATM is a show-off, and we can't put in there code related to an app which doesn't exist :P We can't pin each and every thread a "useful" information is written, as I really don't see how 40 pinned threads will contribute to web2py's knowledge for - and especially - newbies. IMHO at mos

Re: [web2py] Best way to pre-populate a database on start-up

2016-08-30 Thread Richard Vézina
To be added to the fabfile.py of web2py maybe?! On Tue, Aug 30, 2016 at 3:53 PM, Richard Vézina wrote: > Don't have privileges, but this is a good thread and should be marked as > informative somehow... > > Richard > > On Tue, Aug 30, 2016 at 2:24 PM, Dave S wrote: > >> >> >> On Tuesday, August

Re: [web2py] Best way to pre-populate a database on start-up

2016-08-30 Thread Richard Vézina
Don't have privileges, but this is a good thread and should be marked as informative somehow... Richard On Tue, Aug 30, 2016 at 2:24 PM, Dave S wrote: > > > On Tuesday, August 30, 2016 at 6:58:43 AM UTC-7, Richard wrote: >> >> Seems alright do you have issue with this? I would put a blank line

Re: [web2py] Best way to pre-populate a database on start-up

2016-08-30 Thread Niphlod
+1 for Dave . with isempty() in a model you're executing a query for each and every request for absolutely NO REASON. This are activities that needs to be carried on on a post-deployment fire-only-when-needed scenario, and outside the web environment. On Tuesday, August 30, 2016 at 8:24:53 PM

Re: [web2py] Best way to pre-populate a database on start-up

2016-08-30 Thread Dave S
On Tuesday, August 30, 2016 at 6:58:43 AM UTC-7, Richard wrote: > > Seems alright do you have issue with this? I would put a blank line > between model definition and the "if isempty()". > > I production, once the system get initialize you should remove those > populating fixture to save execut

Re: [web2py] Best way to pre-populate a database on start-up

2016-08-30 Thread Richard Vézina
Seems alright do you have issue with this? I would put a blank line between model definition and the "if isempty()". I production, once the system get initialize you should remove those populating fixture to save execution time as the get execute at each request. What could wizely do is put all t

Re: [web2py] Best way to pre-populate a database on start-up

2016-08-30 Thread Yoel Benitez Fonseca
You can use a .CSV file. What i have used to do is: 1.- Define the tables that are being pre-populate. 2.- Insert all the data with appadmin. 3.- Using the appadmin export the data to a .CSV (db_colors.csv) file and put it in the private folder of your app. 4.- Do the same thing you are doing exce

[web2py] Best way to pre-populate a database on start-up

2016-08-30 Thread Ben Lawrence
At the moment to pre-populate a database, I place this in the db.py model file: db.define_table('color', Field('name','string'), Field('code','string'), format='%(name)s') if db(db.color).isempty(): # create instance of table for k,v in dict(lime="#00FF00",red="#FF",black