---
title: Understanding the ‘read’ Keyword in Assette Data Blocks
description: "In Assette, the read keyword is a core function used to retrieve data from saved Data Blocks. This function is fundamental to constructing dynamic and data-driven content within Assette’s reporting environment. Whether you are developing fund factsheets, client reports, or…"
url: "https://learn.assette.com/docs/the-read-keyword/"
updated: "2025-06-12"
category: Developers / Developer Tools / Data Block Editor / Data Block Keywords
---

# Understanding the ‘read’ Keyword in Assette Data Blocks

In Assette, the read keyword is a core function used to retrieve data from saved Data Blocks. This function is fundamental to constructing dynamic and data-driven content within Assette’s reporting environment. Whether you are developing fund factsheets, client reports, or internal dashboards, read plays a critical role in enabling data access and reusability across the platform.

This article explains how the read function works, its syntax, return structure, and how to apply it effectively in your own Data Block scripting.

## Purpose of "read"

The `read` function enables one Data Block to access and reuse the data output of another Data Block. This allows authors to:

- Centralize data logic in one location for reuse across multiple deliverables.
- Reduce duplication and improve maintainability of business rules.
- Ensure consistent data definitions across reporting components.

In practice, you will use `read` when a Data Block depends on the output from a previously defined or published Data Block.

## Syntax and Structure

The general syntax of the `read` function is as follows:

```
result = read("<DataBlockName>", <params>)
```

`<DataBlockName>` is a string representing the exact name of the saved or published Data Block you want to read from.

`<params>` is a dictionary of input parameters that may be required by the target Data Block. If the Data Block does not require parameters, an empty dictionary `{}` should be passed.

## Return Value

The `read` function returns a **dictionary** that contains all the named outputs of the target Data Block. Each key in this dictionary corresponds to a named item in the `response` object of the source Data Block.

To access a specific output, you use `.get("<key>")`, where `<key>` matches the key used in the response definition of the original Data Block.

## Example Usage

Consider the following line of code:

```
ProductCountryMapping = read("ProductOfferCountryLocal", {}).get("data") or []
```

**`read("ProductOfferCountryLocal", {})`**: This retrieves the output dictionary from a Data Block named `ProductOfferCountryLocal`. No parameters are passed, as indicated by the empty dictionary.

**`.get("data")`**: This accesses the `data` key from the response dictionary. In the original Data Block (`ProductOfferCountryLocal`), there must be a line like `response["data"] = some_dataframe_or_list`.

**`or []`**: This is a fallback mechanism to ensure that if the `data` key is missing or the read fails, an empty list is returned. This helps prevent errors in downstream logic, though not required.

## Error Handling

If the Data Block name is misspelled, unpublished, or if required parameters are not passed, the `read` call may return `None` or an empty dictionary. In such cases, using `.get(<key>) or <fallback>` ensures stability.

Additionally, runtime errors from the source Data Block (e.g., logic errors or data issues) can propagate silently. Always validate the upstream Data Block independently.

## Best Practices

To use the `read` function effectively:

- Always verify that the target Data Block is saved and published.
- Ensure parameter names and types match the expectations of the target Data Block.
- Use `or []` or `or pd.DataFrame()` (depending on expected structure) to guard against null returns.
- Avoid circular references—one Data Block should not call another that directly or indirectly calls it back.
