I'm using the csv export in a simple controller, thus the user (admin) can have a db backup on one click: (the path and filename in my app is dynamic and not fixed as follows, simplified for better understanding) if sys.version_info[0] == 2: db.export_to_csv_file(open('<path_to_your_backup>/<filename>.csv', 'wb')) else: db.export_to_csv_file(open('<path_to_your_backup>/<filename>.csv', 'w', encoding='utf-8', newline=''))
To recover a database I'm using the console as follows: python <your_path_to_web2py>/web2py/web2py.py -S <your_application_by_name> -M -P >>> filename = '<path_to_your_backup>/<filename>.csv' >>> db.import_from_csv_file(open(str(filename), 'r', encoding='utf-8')); db.commit() or for python2 >>> db.import_from_csv_file(open(filename, 'rb')); db.commit() Regards Clemens On Wednesday, November 25, 2020 at 6:53:45 PM UTC+1 gaelpri...@gmail.com wrote: > Hello. > > After the migration from Webfaction to Opalstack I'm still having some > troubles with PostgreSQL. > In a first time I was unable to run he scheduler workers, but now > installing the Psycog2 library like that this problem is resolved. > pip2 install uwsgi psycopg2-binary http://effbot.org/downloads/ > Imaging-1.1.7.tar.gz > > My scheduler tasks import in tables some csv files. > Depending of the functions I have: > No errors, but the tables still empty. > This ticket: <class '_csv.Error'> line contains NULL byte > > That's quite difficult to understand where's the problem. > > I was thinking to clone the PostgreSQL db to a MariaDB one. > > How can I do that? > > Thanks. > -- 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/e8e33803-8c7e-48b3-9b6e-a241d2ddf72en%40googlegroups.com.