ilike (34)


SQLAlchemy with count, group_by and order_by using the ORM

I've got several function where I need to do a one-to-many join, using count(), group_by, and order_by. I'm using the sqlalchemy.select function to produce a query that will return me a set of id's,…


sqlalchemy, turning a list of IDs to a list of objects

I have sequence of IDs I want to retrieve. It's simple: session.query(Record).filter(Record.id.in_(seq)).all() Is there a better way to do it?…


java - Case-insensitive equals using Hibernate Criteria

I've seen Restrictions.ilike('property', '%value%'), but would like to generate SQL like: lower(property)='value'. Any ideas? I used: Restrictions.eq("email", email).ignoreCase() since Expressi…


PostgreSQL LIKE query performance variations

I have been seeing quite a large variation in response times regarding LIKE queries to a particular table in my database. Sometimes I will get results within 200-400 ms(very acceptable) but other tim…


ruby on rails - Case-insensitive search in Rails model

My product model contains some items Product.first=>#<Product id: 10, name: "Blue jeans">I'm now importing some product parameters from another dataset, but there are inconsistencies in the spe…


python - SQLAlchemy subquery-average of sums

is there any way how to write the following SQL statement in SQLAlchemy ORM: SELECT AVG(a1) FROM(SELECT sum(irterm.n) AS a1 FROM irterm GROUP BY irterm.item_id); Thank you…


java - Grails criteria projections-get rows count

I have Hotel entity: class Hotel{City city}Now, i need count of hotels with given city. It could be done in this way: def hotels=Hotel.findAllByCity(city) def cnt=hotels.size() But it's very d…


python - How do I construct a slightly more complex filter using or_ or and_ in sqlalchemy

I'm trying to do a very simple search from a list of terms terms=['term1', 'term2', 'term3'] How do I programmatically go through the list of terms and construct the "conditions" from the list of…



python - SQLAlchemy Relationship Filter?

can i do: table.relationship.filter( column=value)to get a subset of rows for relationships? and the same for order_by?…


How to config Many-to-many with condition, in Sqlalchemy

I'm use sqlalchemy 0.6.4. I have 2 classes: Question and Tag, they are many-to-many. class Question(Base):__tablename__="questions" id=Column(Integer, primary_key=True) deleted=Co…




sqlalchemy like query join relationship example postgres inner postgresql not