cf.Query.addattr

Query.addattr(attr)[source]

Redefine the query to be on an object’s attribute.

If another attribute has previously been specified, then the new attribute is considered to be an attribute of the existing attribute.

See also

attr

Parameters:
attr: str

The attribute name.

Returns:
Query

The new query object.

Examples

>>> q = cf.eq(2001)
>>> q
<CF Query: (eq 2001)>
>>> q = q.addattr('year')
>>> q
<CF Query: year(eq 2001)>
>>> q = cf.lt(2)
>>> q = q.addattr('A')
>>> q = q.addattr('B')
>>> q
<CF Query: A.B(lt 2)>
>>> q = q.addattr('C')
>>> q
<CF Query: A.B.C(lt 2)>