[sqlalchemy] Filtering for element in PgArray column

2012-08-13 Thread Vlad K.
Hi all, what is the proper way to filter for element in a PostgreSQL ARRAY column? in_() does not produce valid syntax for PostgreSQL ( does (value) instead of array[value] ). For now I'm doing the following, but I'm not sure how to bind values and not have such a gaping sql injection

Re: [sqlalchemy] PostgreSQL hstore support for SQLAlchemy

2012-08-13 Thread Michael Bayer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Aug 11, 2012, at 3:18 PM, Audrius Kažukauskas wrote: Hi, I've been looking for a way to use PostgreSQL's hstore type in SA, and from all the options that I have found on the net the one written by Kyle Schaffrick (big thanks to him) and

[sqlalchemy] is there a reason why lower() isn't a column operation ?

2012-08-13 Thread Jonathan Vanasco
just wondering why i have to do : sqlalchemy.sql.func.lower( class.column ) == string.lower() instead of : class.column.lower() = string.lower() btw - i know in the archives people have mentioned doing an ilike search, but a WHERE lower(column) = 'string' search will search against a

Re: [sqlalchemy] is there a reason why lower() isn't a column operation ?

2012-08-13 Thread Michael Bayer
On Aug 13, 2012, at 1:44 PM, Jonathan Vanasco wrote: just wondering why i have to do : sqlalchemy.sql.func.lower( class.column ) == string.lower() instead of : class.column.lower() = string.lower() btw - i know in the archives people have mentioned doing an ilike search, but a

Re: [sqlalchemy] Filtering for element in PgArray column

2012-08-13 Thread Michael Bayer
we don't currently have native support for ARRAY operations and there is some infrastructure work that should make it easier in 0.8 to add. for now, when you need custom operators use op(): Model.array_column.op(@)(somevalue) On Aug 13, 2012, at 10:10 AM, Vlad K. wrote: Hi all, what

[sqlalchemy] how to get into PG database, is the url the right way? newbie question

2012-08-13 Thread Gery
Hello, I'm new around here and I've been using SQLalchemy (SA) for a while. I work with PostGis (PG), OpenLayers (OL), ExtJS, GeoExtJS and now with the great SA and GeoAlchemy. I have one problem, I created a model where I defined one table of my PG database, it has a url like this: url =

Re: [sqlalchemy] Getting maximum recursion depth exception when creating a model instance with two foreign keys

2012-08-13 Thread Zhe Wu
Gotcha. Thanks! On Monday, August 13, 2012 4:57:29 AM UTC+8, Audrius Kažukauskas wrote: On Sun, 2012-08-12 at 11:07:18 -0700, Zhe Wu wrote: def __init__(self, body, author, story): Here arguments are body, author, story. comment = Comment(author, story, body) And here they

Re: [sqlalchemy] Filtering for element in PgArray column

2012-08-13 Thread Vlad K.
On 08/13/2012 08:53 PM, Michael Bayer wrote: we don't currently have native support for ARRAY operations and there is some infrastructure work that should make it easier in 0.8 to add. for now, when you need custom operators use op(): Model.array_column.op(@)(somevalue) I tried that, but

Re: [sqlalchemy] PostgreSQL hstore support for SQLAlchemy

2012-08-13 Thread Audrius Kažukauskas
On Mon, 2012-08-13 at 10:59:59 -0400, Michael Bayer wrote: very nice job understanding quite a number of SQLAlchemy APIs, this is good work. It reminds me also of how we still have a weakness in the Core API, that we can't add new comparison methods at the Core level onto Column objects and

Re: [sqlalchemy] Filtering for element in PgArray column

2012-08-13 Thread Michael Bayer
On Aug 13, 2012, at 3:25 PM, Vlad K. wrote: On 08/13/2012 08:53 PM, Michael Bayer wrote: we don't currently have native support for ARRAY operations and there is some infrastructure work that should make it easier in 0.8 to add. for now, when you need custom operators use op():