[web2py] Re: how to generate database dumps with DAL
I think I can use the _create() and _insert() methods to achieve this.
[web2py] Re: how to generate database dumps with DAL
if you do db.export_to_csv_file(open('myfile.csv','wb')) you get a csv dump of the db and you do db.import_from_csv_file(open('myfile.csv','rb')) you get a restore. The myfile.csv is a csv file and it is not specific of one db engine. Massimo On Dec 10, 4:38 pm, Richard richar...@gmail.com wrote: I have a CSV file and want to generate dumps of the data for sqlite, mysql, postgres, etc. My current workflow is to insert the data in each database and then use mysqldump, etc to generate the dump files. I read that the DAL is now a standalone module - great! Is it possible to use the DAL to purely generate the required SQL for a database without actually inserting or even installing the database?
Re: [web2py] Re: how to generate database dumps with DAL
db.export_to_csv_file will only contain the raw data, it will not include any of the database specific things (such as indexies, mysql/postgres users, stored procedures, sequence stores, etc...) -- Thadeus On Fri, Dec 10, 2010 at 5:24 PM, mdipierro mdipie...@cs.depaul.edu wrote: if you do db.export_to_csv_file(open('myfile.csv','wb')) you get a csv dump of the db and you do db.import_from_csv_file(open('myfile.csv','rb')) you get a restore. The myfile.csv is a csv file and it is not specific of one db engine. Massimo On Dec 10, 4:38 pm, Richard richar...@gmail.com wrote: I have a CSV file and want to generate dumps of the data for sqlite, mysql, postgres, etc. My current workflow is to insert the data in each database and then use mysqldump, etc to generate the dump files. I read that the DAL is now a standalone module - great! Is it possible to use the DAL to purely generate the required SQL for a database without actually inserting or even installing the database?
[web2py] Re: how to generate database dumps with DAL
Thanks Massimo. My understanding is those functions are for importing a CSV file into the database, or dumping the database into a CSV file. However I am trying to avoid writing to the database because I want to generate dumps for databases I don't have installed, such as Oracle and MSSQL. Also I just want the SQL commands so it seems inefficient to actually write to the database.