GuidesTypeScript API ReferencePython v2 API Reference
Guides

How to get data from a versioned layer

You can request any version of data from a versioned layer. When you request a particular version of data from the versioned layer, the partition you receive in the response may have a lower version number than you requested. The version of a layer or partition represents the catalog version in which the layer or partition was last updated.

To get data from the versioned layer:

  1. Create the VersionedLayerClient object.

  2. Create the DataRequest object with the partition ID and fetch option. The default fetch option is OnlineIfNotFound. It queries the network if the requested resource is not found in the cache. If you want to skip cache lookups and query the network right away, set the withFetchOption method to OnlineOnly.

    const dataRequest = new DataRequest()
        .withPartitionId("PartitionId")
        .withBillingTag("MyBillingTag")
        .withFetchOption(FetchOptions.OnlineOnly);
  3. Call the getData method with the DataRequest parameter.

    const partitions = await versionedLayerClient.getData(dataRequest);

You receive data from the requested partition of the selected layer version.

In browser and Node.js, to abort requests before they have completed, you can create the AbortController object, and then add the AbortController.signal property to your requests. For more information, see the AbortController documentation.

Example:

const abortController = new AbortController();
const partitions = await versionedLayerClient.getData(
  dataRequest,
  abortController.signal
);