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. For concepts, billing, and caching behavior, see Zero Copy Data Federation. To compare the methods, see Compare Data Federation Methods.

Edition Table
Available in: Developer, Enterprise, Performance, and Unlimited Editions. See Data 360 edition availability.
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 PlatformQuery FederationFile Federation
SnowflakeSupportedSupported
Amazon RedshiftSupportedNot supported by code extension
DatabricksSupportedSupported
Google BigQuerySupportedNot offered by the connector

Prerequisites 

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.

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.
  • Data Freshness and Caching: Federated reads follow zerocopy data federation behavior in Data 360. See Caching or Acceleration in Data Federation.
  • 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.

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.
  • 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, Query Code Extension Logs by Using Query Editor, or Monitor Code Extension Deployments and Execution History.

Next Steps 

See Also