You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3686206
Browse filesBrowse the repository at this point in the historyBrowse files
Sharing and cross-run usage were documented three times over, once per
storage type, and had drifted apart; this consolidates them into two
shared pages (Share storage, Use storage from another run) that the type
pages now link to. Along the way it corrects the storage rate limits
against `apify-core`.
---------
Co-authored-by: Edyta <142720610+szaganek@users.noreply.github.com>
Copy file name to clipboardExpand all lines: sources/platform/storage/dataset/index.md
+27-92Lines changed: 27 additions & 92 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,16 +6,13 @@ toc_max_heading_level: 4
6
6
slug: /storage/dataset
7
7
---
8
8
9
-
import Tabs from '@theme/Tabs';
10
-
import TabItem from '@theme/TabItem';
11
-
12
9
Dataset storage enables you to sequentially save and retrieve data. A unique dataset is automatically created and assigned to each Actor run when the first item is stored.
13
10
14
-
Typically, datasets comprise results from web scraping, crawling, and data processing jobs. You can visualize this data in a table, where each object is forming a row and its attributes are represented as columns. You have the option to export data in various formats, including JSON, CSV, XML, Excel, HTML Table, RSS or JSONL.
11
+
Typically, datasets hold results from web scraping, crawling, and data processing jobs. The data is displayed as a table, where each object forms a row and its attributes form columns. You can export the data in JSON, CSV, XML, Excel, HTML table, RSS, or JSONL formats.
15
12
16
13
:::info Retention period
17
14
18
-
Named datasets are retained indefinitely. Unnamed datasets expire after 7 days unless otherwise specified. [Learn more](/storage#named-and-unnamed-storages)
15
+
Named datasets are retained indefinitely. Unnamed datasets expire after 7 days unless otherwise specified. [Learn more](/storage#data-retention)
19
16
20
17
:::
21
18
@@ -36,7 +33,7 @@ Dataset schemas are defined in the Actor's `.actor` folder and apply to the Acto
36
33
37
34
You can access your datasets in several ways:
38
35
39
-
-[Apify Console](https://console.apify.com) - provides an easy-to-understand interface.
36
+
-[Apify Console](https://console.apify.com) - view and manage your datasets in a visual interface.
40
37
-[Apify API](/api/v2) - to access your datasets programmatically.
41
38
-[Apify API client](/api) - to access your datasets from any Node.js/Python application.
42
39
-[Apify SDKs](/sdk) - when building your own JavaScript/Python Actor.
@@ -45,21 +42,19 @@ You can access your datasets in several ways:
45
42
46
43
In [Apify Console](https://console.apify.com), you can view your datasets in the [Storage](https://console.apify.com/storage) section under the [Datasets](https://console.apify.com/storage?tab=datasets) tab.
47
44
48
-

45
+

49
46
50
47
To view or download a dataset:
51
48
52
49
1. Click on its **Dataset ID** to open the dataset detail page.
53
50
1. Browse the data in **Table** or **JSON** view.
54
51
1. Click **Export** to download the data in your preferred format.
55
52
56
-
Utilize the **Actions** menu to modify the dataset's name, which also affects its [retention period](/storage#data-retention), and to adjust [access rights](/account/collaboration). The **API** button allows you to explore and test the dataset's [API endpoints](/api/v2/storage-datasets).
To rename the dataset (which affects its [retention period](/storage#data-retention)) or adjust its [access rights](/account/collaboration), use the **Actions** menu. To view and test the dataset's [API endpoints](/api/v2/storage-datasets), select **API**.
59
54
60
55
### Apify API
61
56
62
-
The [Apify API](/api/v2/storage-datasets)enables you programmatic access to your datasets using [HTTP requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods).
57
+
The [Apify API](/api/v2/storage-datasets)gives you programmatic access to your datasets using [HTTP requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods).
63
58
64
59
If you are accessing your datasets using the `username~store-name`[store ID format](../index.md), you will need to use your secret API token. You can find the token (and your user ID) on the [API & Integrations](https://console.apify.com/settings/integrations) tab of **Settings** page of your Apify account.
65
60
@@ -115,11 +110,7 @@ To add data to a dataset, issue a POST request to the [Put items](/api/v2/datase
API data push to a dataset is capped at _400 requests per second_ to avoid overloading the servers.
121
-
122
-
:::
113
+
Pushes to a dataset are rate-limited. For details, see [Rate limiting](#rate-limiting).
123
114
124
115
Example payload:
125
116
@@ -141,11 +132,13 @@ For further details and a breakdown of each storage API endpoint, refer to the [
141
132
142
133
### Apify API Clients
143
134
135
+
Apify provides API clients for JavaScript and Python applications.
136
+
144
137
#### JavaScript API client
145
138
146
-
The [JavaScript API client](/api/client/js/reference/class/DatasetClient) (`apify-client`) enables you access to your datasets from any Node.js application, whether hosted on the Apify platform or externally.
139
+
With the [JavaScript API client](/api/client/js/reference/class/DatasetClient) (`apify-client`), you can access your datasets from any Node.js application, whether hosted on the Apify platform or externally.
147
140
148
-
After importing and initiating the client, you can save each dataset to a variable for easier access.
141
+
After importing and initializing the client, you can save each dataset to a variable for easier access.
@@ -163,9 +156,9 @@ Check out the [JavaScript API client documentation](/api/client/js/reference/cla
163
156
164
157
#### Python API client
165
158
166
-
The [Python API client](/api/client/python/reference/class/DatasetClient) (`apify-client`) enables you access to your datasets from any Python application, whether it is running on the Apify platform or externally.
159
+
With the [Python API client](/api/client/python/reference/class/DatasetClient) (`apify-client`), you can access your datasets from any Python application, whether it's running on the Apify platform or externally.
167
160
168
-
After importing and initiating the client, you can save each dataset to a variable for easier access.
161
+
After importing and initializing the client, you can save each dataset to a variable for easier access.
@@ -183,11 +176,13 @@ Check out the [Python API client documentation](/api/client/python/reference/cla
183
176
184
177
### Apify SDKs
185
178
179
+
Apify provides SDKs for JavaScript and Python Actors.
180
+
186
181
#### JavaScript SDK
187
182
188
-
When working with a JavaScript [Actor](../../actors/index.mdx), the [JavaScript SDK](/sdk/js/docs/guides/result-storage#dataset) is an essential tool, especially for dataset management. It simplifies the tasks of storing and retrieving data, seamlessly integrating with the Actor's workflow. Key features of the SDK include the ability to append data, retrieve what is stored, and manage dataset properties effectively. Central to this functionality is the [`Dataset`](/sdk/js/reference/class/Dataset) class. This class allows you to determine where your data is stored - locally or in the Apify cloud. To add data to your chosen datasets, use the [`pushData()`](/sdk/js/reference/class/Dataset#pushData) method.
183
+
In JavaScript [Actors](../../actors/index.mdx), manage datasets with the JavaScript SDK's [`Dataset`](/sdk/js/reference/class/Dataset) class. It works both locally and on the Apify platform. To add data, use the [`pushData()`](/sdk/js/reference/class/Dataset#pushData) method.
189
184
190
-
Additionally the SDK offers other methods like [`getData()`](/sdk/js/reference/class/Dataset#getData), [`map()`](/sdk/js/reference/class/Dataset#map), and [`reduce()`](/sdk/js/reference/class/Dataset#reduce). For practical applications of these methods, refer to the [example](/sdk/js/docs/examples/map-and-reduce) section.
185
+
The SDK also provides other methods like [`getData()`](/sdk/js/reference/class/Dataset#getData), [`map()`](/sdk/js/reference/class/Dataset#map), and [`reduce()`](/sdk/js/reference/class/Dataset#reduce). For practical applications of these methods, refer to the [example](/sdk/js/docs/examples/map-and-reduce) section.
191
186
192
187
If you have chosen to store your dataset locally, you can find it in the location below.
193
188
@@ -218,7 +213,7 @@ await Actor.exit();
218
213
219
214
:::caution Always await pushData()
220
215
221
-
It's crucial to use the `await` keyword when calling `pushData()`, to ensure data storage completes before the Actor process terminates.
216
+
Always use the `await` keyword when calling `pushData()`. Without it, the Actor process can exit before the data is stored.
Utilize the `fields` option in the [`getData()`](/sdk/js/reference/class/Dataset#getData) method to specify which data fields to retrieve. This option accepts an array of fields names (string) to include in your results.
238
+
To specify which data fields to retrieve, use the `fields` option in the [`getData()`](/sdk/js/reference/class/Dataset#getData) method. This option accepts an array of field names (string) to include in your results.
244
239
245
240
```js
246
241
import { Actor } from'apify';
@@ -263,7 +258,7 @@ Check out the [JavaScript SDK documentation](/sdk/js/docs/guides/result-storage#
263
258
264
259
#### Python SDK
265
260
266
-
For Python [Actors](../../actors/index.mdx), the [Python SDK](/sdk/python/docs/concepts/storages#working-with-datasets) is essential. The dataset is represented by a [`Dataset`](/sdk/python/reference/class/Dataset) class. You can use this class to specify whether your data is stored locally or in the Apify cloud and push data to the datasets of your choice using the [`push_data()`](/sdk/python/reference/class/Dataset#push_data) method. For further data manipulation you could also use other methods such as [`get_data()`](/sdk/python/reference/class/Dataset#get_data), [`map()`](/sdk/python/reference/class/Dataset#map) and [`reduce()`](/sdk/python/reference/class/Dataset#reduce).
261
+
In Python [Actors](../../actors/index.mdx), manage datasets with the Python SDK's [`Dataset`](/sdk/python/reference/class/Dataset) class. It works both locally and on the Apify platform. To add data, use [`push_data()`](/sdk/python/reference/class/Dataset#push_data); to read and transform it, use [`get_data()`](/sdk/python/reference/class/Dataset#get_data), [`map()`](/sdk/python/reference/class/Dataset#map), and [`reduce()`](/sdk/python/reference/class/Dataset#reduce).
267
262
268
263
For datasets stored locally, the data is located at the following path:
269
264
@@ -301,7 +296,7 @@ async def main():
301
296
await dataset.push_data({'foo': 'bar'})
302
297
```
303
298
304
-
Utilize the `fields` option in the [`get_data()`](/sdk/python/reference/class/Dataset#get_data) method to specify which data fields to retrieve. This option accepts an array of fields names (string) to include in your results.
299
+
To specify which data fields to retrieve, use the `fields` option in the [`get_data()`](/sdk/python/reference/class/Dataset#get_data) method. This option accepts an array of field names (string) to include in your results.
305
300
306
301
```python
307
302
from apify import Actor
@@ -378,7 +373,7 @@ becomes the following XML snippet:
378
373
</address>
379
374
```
380
375
381
-
In a JavaScript object, if a property is named `@`, its sub-properties are exported as attributes of the corresponding parent XML element. Additionally, when the parent XML element lacks child elements, its value is sourced from a property named `#` in the JavaScript Object.
376
+
In a JavaScript object, if a property is named `@`, its sub-properties are exported as attributes of the corresponding parent XML element. When the parent XML element lacks child elements, its value comes from a property named `#` in the JavaScript object.
382
377
383
378
For example, the following JavaScript object:
384
379
@@ -416,84 +411,24 @@ This feature is also useful when customizing your RSS feeds generated for variou
416
411
417
412
By default, the whole result is wrapped in an `<items/>` element, while each page object is contained in an `<item/>` element. You can change this using the `xmlRoot` and `xmlRow` URL parameters when retrieving your data with a GET request.
418
413
419
-
## Share
420
-
421
-
You can grant [access rights](/account/collaboration) to your dataset through the **Share** button under the **Actions** menu. For more details, check the [full list of permissions](/account/collaboration/list-of-permissions).
422
-
423
-
You can also share datasets by link using their ID or name, depending on your account or resource-level general access setting. Learn how link-based access works in [General resource access](/account/collaboration/general-resource-access).
424
-
425
-
For one-off sharing of specific records when access is restricted, you can generate time-limited pre-signed URLs. See [Sharing restricted resources with pre-signed URLs](/account/collaboration/general-resource-access#pre-signed-urls).
426
-
427
-
### Share datasets between runs
428
-
429
-
You can access a dataset from any [Actor](../../actors/index.mdx) or [task](../../actors/running/tasks.md) run as long as you know its _name_ or _ID_.
430
-
431
-
To access a dataset from another run using the [Apify SDK](/sdk), open it using the same method as you would with any other dataset.
In the [JavaScript API client](/api/client/js/reference/class/DatasetClient) as well as in [Python API client](/api/client/python/reference/class/DatasetClient) , you can access a dataset using its client. Once you've opened the dataset, you can read its contents and add new data in the same manner as you would for a dataset from your current run.
The same applies for the [Apify API](#apify-api) - you can use [the same endpoints](#apify-api) as you would normally do.
416
+
You can grant access rights to your dataset, share it by link, or generate a time-limited pre-signed URL for specific items. For details, see [Share storage](../share.md).
482
417
483
-
See the [Storage overview](/storage#share-storages-between-runs) for details on sharing storages between runs.
418
+
To read from or write to a dataset that belongs to a different Actor or task run, see [Use storage from another run](../use-from-another-run.md).
484
419
485
420
## Limits
486
421
487
422
- Data storage formats that use tabulation (like HTML, CSV, and Excel) are limited to a maximum of _2000_ columns. Data exceeding this limit will not be retrieved.
488
423
489
-
- The `pushData()`method is constrained by the receiving API's size limit. It accepts objects with JSON size under _9MB_. While individual objects within an array must not exceed _9MB_, the overall size has no restriction.
424
+
- The `pushData()`method is constrained by the receiving API's size limit. It accepts objects with JSON size under 9MB. While individual objects within an array must not exceed 9MB, the overall size has no restriction.
490
425
491
426
- The maximum length for dataset names is 63 characters.
492
427
493
428
### Rate limiting
494
429
495
430
The rate limit for pushing data to a dataset through the [API](/api/v2/dataset-items-post) is capped at _400 requests per second_ for each dataset, a measure to prevent overloading Apify servers.
496
431
497
-
For all other dataset [API endpoints](/api/v2/storage-datasets), the rate limit is _60 requests per second_ for each dataset.
432
+
For all other dataset [API endpoints](/api/v2/storage-datasets), the rate limit is 60 requests per second for each dataset.
498
433
499
434
Check out the [API documentation](/api/v2#rate-limiting) for more information and guidance on actions to take if you exceed these rate limits.
Copy file name to clipboardExpand all lines: sources/platform/storage/dataset/multiple_datasets.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: Multiple datasets
3
-
description: Learn how to use multiple datasets within your Actors to organize and store different types of data separately.
2
+
title: Use multiple datasets
3
+
description: Define more than one dataset in your Actor, write to each from your code, and surface them on the run page so users can find the right output.
Copy file name to clipboardExpand all lines: sources/platform/storage/dataset/validation.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Dataset validation
2
+
title: Validate dataset output
3
3
description: Specify the dataset schema within your Actors to add monitoring and validation at the field level, ensuring data quality and consistency across runs.
0 commit comments