Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-20 Thread Michael Bayer
On Jul 20, 2006, at 1:02 PM, Randall Smith wrote: > I'm writing tests for an app now and need a test database. I've > decided > to use sqlite, though production is Postgres. I've dreaded the > thought > of populating the test database because there are many tables and > constraints which me

Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-20 Thread Randall Smith
The more I think about what a pain this would be, the more appealing 'createdb -T production_copy testing' becomes. Testing with the same database server type with recent data makes sense. Much less of a headache. Randall Randall Smith wrote: > I'm writing tests for an app now and need a test

Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-20 Thread Randall Smith
I'm writing tests for an app now and need a test database. I've decided to use sqlite, though production is Postgres. I've dreaded the thought of populating the test database because there are many tables and constraints which means I have to populate them in the correct order, etc. SA seems

Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-13 Thread Steve Zatz
> sqlite supports replication via the "cp" command ;) I always knew there was a simple solution. Who needs ORMs or database replication anyway? ;) - Using Tomcat but need to do more? Need to support web services, security? G

Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-12 Thread Michael Bayer
sqlite supports replication via the "cp" command ;)On Jul 12, 2006, at 6:31 PM, Jonathan Ellis wrote:On 7/12/06, Steve Zatz <[EMAIL PROTECTED]> wrote: > What is the difference between what you are trying to do and replication?> Replication should really be handled at a lower level than SA.  Most mo

Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-12 Thread Jonathan Ellis
On 7/12/06, Steve Zatz <[EMAIL PROTECTED]> wrote: > What is the difference between what you are trying to do and replication?> Replication should really be handled at a lower level than SA.  Most modern> DBs have a replication solution available. The data is in sqlite, which I don't believe has rep

Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-12 Thread Tzahi Fadida
What you talk about is the latest snapshot of a Temporal Database. It might be interesting to see how to implement a temporal database using SA ORM over a normal RDBMS. Could be a successful niche. :) However, simply keep a modification time column and keep all records on the server even if they

Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-12 Thread Michael Bayer
it feels very row-level to me; i.e. use timestamp and version ID columns in the tables, pickle straight rowsets, then when synchronizing just loop through all tables, grab all the rows where timestamp < last sync time and then work out the version ids. Id use the ORM to handle the app out

Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-12 Thread Steve Zatz
Thanks for all the comments. Let me be a little more clear. The synchronization does not take place in real-time. Users with laptops with no Internet access make a few changes to their local copy of the database. When they get an Internet connection they manually indicate that they want to sync

Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-12 Thread Michael Bayer
are you replicating via calling session.flush() for two different sessions ? While I agree with Jonathan that its better for you to just use an existing database replication solution, a solution embedded into SA would probably work better as a MapperExtension that handles after_insert() an

Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-12 Thread Tzahi Fadida
I am not completely sure he is talking about replication. Lets say you have an employee record on the server, the server sends the record to the client application who then changes the phone number. The record is returned to the server from the client changed. The server now needs to set the recor

Re: [Sqlalchemy-users] Keeping two databases in sync

2006-07-12 Thread Jonathan Ellis
On 7/12/06, Steve Zatz <[EMAIL PROTECTED]> wrote: I am trying to find the most efficient way to keep two databases insync. What is the difference between what you are trying to do and replication?  Replication should really be handled at a lower level than SA.  Most modern DBs have a replication so

[Sqlalchemy-users] Keeping two databases in sync

2006-07-12 Thread Steve Zatz
I am trying to find the most efficient way to keep two databases in sync. There are multiple tables in the database and each row has a "dirty" flag if something has changed since the last sync. I am pickling session objects and passing them back and forth to applications that are managing each of