[web2py] Thank you Web2py community - I have completed a live application, ViewBase.com, using Web2py

2019-04-05 Thread junderhill
This looks fantastic.  A great example of a fantastic real-world app developed 
with Web2py.  Great job!

John

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


Re: [web2py] web3py again....

2019-03-28 Thread junderhill
For authentication, Okta, Azure AD B2C, etc. are options that offload a lot 
of trouble, but I like having a fully-functional Auth built-in and we do 
use it in some projects.  It needs full OIDC support.  YMMV.  We build 
scalable back ends with Web2py using Postgres and Nginx.

John

On Thursday, March 28, 2019 at 12:16:58 PM UTC-7, Marcelo Huerta wrote:
>
> El jueves, 28 de marzo de 2019, 6:57:08 (UTC-3), José L. escribió:
>>
>>
>>- sqlform and grid are one of the key points for web2py. It's one of 
>>the main reasons to use it instead of other frameworks as development is 
>>really quick. However I think nowadays a backport from web2py is not a 
>> good 
>>idea. We should provide something optional based only on vue.js. As you 
>>say, we can do it better.
>>
>>
> SQLFORM and grid were the main selling points to me. Something similar 
> should be provided, surely.
>  
>
>>
>>- auth is not as important in my experience. It has never been the 
>>reason to pick web2py and there are other ways to do it.
>>
>> I love auth, actually. Maybe I haven't investigated enough, but what 
> other ways to do it are preferable in your opinion?
>

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


