equal_any() DB API helper produces incorrect SQL query
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Undecided
|
Roman Podoliaka |
Bug Description
Given an attribute name and a list of values equal_any() is meant to produce a WHERE clause which returns rows for which the column (denoted by an attribute of an SQLAlchemy model) is equal to ANY of passed values that involves using of SQL OR operator. In fact, AND operator is used to combine equality expressions.
E.g. for a model:
class Instance(
__tablename__ = 'instances'
id = sa.Column('id', sa.Integer, primary_key=True)
...
task_state = sa.Column(
using of equal_any():
q = model_query(
constraint = Constraint(
q = constraint.
will produce:
SELECT * from instances
WHERE task_state = 'error' AND task_state = 'deleting'
instead of expected:
SELECT * from instances
WHERE task_state = 'error' OR task_state = 'deleting'
Changed in nova: | |
assignee: | nobody → Roman Podoliaka (rpodolyaka) |
Changed in nova: | |
milestone: | none → icehouse-rc1 |
Changed in nova: | |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | icehouse-rc1 → 2014.1 |
Fix proposed to branch: master /review. openstack. org/80431
Review: https:/