cf.Query.addattr

Query.addattr(attr)[source]

Return a cf.Query object with a new left hand side operand attribute to be used during evaluation.

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

Parameters:
attr : str

The attribute name.

Returns:
out : cf.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)>

Previous topic

cf.Query.evaluate

Next topic

cf.Query.copy

This Page