[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-24 Thread junderhill
João,

No, SQLite transactions are not only ACID, the Isolation is Serializable, 
which means even if the execute concurrently, the result should be same as 
if they executed in series (on after the other).  What @Anthony describes 
should not be necessary, since you already in a transaction.

https://www.sqlite.org/transactional.html
https://www.sqlite.org/atomiccommit.html

If everything is set up correctly, it should work.  Please note that both 
sessions must be in a transaction to guarantee a consistent result.  You 
can't just go change the database while the transaction is pending.  That 
can fail.  This is the purpose of transactions.

Also please note that this is probably note the best way to do this.  SQL 
has auto-increment fields that are good for assigning numbers to things, 
such as unique IDs to records.  Web2py automatically creates an 
auto-increment ID field for all your tables.  So if you have a table for 
Items, let's say, the ID field in that table will already be a unique 
number for every new record, which you could use for your serial number.  
Just insert a new record to get a new ID.  If you don't want to use the 
built-in ID, you can create your own auto-increment field.

If you have a table for Work Orders, it will already have an ID field 
that's automatically set to a new unique number for each record.  Just 
insert a new record to get a new number.  If you don't want to use the ID 
field as your work order number, you can create your own field.  No need to 
read, update, and store counters.

John



On Thursday, March 21, 2019 at 3:18:20 PM UTC-7, João Matos wrote:
>
> @Leonel
> Maybe I'm not explaining myself correctly.
>
> I tested and it isn't working the way I need and explained.
>
> My test was:
> I put a sleep(10) between step 1 and 2.
> On another session I changed the record in question. Checked the changed 
> was done.
> Waited for the sleep to end and then step 2 wrote over the change I made 
> on the other session.
> The end result is that the transaction isn't protecting (locking) the 
> records in question, which is what I need.
>
>
> quinta-feira, 21 de Março de 2019 às 13:11:27 UTC, Leonel Câmara escreveu:
>>
>> The transaction is atomic, that means there's nothing happening in the 
>> middle. Your use case is fine. Of course, that if you give the user a form, 
>> while he's editing it, the form can be changed by others as well, in that 
>> case you need to add your own locking or check the record for modifications 
>> while the user was editing the form.
>>
>

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


[web2py] Re: SQLFORM.smartgrid seems to ignore formargs(separator=':'), whereas SQLFORM.grid obeys it

2019-03-03 Thread junderhill
Thanks, Massimo.  Will this work for multiple tables?  When I write:

formargs={'Wordlist': dict(separator=': '), 'Wordlist2word': dict(separator=': 
')}

this works for the first table, but when I navigate into the second table 
via a linked field, the arguments don't seem to be picked up.  I ask 
because I'd like to set other, table-specific options if possible.


On Sunday, March 3, 2019 at 2:25:43 PM UTC-8, Massimo Di Pierro wrote:
>
> It is not a bug.
>
> The problem is that in smartgrid you have to specify which table the 
> formargs apply to. For example:
> form = SQLFORM.smartgrid(dvdb.Wordlist, args=request.args[:1], paginate=
> 100, formargs={'Wordlist': dict(separator=': ')}, breadcrumbs_class=
> 'breadcrumbs')
>
> I am making a change that will allow:
>
>
> form = SQLFORM.smartgrid(dvdb.Wordlist, args=request.args[:1], paginate=
> 100, formargs={'*': dict(separator=': ')}, breadcrumbs_class='breadcrumbs'
> )
>
> so the formargs apply to all tables. Will be in 2.18.3
>
>
> On Friday, 1 March 2019 23:40:08 UTC-8, junde...@launchpnt.com 
>  wrote:
>>
>> dvdb = setupdb(gethostconfig(servername), getappconfig("devicecontrol"))
>> dvdb.Wordlist.longdescription.widget = SQLFORM.widgets.text.widget
>> form = SQLFORM.smartgrid(dvdb.Wordlist, args=request.args[:1], paginate=
>> 100, formargs=dict(separator=': '), breadcrumbs_class='breadcrumbs')
>>
>> Works, but separator is nowhere in sight.  This, on the other hand,
>>
>> dvdb = setupdb(gethostconfig(servername), getappconfig("devicecontrol"))
>> form = SQLFORM.grid(dvdb[tablename], args=request.args[:2], paginate=100, 
>> formargs=dict(separator=': '))
>>
>> also works, and shows the separator.  We are on:
>>
>> 2.16.1-stable+timestamp.2017.11.14.05.54.25
>> (Running on nginx/1.10.3, Python 2.7.12)
>>
>> John
>>
>

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


[web2py] SQLFORM.smartgrid seems to ignore formargs(separator=':'), whereas SQLFORM.grid obeys it

2019-03-01 Thread junderhill
dvdb = setupdb(gethostconfig(servername), getappconfig("devicecontrol"))
dvdb.Wordlist.longdescription.widget = SQLFORM.widgets.text.widget
form = SQLFORM.smartgrid(dvdb.Wordlist, args=request.args[:1], paginate=100, 
formargs=dict(separator=': '), breadcrumbs_class='breadcrumbs')

Works, but separator is nowhere in sight.  This, on the other hand,

dvdb = setupdb(gethostconfig(servername), getappconfig("devicecontrol"))
form = SQLFORM.grid(dvdb[tablename], args=request.args[:2], paginate=100, 
formargs=dict(separator=': '))

also works, and shows the separator.  We are on:

2.16.1-stable+timestamp.2017.11.14.05.54.25
(Running on nginx/1.10.3, Python 2.7.12)

John

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


[web2py] Re: Migrating Postgres to MySql

2016-09-17 Thread junderhill
Joe, I'd be curious to know how you feel MySql performs in comparison to 
Postgres.

On Friday, September 16, 2016 at 2:28:09 PM UTC-7, Joe Barnhart wrote:
>
> I've been using PostgresSQL for my production site for quite awhile.  My 
> future improved site, however, will feature MySql for its database engine. 
>  (Not a diss on Postgres, it's just a lot easier to find hosting companies 
> who will rent me a supported-and-maintained MySql instance.)  I have 
> thousands of user logins and lots 'o history I want, yea even NEED, to 
> preserve.  I've been reading up on strategies for converting from one 
> database to another.
>
> For example, I can dump the Postgres database in its entirety into CSV 
> using the DAL, then read the data back into MySql.  That has some 
> attractiveness but I couldn't help noticing how s--l-o-w this process is. 
>  I let the dump run for about an hour and it wasn't done yet.  Then there's 
> the little problem of the developer.  He just can't leave things alone. 
>  The MySql database design is "much better" (read: different) than the 
> Postgres design.  (It makes no difference that I am actually the developer 
> of both.)  So I can't just export CSV and import it.  Not without editing 
> the CSV on the way.
>
> What if, instead, I create the MySql tables with an extra column to hold 
> the "old" id from the Postgres database?  I could then develop a 
> "transition" class that would open connections to both databases, read 
> records from the Postgres one, and insert them (with whatever mods are 
> required) into the MySql database.  When I process records from Postgres 
> which have dependencies on the "id" field from another table, I use the 
> "old_id" field to map it to the new id value.
>
> This process could take as long as it wants, and run concurrently with the 
> old system.  I could shut it down and restart it as needed if I kept a 
> "fence" of the highest id processed from the old database.  I would need to 
> do the tables in order of no dependencies to fullest dependencies, to make 
> sure the required dependent records are already in place when the table is 
> processed.
>
> After all is said and done, I could simply delete the "old_id" columns 
> from the affected MySql tables.  If I even care at that point.
>
> Am I missing something?  Or does this seem viable for a system with a 
> large database to migrate?
>
> -- Joe
>
>

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


[web2py] db.executesql() is taking 10 times longer than it should to run a query in Web2py

2016-08-16 Thread junderhill
 

Greetings.  db.executesql() is taking 10 times longer than it should to run 
a query in Web2py, and I can’t figure out why.  This is causing a huge 
bottleneck in my application.


In the example below, the Web2py times are all over the map, ranging from 
10ms to 500ms, whereas the query runs consistenty in about 30ms in pgAdmin 
III on the same server.


Yes, there’s 27 million rows in the table Word2Word, but so what?  There’s 
an index on every column, and as I said, the query runs consistently in 
pgAdmin III.  See also the query plan below.


Four Core 2 CPUs, 16 GB RAM, nobody on this server but me.


I need help.  I’m completely stumped.  If this requires a paid expert we 
can probably accommodate that if we can get an answer.


Love Web2py.   Thanks,


John D. Underhill

Senior Web Developer

Vocabulary Systems, Inc.

-

Web2py 2.14.3-stable+timestamp.2016.03.26.23.02.02

Running on Apache/2.4.7 (Ubuntu), Python 2.7.6

Postgres 9.3.13

-

. . . 
rows = db(db.Word.normalform == aword.normalform).select(db.Word.id)
. . .
sql = "SELECT Word.normalform, Word.frequency, Word2Word.relscore "
sql = sql + "FROM Word2Word INNER JOIN Word ON (Word2Word.word2 = Word.id) "
sql = sql + "WHERE ((Word2Word.word1 = " + str(rows[0].id) + ") AND "
sql = sql + "(Word.frequency >= " + str(freqlower) + ") AND (Word.frequency 
<= " + str(frequpper) + ")) "
sql = sql + "ORDER BY Word2Word.relscore DESC LIMIT " + str(howmany * 3) + 
";"
rows = db.executesql(sql, as_dict=True, colnames=['Word.normalform', 
'Word.frequency', 'Word2Word.relscore'])
. . .
for x in db._timings:
logger.debug(str(x))


-

2016-08-09 01:25:13,072  -  DEBUG  -  (u"SELECT  Word.id FROM Word WHERE 
(Word.normalform = 'american');", 0.002079010009765625)

2016-08-09 01:25:13,072  -  DEBUG  -  (u'SELECT Word.normalform, 
Word.frequency, Word2Word.relscore FROM Word2Word INNER JOIN Word ON 
(Word2Word.word2 = Word.id) WHERE ((Word2Word.word1 = 132) AND 
(Word.frequency >= 45) AND (Word.frequency <= 65)) ORDER BY 
Word2Word.relscore DESC LIMIT 15;', 0.23161005973815918)

2016-08-09 01:25:13,073  -  DEBUG  -  (u"SELECT  Word.id FROM Word WHERE 
(Word.normalform = 'prospect');", 0.002025842259766)

2016-08-09 01:25:13,073  -  DEBUG  -  (u'SELECT Word.normalform, 
Word.frequency, Word2Word.relscore FROM Word2Word INNER JOIN Word ON 
(Word2Word.word2 = Word.id) WHERE ((Word2Word.word1 = 2201) AND 
(Word.frequency >= 45) AND (Word.frequency <= 65)) ORDER BY 
Word2Word.relscore DESC LIMIT 15;', 0.5044560432434082)

2016-08-09 01:25:13,074  -  DEBUG  -  (u"SELECT  Word.id FROM Word WHERE 
(Word.normalform = 'learn');", 0.0010268688201904297)

2016-08-09 01:25:13,074  -  DEBUG  -  (u'SELECT Word.normalform, 
Word.frequency, Word2Word.relscore FROM Word2Word INNER JOIN Word ON 
(Word2Word.word2 = Word.id) WHERE ((Word2Word.word1 = 312) AND 
(Word.frequency >= 45) AND (Word.frequency <= 65)) ORDER BY 
Word2Word.relscore DESC LIMIT 15;', 0.009122133255004883)

2016-08-09 01:25:13,075  -  DEBUG  -  (u"SELECT  Word.id FROM Word WHERE 
(Word.normalform = 'edge');", 0.0021839141845703125)

2016-08-09 01:25:13,075  -  DEBUG  -  (u'SELECT Word.normalform, 
Word.frequency, Word2Word.relscore FROM Word2Word INNER JOIN Word ON 
(Word2Word.word2 = Word.id) WHERE ((Word2Word.word1 = 918) AND 
(Word.frequency >= 45) AND (Word.frequency <= 65)) ORDER BY 
Word2Word.relscore DESC LIMIT 15;', 0.22762799263000488)

2016-08-09 01:25:13,076  -  DEBUG  -  (u"SELECT  Word.id FROM Word WHERE 
(Word.normalform = 'measure');", 0.0020809173583984375)

2016-08-09 01:25:13,077  -  DEBUG  -  (u'SELECT Word.normalform, 
Word.frequency, Word2Word.relscore FROM Word2Word INNER JOIN Word ON 
(Word2Word.word2 = Word.id) WHERE ((Word2Word.word1 = 581) AND 
(Word.frequency >= 45) AND (Word.frequency <= 65)) ORDER BY 
Word2Word.relscore DESC LIMIT 15;', 0.47495388984680176)

-






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