Let me start by saying Web2py is awesome and I'm excited about the
capabilities of this program.
I have run into an issue that I will layout here:
Problem Statement: When running web2py with mySQL (XAMPP v3.2.2) and
running background queries the db().select statement doesn't pull a fresh
copy, but seems to pulled from a chaced copy of the database. I can
perform a row.update_record succesfully which, but any new inserts into the
database from the website don't show in the query.
Background: I had this working with SqlLite, but migrated to mySQL to
improve the amount of concurrent connections I was making.
I'm running Web2py like this:
web2py.exe -S appname -M -R c:\web2py\applications\appname\private\test.py
--------------------------------
-----------test module------------
db.define_table('tests',
Field('test'), #This field I'm adding manually
Field('updated'), #This field is being updated by the
script.
)
--------------------------------
-----------test.py------------
import time
count = 0 #Used to show the count
while True:
count = count+ 1
print 'This is a Test while True:'
try:
results = db(db.tests.updated=='').select()
except:
print 'Failed to get results'
if results:
print 'Test = True'
print 'Count: %s' % count
print results
for row in results:
print 'Id: %s Test: %s Updated: %s' % (row.id,row.test,row.
updated)
row.update_record(updated='Yes')
db.commit()
print 'Completed'
else:
print 'Test = False'
print 'Count: %s' % count
print 'waiting 10'
print results
print'All database'
print db(db.tests.id>0).select()
time.sleep(10)
Steps I'm taking.
1. Add two records to the test database (through the appadmin interface)
<https://lh3.googleusercontent.com/-gCL70nImHDM/VxEUv8iCJuI/AAAAAAAAAMo/Di2VMOHVpgAPGgNsXchXjQkVkqk7npYigCLcB/s1600/Screen%2BShot%2B2016-04-15%2Bat%2B12.19.37%2BPM.png>
2. Starting the python script with :web2py.exe -S appname -M -R
c:\web2py\applications\appname\private\test.py
<https://lh3.googleusercontent.com/-mytT2xS3Kfw/VxEVMMJ6cSI/AAAAAAAAAMw/U289SNl82H45ZDMEsSl9VetaVTV1GhvPACLcB/s1600/Screen%2BShot%2B2016-04-15%2Bat%2B12.21.40%2BPM.png>
3. From this point It updates the blank field with a 'Yes'. Then in
starts looping through and checking if any new records are in the database
and blank
It does sucesssfully update the record with
row.update_record(updated='Yes')
4. I insert another record Test 7 into the database leaving the updated
field blank
5. The script has continued to run, but never sees the new Test 7. It
continues to only see the Test 6 as the last record.
I am able to see the Test 7 from the appadmin interface.
I have checked mysql and caching is turned off. I'm using the default
config of XAMPP.
Any assistance would be greatly appreciated. I'm starting to feel like
this might be a bug within Web2py?
______________________________________________________________________
The information transmitted, including any attachments, is intended only for
the person or entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of, or taking of any action in reliance upon, this information by persons
or entities other than the intended recipient is prohibited, and all liability
arising therefrom is disclaimed. If you received this in error, please contact
the sender and delete the material from any computer. PricewaterhouseCoopers
LLP is a Delaware limited liability partnership. This communication may come
from PricewaterhouseCoopers LLP or one of its subsidiaries.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.