On Tuesday, March 17, 2020 at 8:43:03 AM UTC-7, Daniel Correa wrote: > > Hello community, > > I know I might be losing some concepts but I'm new in web2py and web > development in general. > I'll try to explain my problem to you, > I have a csv file which is getting updated every second, but I don't know > how to fetch this data to web2py, I mean, the file is in the static folder, > but then I have two options to graph the values: > > One of them is getting the file with JavaScript but this appereantly > doesn't work when the site is on production (from another device). > The other one is somehow fetching the data from the csv file to the > database of web2py, but then I have doubts if this data is actually getting > fetched in real-time and updating the database in the production site, or > how is this happening? > > So far I think the best option is creating a database which is getting > updated by...( a model?) and then just calling the values in the views. > > Does anyone has any idea how this could be done in an efficient way? > > Thanks in advance. > > I recommend you use a scheduler task. <URL:http://web2py.com/books/default/chapter/29/04/the-core#web2py-Scheduler> See also <URL:http://web2py.com/books/default/chapter/29/13/deployment-recipes#Start-the-scheduler-as-a-Linux-service-upstart-> and <URL:http://web2py.com/books/default/chapter/29/13/deployment-recipes#Initial-Queuing-of-a-Repeating-Task>
You can also use an external scheduler, although that hasn't been much discussed in the web2py environment. It is the standard approach in the next-gen framework (py4web), where celery is the recommended approach to scheduling. Your task should run periodically, check for a new copy of the CSV, and import it into the appropriate database using standard DAL tools. <URL:http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Exporting-and-importing-data> Good luck! /dps -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/edd69844-7a3d-4b44-821b-eb9d4adbf6b6%40googlegroups.com.