[sqlalchemy] Re: moving an object

2009-04-18 Thread jean-philippe dutreve
comments on this ? jean-philippe dutreve wrote: It would be fine/safe that accountA has entry removed BEFORE any reload (with explicit refresh/expire/commit). I can't remember, but a previous version of SA had this behavior. On Apr 6, 4:42 pm, Michael Bayer mike...@zzzcomputing.com wrote

[sqlalchemy] Re: moving an object

2009-04-06 Thread jean-philippe dutreve
is contained in 2 accounts temporaly. It can lead to false computation (when summing balance for instance). On 5 avr, 22:03, jason kirtland j...@discorporate.us wrote: jean-philippe dutreve wrote: Hi all, I wonder if SA can handle this use case: An Account can contain Entries ordered by 'position

[sqlalchemy] Re: moving an object

2009-04-06 Thread jean-philippe dutreve
variations on business rules for moving an item that would be difficult to encapsulate in a common operation within SA. -- Mike Conley On Mon, Apr 6, 2009 at 2:10 AM, jean-philippe dutreve jdutr...@gmail.comwrote: Currently, I use accountA.remove(entry) and I have rewritten insort to bypass

[sqlalchemy] Re: moving an object

2009-04-06 Thread jean-philippe dutreve
be many variations on business rules for moving an item that would be difficult to encapsulate in a common operation within SA. -- Mike Conley On Mon, Apr 6, 2009 at 2:10 AM, jean-philippe dutreve jdutr...@gmail.comwrote: Currently, I use accountA.remove(entry) and I have

[sqlalchemy] moving an object

2009-04-05 Thread jean-philippe dutreve
Hi all, I wonder if SA can handle this use case: An Account can contain Entries ordered by 'position' attribute. mapper(Account, table_accounts, properties = dict( entries = relation(Entry, lazy=True, collection_class=ordering_list ('position'), order_by=[table_entries.c.position],

[sqlalchemy] Re: ordering_list performance

2008-09-23 Thread jean-philippe dutreve
. The below will break, if and when that's fixed to match the pure Python implementation in the standard lib. Calling list.extend(account_entries, new_entries) is probably a safe alternative. *http://bugs.python.org/issue3935 jean-philippe dutreve wrote: What I've done is something like

[sqlalchemy] Re: ordering_list performance

2008-09-22 Thread jean-philippe dutreve
attribute can't be trusted to be in sync with the list order. jean-philippe dutreve wrote: Below is the profiling of code that added 1200 items into an ordering_list relation. I had to bypass the ordering_list stuff for bulk additions in order to have better performance (down to 2 seconds

[sqlalchemy] SQL mass-delete

2008-05-13 Thread jean-philippe dutreve
I'd like to delete all Transactions contained in an account hierarchy without loading any transaction into memory, just DB work with the SQL DELETE request constructed by SA. The query that defines the transactions is: Session.query(Transaction).join(['entries','account','root'],

[sqlalchemy] Re: SQL mass-delete

2008-05-13 Thread jean-philippe dutreve
fine. thank you for your help. jean-philippe --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: To select a tree with PG connectby() in a single request

2008-04-18 Thread jean-philippe dutreve
After debugging, i've noticed that the issue is related to eager loaded relations. If you try the example script with _descendants relation having lazy=None or True, then the extension method is not called anymore. Is there a way to fire the extension method even without eadger loading? i cant

[sqlalchemy] Re: To select a tree with PG connectby() in a single request

2008-04-18 Thread jean-philippe dutreve
Thank you for your support. You have done an awesome work overall. --~--~-~--~~~---~--~~ 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

[sqlalchemy] To select a tree with PG connectby() in a single request

2008-04-17 Thread jean-philippe dutreve
Hi all, I'm trying to load a whole Tree of Account objects (Mapped instances) in a single SELECT with unlimited depth. I'm using PostgreSQL connectby function from the tablefunc module. It returns rows of each nodes in a depth first visit. sql = SELECT acc_accounts.* FROM

[sqlalchemy] Re: To select a tree with PG connectby() in a single request

2008-04-17 Thread jean-philippe dutreve
Thank you for the suggestion but the extension method doesn't fired, even without raw sql: mapper(Account, table_accounts, extension=AccountLoader(), properties=dict( children = relation(Account, lazy=None, primaryjoin=table_accounts.c.parent_id==table_accounts.c.account_id,

[sqlalchemy] eagerload_all issue

2007-09-11 Thread Jean-Philippe Dutreve
Here's my issue: 3 tables CREATE TABLE accounts ( account_id serial PRIMARY KEY, name varchar(16) NOT NULL UNIQUE, ); CREATE TABLE transactions ( transaction_id serial PRIMARY KEY, ); CREATE TABLE entries ( entry_id serial PRIMARY KEY, account_id integer NOT NULL REFERENCES

[sqlalchemy] eagerload_all issue

2007-09-11 Thread Jean-Philippe Dutreve
Here's my issue: 3 tables CREATE TABLE accounts ( account_id serial PRIMARY KEY, name varchar(16) NOT NULL UNIQUE, ); CREATE TABLE transactions ( transaction_id serial PRIMARY KEY, ); CREATE TABLE entries ( entry_id serial PRIMARY KEY, account_id integer NOT NULL REFERENCES

[sqlalchemy] Re: eagerload_all issue

2007-09-11 Thread Jean-Philippe Dutreve
Ive uploaded the script eagerload_all.py that reproduce the issue. Hope it helps you. On 11 sep, 16:43, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 11, 2007, at 10:28 AM, Jean-Philippe Dutreve wrote: The name is on account, not on entry. Transactions and all must be loaded in one shot

[sqlalchemy] Re: eagerload_all issue

2007-09-11 Thread Jean-Philippe Dutreve
its actually not eager loading the second list of accounts If there is no eager loading on the second list, I don't understand why a 'SELECT entries ...' is executed when I just ask account.name and not account.entries. untested, i.e. join_depth on a mapper thats not self-referential,

[sqlalchemy] Re: on delete restrict (bis)

2007-09-09 Thread Jean-Philippe Dutreve
Another solution could be to inverse the order: - first delete the parent (so the rule RESTRICT is immediately fired) - second set null the FKs. On 8 sep, 19:52, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 8, 2007, at 12:54 PM, Jean-Philippe Dutreve wrote: My need is related

[sqlalchemy] on delete restrict (bis)

2007-09-08 Thread Jean-Philippe Dutreve
My need is related to Postgresql ON DELETE RESTRICT/NO ACTION : I'd want a sql exception as soon as a parent having any existing child is deleted. I don't want cascade delete on children, just the parent but only if it has no child. I've remarked that SA (0.4) first SET NULL all FKs in child

[sqlalchemy] Re: bisect.insort

2007-09-07 Thread Jean-Philippe Dutreve
Thanks Jason for your clear explanation. Is there any mean to do your suggestion to call the pure Python version without coping/pasting it into my module? On 7 sep, 16:28, jason kirtland [EMAIL PROTECTED] wrote: Jean-Philippe Dutreve wrote: I was using SA 0.3.9 to insert an item in an ordered

[sqlalchemy] Changeset 2795

2007-09-07 Thread Jean-Philippe Dutreve
It seems that the bug fixed by changeset 2795 (column_prefix with synonym) is still active in 0.4 branch. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to