Filtering
cognite.pygen.config.Filtering
dataclass
The type of filters to use for each property type.
When pygen generates, for example, a list or timeseries method, it uses the type of the property to determine which
filters to implement. For example, if you have two properties, year
of type Int32 and name
of type Text,
and you generate a list method with the default options, you will get the following filters:
class MyAPIClass:
...
def list(self,
min_year: int | None = None,
max_year: int | None = None,
name: str | list[str] | None = None,
name_prefix: str | None = None,
external_id_prefix: str | None = None,
):
...
Not supported properties
Currently primitive type properties and one-to-one edges are supported. If you have a list of primitive types, e.g., list of strings, it will not be used to generate filters. One-to-many edges will also not be used to create filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
integer
|
tuple[type[Filter], ...]
|
Filters to use for integer properties. |
(Range)
|
boolean
|
tuple[type[Filter], ...]
|
Filters to use for boolean properties. |
(Equals)
|
float
|
tuple[type[Filter], ...]
|
Filters to use for float properties. |
(Range)
|
date
|
tuple[type[Filter], ...]
|
Filters to use for date properties. |
(Range)
|
datetime
|
tuple[type[Filter], ...]
|
Filters to use for datetime properties. |
(Range)
|
string
|
tuple[type[Filter], ...]
|
Filters to use for string properties. |
(Equals, In, Prefix)
|
edge_one_to_one
|
tuple[type[Filter], ...]
|
Filters to use for one-to-one edges, i.e., direct references to other resources. |
(Equals, In)
|
by_name
|
dict[str, tuple[type[Filter], ...]]
|
Filters to use for properties with a specific name. This overwrites the default filters for the property with the given name. |
lambda: {'externalId': (Prefix), 'space': (Equals, In)}()
|