Re: [sqlalchemy] No operator matches the given name and argument filtering on postgres array

2013-12-10 Thread Matthew Pounsett
On Tuesday, 10 December 2013 01:00:51 UTC-5, Michael Bayer wrote: that’s a little strange but you can get around it using CAST: match = session.query(MyTable).\ filter(MyTable.myset == cast(z, ARRAY(String))).\ all() Unfortunately, that doesn't work.

Re: [sqlalchemy] No operator matches the given name and argument filtering on postgres array

2013-12-10 Thread Matthew Pounsett
On Tuesday, 10 December 2013 03:29:48 UTC-5, Matthew Pounsett wrote: On Tuesday, 10 December 2013 01:00:51 UTC-5, Michael Bayer wrote: that’s a little strange but you can get around it using CAST: match = session.query(MyTable).\ filter(MyTable.myset == cast(z, ARRAY(String

Re: [sqlalchemy] No operator matches the given name and argument filtering on postgres array

2013-12-10 Thread Matthew Pounsett
On Tuesday, 10 December 2013 10:00:20 UTC-5, Michael Bayer wrote: the test case I’m using is below. You might want to make sure you’re on the latest psycopg2, this is also SQLAlchemy 0.8.4 but the SQL output seems the same. Overall, if maybe you’re on an older postgresql version, you

[sqlalchemy] No operator matches the given name and argument filtering on postgres array

2013-12-09 Thread Matthew Pounsett
I'm trying to work with the postgres ARRAY type and I'm having a hard time figuring out what I'm doing wrong with filtering queries on the array column. Here's some sample code, omitting the session setup: class MyTable(Base):

Re: [sqlalchemy] hybrid_property returning a python type

2013-07-29 Thread Matthew Pounsett
On Thursday, 25 July 2013 11:39:23 UTC-4, Michael Bayer wrote: But your backend isn't doing this; if you were using Postgresql for example, it should be returning a timedelta() already. So perhaps this is MySQL. you'd need to make a TypeDecorator that receives this integer and does

Re: [sqlalchemy] hybrid_property returning a python type

2013-07-29 Thread Matthew Pounsett
On Monday, 29 July 2013 20:48:57 UTC-4, Matthew Pounsett wrote: I think I understand the mechanism here... except that since this isn't a real type (there's no data store behind this) is process_bind_param() useful at all? To answer my own question... yes, of course it does because

[sqlalchemy] hybrid_property returning a python type

2013-07-25 Thread Matthew Pounsett
I have a class with 'start' and 'finish' attributes which are DateTime columns. I'm trying to create a hybrid property 'duration' which returns the delta as a datetime.timedelta object. This is working fine for the instance attribute, but I can't seem to get it to work for the class

[sqlalchemy] filtering by variable attribute names

2013-07-23 Thread Matthew Pounsett
Does the ORM allow for filtering by a variable attribute name? I found this discussion using raw SQL: https://groups.google.com/d/topic/sqlalchemy/Axa-0thwOR8/discussion But the suggestion doesn't seem to apply in my case. Some sample code to demonstrate what I'm trying based on the above

Re: [sqlalchemy] filtering by variable attribute names

2013-07-23 Thread Matthew Pounsett
On Tuesday, 23 July 2013 04:16:24 UTC-4, Simon King wrote: You can use the standard python getattr function for this: Ah, of course. That should have occurred to me to try. Thanks, works like a charm! -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] Inverting the like() operation

2012-03-12 Thread Matthew Pounsett
On Monday, 12 March 2012 01:35:10 UTC-4, Michael Bayer wrote: both the left and right sides of an expression are ultimately represented as SQLAlchemy ColumnElements. When you say somecol == 'somestr', the 'somestr' part is coerced into a literal object as a result of it being pulled into

[sqlalchemy] Inverting the like() operation

2012-03-11 Thread Matthew Pounsett
I'm having a tough time figuring out how to manage this, and I don't think I know enough about what the end result might look like to be able to google it successfully. I'm trying to invert the sense of the like() operation in an unusual way. Rather than doing 'not like()' I want to take the