...
- filter: Defines an expression to evaluate for each type. When the expression evaluates as true, that type is fetched.
- limit: Fetch only 'limit' results. Can be useful to debug a fetch which might grab a lot of results.
- include: Define specific properties of the Type to include in the fetch result. If not defined, all properties will be grabbed.
- order: An expression which defines the order to return the results in.
Here is a list of C3 documentation mentioning fetching:
...
Examples of Fetch operations
Consider the DTI housing example located here: https://
...
...
...
In this example, the Type BlockInfo defines information aggregated about census blocks. We can for example, fetch BlockInfo
types for which the 'prp_bf_lr' property is defined. Then we can order them based on their 'id' properly.
Code Block | ||
---|---|---|
| ||
BlockInfo.fetch({
'limit': -1,
'filter': 'exists(prp_bf_lr)',
'order': 'descending(id)',
'include': 'pct_i_l,pct_t_l,prp_res_lr,pop10_ha_lr,hu10_ha_lr,eroom_ha_lr,med10_age,prp_bf_lr',
}) |
Here's how you would perform the same fetch in python
...
:
Code Block | ||
---|---|---|
| ||
from c3python import get_c3
raw_df = c3.BlockInfo.fetch(spec={
'limit': -1,
'filter': 'exists(prp_bf_lr)',
'order': 'descending(id)',
'include': 'pct_i_l,pct_t_l,prp_res_lr,pop10_ha_lr,hu10_ha_lr,eroom_ha_lr,med10_age,prp_bf_lr'
}) |
Here is a list of C3 documentation mentioning fetching:
- FetchSpec Documentation: https://developer.c3.ai/docs/7.12.0/type/FetchSpec
- Fetching in Python: https://developer.c3.ai/docs/7.12.0/topic/ds-jupyter-notebooks
Converting Fetch results to usable forms in Jupyter Notebook
...