getEntityRecords method
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.
May throw AccessDeniedException.
May throw EntityNotFoundException.
May throw FederationSourceException.
May throw GlueEncryptionException.
May throw InvalidInputException.
May throw OperationTimeoutException.
May throw ValidationException.
Parameter entityName :
Name of the entity that we want to query the preview data from the given
connection type.
Parameter limit :
Limits the number of records fetched with the request.
Parameter catalogId :
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.
Parameter connectionName :
The name of the connection that contains the connection type credentials.
Parameter connectionOptions :
Connector options that are required to query the data.
Parameter dataStoreApiVersion :
The API version of the SaaS connector.
Parameter filterPredicate :
A filter predicate that you can apply in the query request.
Parameter nextToken :
A continuation token, included if this is a continuation call.
Parameter orderBy :
A parameter that orders the response preview data.
Parameter selectedFields :
List of fields that we want to fetch as part of preview data.
Implementation
Future<GetEntityRecordsResponse> getEntityRecords({
required String entityName,
required int limit,
String? catalogId,
String? connectionName,
Map<String, String>? connectionOptions,
String? dataStoreApiVersion,
String? filterPredicate,
String? nextToken,
String? orderBy,
List<String>? selectedFields,
}) async {
_s.validateNumRange(
'limit',
limit,
1,
1000,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSGlue.GetEntityRecords'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'EntityName': entityName,
'Limit': limit,
if (catalogId != null) 'CatalogId': catalogId,
if (connectionName != null) 'ConnectionName': connectionName,
if (connectionOptions != null) 'ConnectionOptions': connectionOptions,
if (dataStoreApiVersion != null)
'DataStoreApiVersion': dataStoreApiVersion,
if (filterPredicate != null) 'FilterPredicate': filterPredicate,
if (nextToken != null) 'NextToken': nextToken,
if (orderBy != null) 'OrderBy': orderBy,
if (selectedFields != null) 'SelectedFields': selectedFields,
},
);
return GetEntityRecordsResponse.fromJson(jsonResponse.body);
}