getPartitions method
Retrieves information about the partitions in a table.
May throw EntityNotFoundException.
May throw FederationSourceException.
May throw FederationSourceRetryableException.
May throw GlueEncryptionException.
May throw InternalServiceException.
May throw InvalidInputException.
May throw InvalidStateException.
May throw OperationTimeoutException.
May throw ResourceNotReadyException.
Parameter databaseName :
The name of the catalog database where the partitions reside.
Parameter tableName :
The name of the partitions' table.
Parameter catalogId :
The ID of the Data Catalog where the partitions in question reside. If
none is provided, the Amazon Web Services account ID is used by default.
Parameter excludeColumnSchema :
When true, specifies not returning the partition column schema. Useful
when you are interested only in other partition attributes such as
partition values or location. This approach avoids the problem of a large
response by not returning duplicate data.
Parameter expression :
An expression that filters the partitions to be returned.
The expression uses SQL syntax similar to the SQL WHERE
filter clause. The SQL statement parser JSQLParser parses
the expression.
Operators: The following are the operators that you can use in the
Expression API call:
- =
-
Checks whether the values of the two operands are equal; if yes, then the
condition becomes true.
Example: Assume 'variable a' holds 10 and 'variable b' holds 20.
(a = b) is not true.
- < >
-
Checks whether the values of two operands are equal; if the values are not
equal, then the condition becomes true.
Example: (a < > b) is true.
- >
-
Checks whether the value of the left operand is greater than the value of
the right operand; if yes, then the condition becomes true.
Example: (a > b) is not true.
- <
-
Checks whether the value of the left operand is less than the value of the
right operand; if yes, then the condition becomes true.
Example: (a < b) is true.
- >=
-
Checks whether the value of the left operand is greater than or equal to
the value of the right operand; if yes, then the condition becomes true.
Example: (a >= b) is not true.
- <=
-
Checks whether the value of the left operand is less than or equal to the
value of the right operand; if yes, then the condition becomes true.
Example: (a <= b) is true.
- AND, OR, IN, BETWEEN, LIKE, NOT, IS NULL
- Logical operators.
-
string -
date -
timestamp -
int -
bigint -
long -
tinyint -
smallint -
decimal
The following list shows the valid operators on each type. When you define
a crawler, the partitionKey type is created as a
STRING, to be compatible with the catalog partitions.
Sample API Call:
Parameter maxResults :
The maximum number of partitions to return in a single response.
Parameter nextToken :
A continuation token, if this is not the first call to retrieve these
partitions.
Parameter queryAsOfTime :
The time as of when to read the partition contents. If not set, the most
recent transaction commit time will be used. Cannot be specified along
with TransactionId.
Parameter segment :
The segment of the table's partitions to scan in this request.
Parameter transactionId :
The transaction ID at which to read the partition contents.
Implementation
Future<GetPartitionsResponse> getPartitions({
required String databaseName,
required String tableName,
AuditContext? auditContext,
String? catalogId,
bool? excludeColumnSchema,
String? expression,
int? maxResults,
String? nextToken,
DateTime? queryAsOfTime,
Segment? segment,
String? transactionId,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
1000,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSGlue.GetPartitions'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'DatabaseName': databaseName,
'TableName': tableName,
if (auditContext != null) 'AuditContext': auditContext,
if (catalogId != null) 'CatalogId': catalogId,
if (excludeColumnSchema != null)
'ExcludeColumnSchema': excludeColumnSchema,
if (expression != null) 'Expression': expression,
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
if (queryAsOfTime != null)
'QueryAsOfTime': unixTimestampToJson(queryAsOfTime),
if (segment != null) 'Segment': segment,
if (transactionId != null) 'TransactionId': transactionId,
},
);
return GetPartitionsResponse.fromJson(jsonResponse.body);
}