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

2018-07-24 Thread 黄祥
*static/scripts/python/mover.py* URI = 'mysql://root:mysqlpassword@localhost/site' other_db = DAL(URI, auto_import = True) print ('Exporting data') db.export_to_csv_file(open('tmp.csv', 'wb') ) print ('Importing data') other_db.import_from_csv_file(open('tmp.csv', 'rb') ) other_db.commit() print ('

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_

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 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-22 Thread Gualter Portella
Thanks, Anthony. I could create the authentication tables with the modifications you suggested. I wrote a script to transfer the rest of the data to the other tables. Thanks again, 2018-07-22 0:59 GMT-03:00 Anthony : > I assume you're getting this from the "web2py Application Development > Coo

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

2018-07-21 Thread Anthony
I assume you're getting this from the "web2py Application Development Cookbook". Note, there is no -N option -- that's just an error in the book. As for the code, in mover.py, try changing: *[field for field in table] to: *[field.clone() for field in table] The DAL will no longer let you simp