[sqlalchemy] [Postgres] Querying an array

2011-02-03 Thread aj
Running Sqlalchemy 0.5.8 (can't upgrade right now) with Postgres 8.1.X. A table contains an array column: users text[] In SQL I would query select ...where 'jim' = ANY(users) How would I query this using the ORM layer? -aj -- You received this message because you are su

Re: [sqlalchemy] Saving items not in the session: Bug or "feature"?

2009-12-30 Thread AJ ONeal
> > AJ ONeal wrote: > > The following code inserts a new element, rather than using the one > > already > > in the session > > > if you search the list, literally yesterdays messages, the find_or_create > concept was discussed (in SQLA, merge() is used). I w

[sqlalchemy] Saving items not in the session: Bug or "feature"?

2009-12-30 Thread AJ ONeal
his: my_obj = MyObject.find_or_create {:conceptual_key1 => val1, :conceptual_key2 => val2, :conceptual_key3 => val3} my_obj.save() This is nice because it allows me to use composite conceptual keys to find or create an object rather than using the standard (but much faster) "fake" inte

Re: [sqlalchemy] is there any sort of find_or_create query?

2009-12-28 Thread AJ ONeal
collections, are merged. - The new instance is returned. Generically the pattern is called: insert_or_update SQLAlchemy calls it: merge Rails calls it: find_or_create Symfony implements it as: setNew(false) and then save() MySql calls it: insert on duplicate update AJ ONeal -- You received

Re: [sqlalchemy] is there any sort of find_or_create query?

2009-12-28 Thread AJ ONeal
r will do the same thing automatically as the former (SQLA does > not use IntegrityErrors to query the database). AJ ONeal On Mon, Dec 28, 2009 at 9:40 PM, CoolAJ86 wrote: > If I have an object User in rails with attributes first, last, and > password I can do something like this > >