[web2py] Re: script to clone a database
Massimo, this is awesome, thanks!:) I wrapped the contents of your main() in a function (used in script, not web) where i can pass in these args: model=None - if not None, points to a model. This will re-write the model used in script in the webApp/applications/models dir (db.py) - this lets me share the db between script and webApp seamlessly :) otherDB=None- name the DB, or default to 'storage.sqlite' dbfolder=None - specify db folder. if None, use current dir clean=False - if True, will delete all tables, db, log (i do this so each build has a fresh new SQLite DB) truncate=False - if True, just truncate, don't delete (i use this as well in some places, but now makes more sense to use along side your script. Thanks again, Mart :) On May 24, 1:39 am, ron_m ron.mco...@gmail.com wrote: Great, I was doing this manually, this really helps codify the procedure. The export_to_csv_file and import_from_csv_file routines are the magic with how they fix up all the foreign keys to match the new primary key values.
[web2py] Re: script to clone a database
If you can make the script user optparse, would you mail it to me? I happy to replace mine with your improved one. On May 25, 9:38 am, mart msenecal...@gmail.com wrote: Massimo, this is awesome, thanks!:) I wrapped the contents of your main() in a function (used in script, not web) where i can pass in these args: model=None - if not None, points to a model. This will re-write the model used in script in the webApp/applications/models dir (db.py) - this lets me share the db between script and webApp seamlessly :) otherDB=None - name the DB, or default to 'storage.sqlite' dbfolder=None - specify db folder. if None, use current dir clean=False - if True, will delete all tables, db, log (i do this so each build has a fresh new SQLite DB) truncate=False - if True, just truncate, don't delete (i use this as well in some places, but now makes more sense to use along side your script. Thanks again, Mart :) On May 24, 1:39 am, ron_m ron.mco...@gmail.com wrote: Great, I was doing this manually, this really helps codify the procedure. The export_to_csv_file and import_from_csv_file routines are the magic with how they fix up all the foreign keys to match the new primary key values.
[web2py] Re: script to clone a database
sure, be glad to :) I can get to it this afternoon. On May 25, 11:21 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: If you can make the script user optparse, would you mail it to me? I happy to replace mine with your improved one. On May 25, 9:38 am, mart msenecal...@gmail.com wrote: Massimo, this is awesome, thanks!:) I wrapped the contents of your main() in a function (used in script, not web) where i can pass in these args: model=None - if not None, points to a model. This will re-write the model used in script in the webApp/applications/models dir (db.py) - this lets me share the db between script and webApp seamlessly :) otherDB=None - name the DB, or default to 'storage.sqlite' dbfolder=None - specify db folder. if None, use current dir clean=False - if True, will delete all tables, db, log (i do this so each build has a fresh new SQLite DB) truncate=False - if True, just truncate, don't delete (i use this as well in some places, but now makes more sense to use along side your script. Thanks again, Mart :) On May 24, 1:39 am, ron_m ron.mco...@gmail.com wrote: Great, I was doing this manually, this really helps codify the procedure. The export_to_csv_file and import_from_csv_file routines are the magic with how they fix up all the foreign keys to match the new primary key values.
[web2py] Re: script to clone a database
This is fantastic. I was going to have to do something like this in the future. Glad to know that web2py makes it easy :)
Re: [web2py] Re: script to clone a database
If this work as I want, this gonna save me a lot of time. Thank you for this. :) 2011/5/23 Ross Peoples ross.peop...@gmail.com This is fantastic. I was going to have to do something like this in the future. Glad to know that web2py makes it easy :) -- http://martin.tecnodoc.com.ar
[web2py] Re: script to clone a database
Great, I was doing this manually, this really helps codify the procedure. The export_to_csv_file and import_from_csv_file routines are the magic with how they fix up all the foreign keys to match the new primary key values.