| id | add-data-to-dataset |
|---|---|
| title | Add data to dataset |
import ApiLink from '@site/src/components/ApiLink'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import RunnableCodeBlock from '@site/src/components/RunnableCodeBlock';
import BeautifulSoupExample from '!!raw-loader!roa-loader!./code_examples/add_data_to_dataset_bs.py'; import PlaywrightExample from '!!raw-loader!roa-loader!./code_examples/add_data_to_dataset_pw.py'; import DatasetExample from '!!raw-loader!roa-loader!./code_examples/add_data_to_dataset_dataset.py';
This example demonstrates how to store extracted data into datasets using the context.push_data helper function. If the specified dataset does not already exist, it will be created automatically. Additionally, you can save data to custom datasets by providing dataset_id or dataset_name parameters to the push_data function.
Each item in the dataset will be stored in its own file within the following directory:
{PROJECT_FOLDER}/storage/datasets/default/
For more control, you can also open a dataset manually using the asynchronous constructor Dataset.open