On Sunday 02 July 2006 18:11, you wrote:
> On Jul 2, 2006, at 4:05 AM, Tzahi Fadida wrote:
> > Finally, when operations are done on a session. when i do
> > session.flush() are
> > they guaranteed to be performed in order? at least when i use
> > transactions.
> > 10x.
>
> when a flush() occurs, if you havent started a transaction yourself,
> a transaction will be used internally to enclose all statements
> issued by the flush().
>
> statements will be in order of table dependency first;  i.e.  sorted
> based on the foreign key dependencies between either tables or
> individual rows in the case of self-referential mappers.    this
> means if table B contains a foreign key relationship to table A,
> table A's rows will always be inserted/updated first before that of
> table B, and table A's rows will be deleted after all changes on
> table B are complete.
>
> if a table A references itself, then the rows will be inserted/
> updated based on the foreign key dependency of individual rows in
> table A.
>
> For rows within a table that dont have foreign key dependencies to
> each other, rows will be INSERTED based on the order the objects were
> added to the Session, or if they are part of a list-based collection
> on another object they will be inserted in the order of that collection.
>
> For UPDATES and DELETES of non-dependent rows within the same table,
> the ordering is generally consistent but I wouldnt say its
> "guaranteed" at this point since there are some Sets in use to store
> "dirty" and "deleted" objects in the session; I have a feeling i
> would need to patch the "dirty" and "deleted" Set objects in
> unitofwork.py to be OrderedSets and that would probably do it
> (although i wouldnt feel confident unless i could come up with some
> unittests to test that;  which is tricky because Python tends to
> order even unordered dictionaries similarly within a single run and
> even across multiple runs.  it might require hacking dict to return
> items in an explicitly randomized order to insure no dict-based
> ordering is in use).
>
> you should experiment with some test and example programs and have
> echo=True on to get a feel for the behavior of flush().

I am a little confused about your answer. My main concern though, is that
the result of the implicit and explicit transactions to the database will be 
the same as if i executed flush() after each query/insert/delete.
I.e. this seems a little non-deterministic, isn't that risky?
10x.

-- 
Regards,
        Tzahi.
--
Tzahi Fadida
Blog: http://tzahi.blogsite.org | Home Site: http://tzahi.webhop.info
WARNING TO SPAMMERS:  see at 
http://members.lycos.co.uk/my2nis/spamwarning.html

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to