Ability to transfere one database to another.

18 views
Skip to first unread message

Jason Brower

unread,
Oct 30, 2009, 11:50:40 PM10/30/09
to Web2py Mailing List
I have the unfortunate fact that I have been using sqlite3 for some
time, but my data is getting a little unstable. How do I best transfere
that data from one database to another without direct access to the
admin screens as it is hosted remotely?
For right now, I guess my best approach would be to copy the sqlite3
files to my computer and run the admin from here, but that just gets me
the data, I still have to insert it some how.
BR
Jason

Thadeus Burgess

unread,
Oct 31, 2009, 12:04:24 AM10/31/09
to web...@googlegroups.com
db.export_to_csv_file(open('/path/to/file.csv', 'wb'))

db.import_from_csv_file(open('/path/to/file.csv', 'rb'))

-Thadeus

Jason Brower

unread,
Oct 31, 2009, 12:25:01 AM10/31/09
to web...@googlegroups.com
Heh, oh yeah. :) Thanks,
Jason Brower

mdipierro

unread,
Oct 31, 2009, 3:26:51 AM10/31/09
to web2py-users
You can also connect to both at the same time

db1=DAL(...)
db2=DAL(...)
db1.export_to_csv_file(open('/path/to/file.csv', 'wb'))
db2.import_from_csv_file(open('/path/to/file.csv', 'rb'))

On Oct 30, 11:25 pm, Jason Brower <encomp...@gmail.com> wrote:
> Heh, oh yeah. :)  Thanks,
> Jason Brower
>
> On Fri, 2009-10-30 at 23:04 -0500, Thadeus Burgess wrote:
> > db.export_to_csv_file(open('/path/to/file.csv', 'wb'))
>
> > db.import_from_csv_file(open('/path/to/file.csv', 'rb'))
>
> > -Thadeus
>
> > On Fri, Oct 30, 2009 at 10:50 PM, Jason Brower <encomp...@gmail.com>
Reply all
Reply to author
Forward
0 new messages