Database Backup

17 views
Skip to first unread message

ritesh

unread,
Feb 22, 2012, 1:29:48 AM2/22/12
to TurboGears
Hi,
Currently i am using SQLite (SQLAlchemy managed database) for my
application. In future if in case i want to switch to other database
like PostgreSQL, keeping all the backup of previous database. what
would be the prodedure for the same. Moreover how can i modulate the
application from place to place with same database backups.

Best Regards
Ritesh

NiL

unread,
Feb 22, 2012, 3:15:32 AM2/22/12
to turbo...@googlegroups.com
Hi, I don't know how to move your data from sqlite to postgres, I'm sure you can google around this specific issue.
I've been using sqlite for development and test, and went postgres for production.

I've stumbled upon several problem then as sqlite is very permissive, and now I'm using postgres for development too. I can only recommend that you develop with the database backed that you aim to use in production.

NiL

ritesh

unread,
Feb 23, 2012, 11:05:44 PM2/23/12
to TurboGears
Hi,
sorry i think i was not clear with my query.
Actually issue is not with using of which database, here i want to
have a database backup where i am currently running my application so
that same database backup i can take to other place.

Ritesh

Carlos Daniel Ruvalcaba Valenzuela

unread,
Feb 23, 2012, 11:33:20 PM2/23/12
to turbo...@googlegroups.com
Hi,

That seems to be a bit out of the scope of SQAlchemy, most databases
have a way of dumping their data to sql to reload in another server,
now, I know django for example has a way to dump and load the project
database (fixtures) for testing, but I don't recall TG having
something like that, even so I would not recommend you to use that
kind of tool in production.

SQLAlchemy has a way to manage schema migration which is as far as it
goes, meaning that you can recreate the database tables in any other
server with minimal fuss and evolve the schema, but this does not
cover importing data across different databases.

Michael Pedersen

unread,
Feb 23, 2012, 11:39:17 PM2/23/12
to turbo...@googlegroups.com
You *could* (though I do not recommend this) do this:

Create two sessions (SA sessions), one for the source, one for the destination.
Loop over every one of your models, and then over every object in that model for the source session/database. Insert the object into the second session.

It would work, but would not be pleasant to use, I don't think.
--
Michael J. Pedersen
My Online Resume: http://www.icelus.org/ -- Google+ http://plus.ly/pedersen
Google Talk: m.ped...@icelus.org -- Twitter: pedersentg

Reply all
Reply to author
Forward
0 new messages