[sqlalchemy] Re: Events Undo/Redo Functionality?

2009-02-24 Thread az

these are two general patterns, observer/listener and undo/redo 
(command-pattern), which have nothing to do with DB.
i dont know about 2) DB-observers which would react on somebody else 
changing the DB, AFAIK that is possible on certain servers only, but 
the rest should be done independly on higher level than DB-stuff. 
read about Model-View-Controller.

On Tuesday 24 February 2009 15:00:28 paniq303 wrote:
 Hi everyone,

 I am developing an offline music synthesizing and sequencing
 application in Python, using the SQLite backend to store song data.
 At the moment, I am using my own object relational mapper between
 SQL and Python, which is fairly minimal. I feel compelled to use
 SQLAlchemy, but there are two areas where I would like to assess my
 options before I go forward and embed SQLAlchemy into my
 application.

 1) Is it possible/planned to connect signal handlers to database
 changes? In my app, changing object properties will call connected
 event handlers, which in turn refresh UI views. How could I do this
 with SQLA?

 Can you think of another way to update the UI from DB changes?
 Another way could be to have a hook listen to transactions and
 generate journal records from which events can be signalled - this
 would even enable multiple processes to handle events. Does that
 sound more plausible? Is it possible?

 2) I see that SQLA supports rollback for pending transactions,
 which is a great feature. But as far as I understand, it is not
 possible to rollback transactions that have already been committed
 (undo). How would I go about and implement such a feature into my
 application best, using SQLA as a backend?

 I understand that SQL is traditionally used in web services, where
 event handling is virtually impossible and extensive undo/redo
 functionality is rarely needed. But I believe it makes perfect
 sense to use databases for document formats as well.

 Looking forward to your answer.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Events Undo/Redo Functionality?

2009-02-24 Thread paniq303

On Feb 24, 5:16 pm, a...@svilendobrev.com wrote:
 these are two general patterns, observer/listener and undo/redo
 (command-pattern), which have nothing to do with DB.
 i dont know about 2) DB-observers which would react on somebody else
 changing the DB, AFAIK that is possible on certain servers only, but
 the rest should be done independly on higher level than DB-stuff.
 read about Model-View-Controller.

Your reply sounds a bit offended. I'm sorry if my request came over as
kind of rude. I don't mean to upset anybody, and I don't want to take
up your time, so please send me elsewhere if my inquiry does not fit
the projects scope.

I'm using a Model-View-Controller scheme at the moment. I also know of
the command pattern and how it works.

But I'm trying to write as little code on my own as I can. SQLAlchemy
provides a high level model part for the application, and borders on
the issues I presented above. I can see that the issues I presented
are not neccessarily of importance in the scope of SQL.

So let me rephrase my question: how could I solve above two issues in
the most efficient manner, leveraging whatever SQL and SQLAlchemy have
to offer? Is there any short cut I can take on the way to undo/redo
functionality?

If journaling DB changes would be a good way to track changes, how can
I hook up on them best? Where would my plan fit in?

I'm sorry if these questions swamp you. Maybe I am thinking too much.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Events Undo/Redo Functionality?

2009-02-24 Thread Gregg Lind

If you choose to go down the journaling route, some things would be helpful:

1.  all of your functions (journalable actions) should have inverse
functions to reverse them.

If this is true, then from a particular state, you can simply record
the actions, checkpointing all user objects periodically.  A sequence
might be something like:

save binary state of file
cut(1:30, 1:40)
loop(a,13, sec=10)


Since you described an music editing app, doing this in clean way
(without losing precision and information) might require storing
actual binary states.   This sounds, to me, a little nightmarish.

I don't have any insights on the SA front, alas.


Gregg Lind


On Tue, Feb 24, 2009 at 2:41 PM, paniq303 paniq...@googlemail.com wrote:

 On Feb 24, 5:16 pm, a...@svilendobrev.com wrote:
 these are two general patterns, observer/listener and undo/redo
 (command-pattern), which have nothing to do with DB.
 i dont know about 2) DB-observers which would react on somebody else
 changing the DB, AFAIK that is possible on certain servers only, but
 the rest should be done independly on higher level than DB-stuff.
 read about Model-View-Controller.

 Your reply sounds a bit offended. I'm sorry if my request came over as
 kind of rude. I don't mean to upset anybody, and I don't want to take
 up your time, so please send me elsewhere if my inquiry does not fit
 the projects scope.

 I'm using a Model-View-Controller scheme at the moment. I also know of
 the command pattern and how it works.

 But I'm trying to write as little code on my own as I can. SQLAlchemy
 provides a high level model part for the application, and borders on
 the issues I presented above. I can see that the issues I presented
 are not neccessarily of importance in the scope of SQL.

 So let me rephrase my question: how could I solve above two issues in
 the most efficient manner, leveraging whatever SQL and SQLAlchemy have
 to offer? Is there any short cut I can take on the way to undo/redo
 functionality?

 If journaling DB changes would be a good way to track changes, how can
 I hook up on them best? Where would my plan fit in?

 I'm sorry if these questions swamp you. Maybe I am thinking too much.

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---