[web2py] update or insert based on month

2018-07-23 Thread Yebach
Hello I am trying to update_or_insert records in my db based on two fields. One is integer for the other I would like to choose month from field. Is this possible with web2py's DAL or do I have to create a custom SQL statement. Database is PostgreSQL thank you -- Resources: - http://web2py.

[web2py] Re: update or insert based on month

2018-07-23 Thread Leonel Câmara
It should be possible using something like db.your_table.update_or_insert(db.date_field.month() == 12, foo=bar) -- 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

[web2py] pyDAL + MongoDB: How to search inside a JSON field?

2018-07-23 Thread Matías J . Magni
Hi, does anyone knows how can I perform this MongoDB's query in pyDAL? db.stores.find({ 'menu.items.food.category': 'Pizza' }) Link to the complete post: https://stackoverflow.com/questions/51471086/pydal-mongodb-how-to-search-inside-a-json-field -- Resources: - http://web2py.com - http

[web2py] Re: Dealing with reserved keywords when you change or upgrade your database from SQLite to POSTGRES

2018-07-23 Thread Dave S
On Sunday, July 22, 2018 at 10:28:46 PM UTC-7, Rahul wrote: > > Hey everyone, > Any clues on this one? OR should I start updating the > application and the models with unused field names? Please let me know > > > Does 'rname' help? You have to poke a bit in the book to find it at fie

Re: [web2py] Re: Updated script for 'Moving your data from one database to another' recipe

2018-07-23 Thread 黄祥
tried the script too, but having no luck *static/scripts/python/mover.py* def main(): URI = 'mysql://root:mysqlpassword@localhost/site' other_db = DAL(URI) print ("creating tables") for table in db: other_db.define_table(table._tablename, *[field for field in table] ) p

Re: [web2py] Re: Updated script for 'Moving your data from one database to another' recipe

2018-07-23 Thread Anthony
> > tried the script too, but having no luck > *static/scripts/python/mover.py* > def main(): > URI = 'mysql://root:mysqlpassword@localhost/site' > other_db = DAL(URI) > print ("creating tables") > for table in db: > other_db.define_table(table._tablename, *[field for field

Re: [web2py] Re: Updated script for 'Moving your data from one database to another' recipe

2018-07-23 Thread 黄祥
tried, modify the code but have another error : ModuleNotFoundError, any idea? *static/scripts/python/mover.py* import site_scheduler import site_scrape def main(): URI = 'mysql://root:mysql@localhost/site' other_db = DAL(URI, auto_import = True) print ('exporting data') db.export_