---
schema_version: "1"
id: a1b5b63f8a6fb0a11e06fe608f591148ec80610dd27ff954292c594e4dacbf2e
title: Read Zero-Copy Data in Code Extension
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-code-ext/guides/read-zero-copy-sources.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/read-zero-copy-sources.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9004425df6e1af5f0c551c01e93e59a6d903ab32d120c0787c10f8eee5d3ec2c
products:
  - Data 360 Code Extension Guide
  - Data 360 Developer Documentation
---
# Read Zero-Copy Data in Code Extension 

Write code extension scripts that read a data lake object (DLO) backed by a zero-copy connector or a data model object (DMO) mapped from that DLO. Because the connector accesses data directly on its external platform, Data 360 never copies the data into local storage. Your code extension scripts perform the same custom Python transformations on zero copy data as on any other  DLO or DMO in Data 360\.  
   
A zero-copy source is an external data platform that Data 360 accesses through a zero-copy connector. The connector accesses the data in place by using query federation or file federation. The available methods depend on the connector. If a connector offers both methods, select the preferred option when you set up the connection and the data stream. 

For the federation methods that each connector supports, see [Supported Zero-Copy Sources](#supported-zero-copy-sources). For concepts, billing, and caching behavior, see [Zero Copy Data Federation](https://help.salesforce.com/s/articleView?id=data.c360_a_byol_data_federation.htm&type=5). To compare the methods, see [Compare Data Federation Methods](https://help.salesforce.com/s/articleView?id=data.c260_a_data_federation_compare_methods.htm&type=5). 

| Edition Table |
| :---- |
| Available in: **Developer**, **Enterprise**, **Performance**, and **Unlimited** Editions. See [Data 360 edition availability](https://help.salesforce.com/s/articleView?id=sf.c360_a_dc_editions.htm&type=5). |

| Permission Sets Needed |  |
| :---- | :---- |
| To access zero-copy data in code extension scripts: | Permission set: Data Cloud Architect  |

## Supported Zero-Copy Sources

Code extension supports reading data from these zero-copy sources.

| Data Platform | Query Federation | File Federation |
| :---- | :---- | :---- |
| Snowflake | Supported | Supported |
| Amazon Redshift | Supported | Not offered by the connector |
| Databricks | Supported | Supported |
| Google BigQuery | Supported | Not offered by the connector |

## Prerequisites

- Set up a supported zero-copy connector and create the federated data stream that generates the DLO. The connector documentation covers query federation and file federation setup for each platform.  
  - [Snowflake Connector](https://developer.salesforce.com/docs/data/data-cloud-int/guide/c360-a-snowflake-connector.html)  
  - [Amazon Redshift Connector](https://developer.salesforce.com/docs/data/data-cloud-int/guide/c360-a-redshift-connector.html)  
  - [Databricks Connector](https://developer.salesforce.com/docs/data/data-cloud-int/guide/c360-a-databricks-connector.html)  
  - [Google BigQuery Connector](https://developer.salesforce.com/docs/data/data-cloud-int/guide/c360-a-bigquery-connector.html)  
- Assign the zero-copy DLO to a data space that your code extension script can access. Select the data space when you create the federated data stream, or add the DLO to a data space later from the Data Spaces tab. See [Add Data to a Data Space Using Data Lake Objects](https://help.salesforce.com/s/articleView?id=data.c360_a_add_data_lake_objects_to_a_data_space.htm&type=5).  
- If your script reads DMOs, map the zero-copy DLO to a DMO in that data space. See [Data Mapping](https://help.salesforce.com/s/articleView?id=data.c360_a_data_mapping.htm&type=5).  
- Set up Salesforce CLI with the Code Extension plugin, and initialize a script package. See [Set Up Salesforce CLI for Code Extension](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/set-up-sdk.md).

## Reading Zero-Copy DLOs or DMOs

Your code extension script reads a zero-copy DLO with the same `read_dlo()` method that it uses for any other DLO. Similarly, it reads a DMO mapped from a zero-copy DLO with the same method that it uses for other DMOs. Whether the connector federates the data from the zero-copy source or a data stream ingests it into Data 360, your Python code requires no special configuration.

Your script can read and join multiple DLOs. For example, join a zero-copy DLO with a DLO ingested from Salesforce CRM via a data stream. You can perform the same action with multiple DMOs. A single script works with either DLOs or DMOs, but not both. Your script writes results to a target DLO or DMO in Data 360, not back to the external platform.

For write modes and general authoring guidance, see [Write and Validate Custom Scripts](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/author-custom-script.md).

## Considerations

- **Performance:** Query performance depends on the external platform’s processing power and network latency between Data 360 and the external platform. To optimize performance, apply filters early, don’t read entire large tables when you need only a subset, and review execution logs for bottlenecks. See also [Considerations When Writing Code Extension](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/considerations-when-writing-custom-code.md).  
- **Data Freshness and Caching:** Federated reads follow zerocopy data federation behavior in Data 360\. See [Caching or Acceleration in Data Federation](https://help.salesforce.com/s/articleView?id=data.c360_a_accelerated_data_lake_objects.htm&type=5).  
- **Platform Constraints:** Connector-specific limits and behaviors apply. Check the connector documentation for your platform.  
- **Sandbox Validation:** Validate scripts that read zero-copy data in a sandbox before you migrate them to production. See [Use Custom Scripts in Data 360](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/use-custom-script.md).

## Troubleshooting

If your code extension script can’t read from a zero-copy DLO, check these items.

- Confirm that the zero-copy data stream is active and that authentication for the connector is valid.  
- Confirm that the zero-copy DLO, or the DMO mapped from it, is added to the specific data space that your script accesses.  
- Confirm that the source table still exists on your external platform and that your connector credentials have read access to it. For example, a Snowflake query federation connection requires `USAGE` privileges on the warehouse, database, and schema, and `SELECT` privileges on the tables in that schema. See [Set Up a Snowflake Data Federation Connection](https://developer.salesforce.com/docs/data/data-cloud-int/guide/c360-a-set-up-data-federation-snowflake-connection.html).  
- Confirm that the source object for a file federation DLO is a table and not a view. File federation doesn't support querying Apache Iceberg views. Check the file federation connection documentation for your platform.  
- Review code extension execution logs. See [Query Code Extension Logs by Using Salesforce CLI](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/query-logs-cli.md), [Query Code Extension Logs by Using Query Editor](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/query-logs-queryeditor.md), or [Monitor Code Extension Deployments and Execution History](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/view-deployment-details.md).

## Next Steps

- [Write and Validate Custom Scripts](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/author-custom-script.md)  
- [Deploy a Custom Script to Data 360 Sandbox by Using UI](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/deploy-custom-code.md)

## See Also

- [*Salesforce Help*: Zero Copy Data Federation](https://help.salesforce.com/s/articleView?id=data.c360_a_byol_data_federation.htm&type=5)  
- [*Salesforce Help*: Compare Data Federation Methods](https://help.salesforce.com/s/articleView?id=data.c260_a_data_federation_compare_methods.htm&type=5)  
- [*Salesforce Help*: Billing Considerations for Data Federation](https://help.salesforce.com/s/articleView?id=data.c360_a_billing_considerations_for_data_federation.htm&type=5)  
- [*Salesforce Help*: Caching or Acceleration in Data Federation](https://help.salesforce.com/s/articleView?id=data.c360_a_accelerated_data_lake_objects.htm&type=5)  
- [Considerations When Writing Code Extension](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/considerations-when-writing-custom-code.html)

