GetEntityRecordsCommand

This API is used to query preview data from a given connection type or from a native Amazon S3 based Glue Data Catalog.

Returns records as an array of JSON blobs. Each record is formatted using Jackson JsonNode based on the field type defined by the DescribeEntity API.

Spark connectors generate schemas according to the same data type mapping as in the DescribeEntity API. Spark connectors convert data to the appropriate data types matching the schema when returning rows.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GlueClient, GetEntityRecordsCommand } from "@aws-sdk/client-glue"; // ES Modules import
// const { GlueClient, GetEntityRecordsCommand } = require("@aws-sdk/client-glue"); // CommonJS import
const client = new GlueClient(config);
const input = { // GetEntityRecordsRequest
  ConnectionName: "STRING_VALUE",
  CatalogId: "STRING_VALUE",
  EntityName: "STRING_VALUE", // required
  NextToken: "STRING_VALUE",
  DataStoreApiVersion: "STRING_VALUE",
  ConnectionOptions: { // ConnectionOptions
    "<keys>": "STRING_VALUE",
  },
  FilterPredicate: "STRING_VALUE",
  Limit: Number("long"), // required
  OrderBy: "STRING_VALUE",
  SelectedFields: [ // SelectedFields
    "STRING_VALUE",
  ],
};
const command = new GetEntityRecordsCommand(input);
const response = await client.send(command);
// { // GetEntityRecordsResponse
//   Records: [ // Records
//     "DOCUMENT_VALUE",
//   ],
//   NextToken: "STRING_VALUE",
// };

GetEntityRecordsCommand Input

See GetEntityRecordsCommandInput for more details

Parameter
Type
Description
EntityName
Required
string | undefined

Name of the entity that we want to query the preview data from the given connection type.

Limit
Required
number | undefined

Limits the number of records fetched with the request.

CatalogId
string | undefined

The catalog ID of the catalog that contains the connection. This can be null, By default, the Amazon Web Services Account ID is the catalog ID.

ConnectionName
string | undefined

The name of the connection that contains the connection type credentials.

ConnectionOptions
Record<string, string> | undefined

Connector options that are required to query the data.

DataStoreApiVersion
string | undefined

The API version of the SaaS connector.

FilterPredicate
string | undefined

A filter predicate that you can apply in the query request.

NextToken
string | undefined

A continuation token, included if this is a continuation call.

OrderBy
string | undefined

A parameter that orders the response preview data.

SelectedFields
string[] | undefined

List of fields that we want to fetch as part of preview data.

GetEntityRecordsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
NextToken
string | undefined

A continuation token, present if the current segment is not the last.

Records
__DocumentType[] | undefined

A list of the requested objects.

Throws

Name
Fault
Details
AccessDeniedException
client

Access to a resource was denied.

EntityNotFoundException
client

A specified entity does not exist

FederationSourceException
client

A federation source failed.

GlueEncryptionException
client

An encryption operation failed.

InvalidInputException
client

The input provided was not valid.

OperationTimeoutException
client

The operation timed out.

ValidationException
client

A value could not be validated.

GlueServiceException
Base exception class for all service exceptions from Glue service.