>> For such cases, <duck> Modeling </duck> provides a mechanism that >> "broadcasts" changes made by one "editing context" to all others upon >> committing. Maybe they could share code with SQLAlchemy? > > if someone wants to write an extension, most easily to > sessioncontext, that just synchronizes data between open sessions, > thats not a big deal. But it really is somewhat of a reinvention of > the database itself. the Session only represents the set of objects > youre working on *right now*. if i wrote a function that loaded a > row from a database, and then i was going to operate on some of those > values, would i want those values to magically change while i was in > the middle of my operation ?
Err, no. However I do think that you should be notified that they have been changed by some third-party and then have the possibility to update your values if you want to. >> Personally, I agree with SGI that: >> >> "GUI tools should not mislead the user; they should display the current >> state of the system, even when changes to the system originate from >> outside of the tools themselves." >> >> (Citation from http://oss.sgi.com/projects/fam/). >> >> So imho the GUI of a database application should always reflect the >> current state of the data in the database. Without polling, of course. >> Not like e.g. this ยง$%&@! Windows "Explorer"... > > I would not agree that SA is a GUI, But it's being used for GUI applications (among others) in my case. > and i wouldnt agree that a GUI should always reflect the current state of > the database. My potential end-users won't agree with you on that. >:-> > if i open up a document and im editing the document, and i havent yet > pressed "save", the GUI does not represent the current state of the > database. Yes, and that's bad imho. >:-> The application should notify you as soon as possible that someone has modified the data "behind your back". Everything else will lead to unwanted results. >> Unfortunately there seems to be no "standard" mechanism to register a >> client with the database itself for notification of any updates to >> records. Even the PostgreSQL-specific "listen" and "notify" commands >> require polling to retrieve the notification events as far as I >> understand from the documentation. I was wrong here. PostgreSQL notifications don't require polling the database server. It's just the libpq client library itself that requires polling a function to retrieve the notifications. But an example for Psycopg2 shows how to solve this: "tap" the socket where the notifications arrive and poll the function only when something has arrived. > because nobody uses stuff like that. really, its not the end of the > world to have to deal with normal data synchronization issues. No it isn't. But I have to deal with them, I can't ignore them. And I have to deal with them in the way that my potential end-users need, so polling every minute or hour is out of question. And I have to deal with them in an efficient way, so polling the database every second is out of question. >> I wonder whether PL/Python support in PostgreSQL would allow to implement >> something like such an asynchronous notification system... > > its a solution in search of a problem. ;) Well, err, no. >:-> Not in my case. I am precisely searching for a solution for this kind of problem. Because I know from the end users (I'm closer to being an end-user myself than to being a developer) that they wouldn't accept to see something on screen that may already be wrong at the moment when they see it. And they wouldn't accept either to have to press a "refresh" button every few seconds to see what is going on. As a sidenote: We _did_ encounter precisely this issue in a past project (I was on the end-user side in this one), and because the developers were "stuck" on using "web services" just because it was considered as "modern", this issue (among lots of others) couldn't be solved in a way that would not have been ridiculous. In the end the project didn't produce anything that was actually useful for the end-users. And it was precisely the experience with this project (wasting quite a few years and millions of EUR) what made me look for possibilities to implement such applications myself. And with Python and a solid framework it could be possible even for a non-computer scientist to implement typical database applications himself. > come up with the application first In my case, just as _one_ example among many others: See a sort of "dashboard" on screen about the state of the ongoing work in a workshop. Work orders, ressource booking, asset tracking etc. This will basically be the "desktop background" on the screen of the workshop manager. Another example would be the use of a shared database for data exchange between applications. In the environment where I work, most applications are in fact database applications, so exchanging data between them via a shared database is natural. But you wouldn't want to poll such a database permanently for nothing, as data for exchange will often arrive intermittently, in large batches, with nothing happening between, sometimes for hours. > and show that this is something really necessary...the reason there arent > too many tools for this sort of thing is because they are usually not > needed ! My primary job is (technical) consulting for end-users, i.e. mainly asking them questions about their problems and searching for solutions because they don't have the time to do it themselves. So I think I somewhat do know what they need. >:-> Sincerely, Wolfgang Keller -- My email-address is correct. Do NOT remove ".nospam" to reply. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users