R object
R
Helper class to construct complex RQL queries.
Usage:
rql = R(field='value', field2__in=('v1', 'v2'), field3__empty=True)
Note
All the lookups expressed as keyword arguments are combined together with a logical and.
Using the n method:
rql = (
R().n('field').eq('value')
& R().n('field2').anyof(('v1', 'v2'))
& R().n('field3').empty(True)
)
The previous query can be expressed in a more concise form like:
rql = R().field.eq('value') & R().field2.anyof(('v1', 'v2')) & r.field3.empty(True)
The R object support the bitwise operators &, | and ~.
Nested fields can be expressed using dot notation:
rql = R().n('nested.field').eq('value')
or
rql = R().nested.field.eq('value')
empty(value: List[str])
Apply the empty operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
list[str]
|
The value to which compare the field. |
required |
eq(value)
Apply the eq operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
str
|
The value to which compare the field. |
required |
ge(value)
Apply the ge operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
str
|
The value to which compare the field. |
required |
gt(value)
Apply the gt operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
str
|
The value to which compare the field. |
required |
ilike(value: List[str])
Apply the ilike operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
list[str]
|
The value to which compare the field. |
required |
le(value)
Apply the le operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
str
|
The value to which compare the field. |
required |
like(value: List[str])
Apply the like operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
list[str]
|
The value to which compare the field. |
required |
lt(value)
Apply the lt operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
str
|
The value to which compare the field. |
required |
n(name)
Set the current field for this R object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
Name of the field. |
required |
ne(value)
Apply the ne operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
str
|
The value to which compare the field. |
required |
null(value: List[str])
Apply the null operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
list[str]
|
The value to which compare the field. |
required |
oneof(value: List[str])
Apply the in operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
list[str]
|
The list of values to which compare the field. |
required |
out(value: List[str])
Apply the out operator to the field this R object refers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value |
list[str]
|
The list of values to which compare the field. |
required |