Skip to content

get_partitions async

get_partitions(
    database_name: NameString,
    table_name: NameString,
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    catalog_id: Optional[CatalogIdString] = None,
    expression: Optional[PredicateString] = None,
    next_token: Optional[Token] = None,
    segment: Optional[Segment] = None,
    max_results: Optional[PageSize] = None,
    exclude_column_schema: Optional[BooleanNullable] = None,
    transaction_id: Optional[TransactionIdString] = None,
    query_as_of_time: Optional[Timestamp] = None,
    audit_context: Optional[AuditContext] = None,
) -> GetPartitionsResponse

Retrieves information about the partitions in a table.

Parameters:

  • catalog_id (Optional[CatalogIdString], default: None ) –

    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.

  • database_name (NameString) –

    The name of the catalog database where the partitions reside.

  • table_name (NameString) –

    The name of the partitions' table.

  • expression (Optional[PredicateString], default: None ) –

    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.

    Supported Partition Key Types: The following are the supported partition keys.

    • string

    • date

    • timestamp

    • int

    • bigint

    • long

    • tinyint

    • smallint

    • decimal

    If an type is encountered that is not valid, an exception is thrown.

    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:

  • next_token (Optional[Token], default: None ) –

    A continuation token, if this is not the first call to retrieve these partitions.

  • segment (Optional[Segment], default: None ) –

    The segment of the table's partitions to scan in this request.

  • max_results (Optional[PageSize], default: None ) –

    The maximum number of partitions to return in a single response.

  • exclude_column_schema (Optional[BooleanNullable], default: None ) –

    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.

  • transaction_id (Optional[TransactionIdString], default: None ) –

    The transaction ID at which to read the partition contents.

  • query_as_of_time (Optional[Timestamp], default: None ) –

    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.

Raises:

Source code in docs_src/capo_glue/_services/async_glue.py
async def get_partitions(
    self,
    database_name: "capo_glue.types.name_string.NameString",
    table_name: "capo_glue.types.name_string.NameString",
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    catalog_id: Optional[
        "capo_glue.types.catalog_id_string.CatalogIdString"
    ] = None,
    expression: Optional["capo_glue.types.predicate_string.PredicateString"] = None,
    next_token: Optional["capo_glue.types.token.Token"] = None,
    segment: Optional["capo_glue.types.segment.Segment"] = None,
    max_results: Optional["capo_glue.types.page_size.PageSize"] = None,
    exclude_column_schema: Optional[
        "capo_glue.types.boolean_nullable.BooleanNullable"
    ] = None,
    transaction_id: Optional[
        "capo_glue.types.transaction_id_string.TransactionIdString"
    ] = None,
    query_as_of_time: Optional["capo_glue.types.timestamp.Timestamp"] = None,
    audit_context: Optional["capo_glue.types.audit_context.AuditContext"] = None,
) -> "capo_glue.types.get_partitions_response.GetPartitionsResponse":
    """<p>Retrieves information about the partitions in a table.</p>

    Args:
        catalog_id: <p>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.</p>
        database_name: <p>The name of the catalog database where the partitions reside.</p>
        table_name: <p>The name of the partitions' table.</p>
        expression: <p>An expression that filters the partitions to be returned.</p> <p>The expression uses SQL syntax similar to the SQL <code>WHERE</code> filter clause. The SQL statement parser <a href="http://jsqlparser.sourceforge.net/home.php">JSQLParser</a> parses the expression. </p> <p> <i>Operators</i>: The following are the operators that you can use in the <code>Expression</code> API call:</p> <dl> <dt>=</dt> <dd> <p>Checks whether the values of the two operands are equal; if yes, then the condition becomes true.</p> <p>Example: Assume 'variable a' holds 10 and 'variable b' holds 20. </p> <p>(a = b) is not true.</p> </dd> <dt>< ></dt> <dd> <p>Checks whether the values of two operands are equal; if the values are not equal, then the condition becomes true.</p> <p>Example: (a < > b) is true.</p> </dd> <dt>></dt> <dd> <p>Checks whether the value of the left operand is greater than the value of the right operand; if yes, then the condition becomes true.</p> <p>Example: (a > b) is not true.</p> </dd> <dt><</dt> <dd> <p>Checks whether the value of the left operand is less than the value of the right operand; if yes, then the condition becomes true.</p> <p>Example: (a < b) is true.</p> </dd> <dt>>=</dt> <dd> <p>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.</p> <p>Example: (a >= b) is not true.</p> </dd> <dt><=</dt> <dd> <p>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.</p> <p>Example: (a <= b) is true.</p> </dd> <dt>AND, OR, IN, BETWEEN, LIKE, NOT, IS NULL</dt> <dd> <p>Logical operators.</p> </dd> </dl> <p> <i>Supported Partition Key Types</i>: The following are the supported partition keys.</p> <ul> <li> <p> <code>string</code> </p> </li> <li> <p> <code>date</code> </p> </li> <li> <p> <code>timestamp</code> </p> </li> <li> <p> <code>int</code> </p> </li> <li> <p> <code>bigint</code> </p> </li> <li> <p> <code>long</code> </p> </li> <li> <p> <code>tinyint</code> </p> </li> <li> <p> <code>smallint</code> </p> </li> <li> <p> <code>decimal</code> </p> </li> </ul> <p>If an type is encountered that is not valid, an exception is thrown. </p> <p>The following list shows the valid operators on each type. When you define a crawler, the <code>partitionKey</code> type is created as a <code>STRING</code>, to be compatible with the catalog partitions. </p> <p> <i>Sample API Call</i>: </p>
        next_token: <p>A continuation token, if this is not the first call to retrieve these partitions.</p>
        segment: <p>The segment of the table's partitions to scan in this request.</p>
        max_results: <p>The maximum number of partitions to return in a single response.</p>
        exclude_column_schema: <p>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.</p>
        transaction_id: <p>The transaction ID at which to read the partition contents.</p>
        query_as_of_time: <p>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 <code>TransactionId</code>.</p>

    Raises:
        capo_glue.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist</p>
        capo_glue.errors.federation_source_exception.FederationSourceException: <p>A federation source failed.</p>
        capo_glue.errors.federation_source_retryable_exception.FederationSourceRetryableException: <p>A federation source failed, but the operation may be retried.</p>
        capo_glue.errors.glue_encryption_exception.GlueEncryptionException: <p>An encryption operation failed.</p>
        capo_glue.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred.</p>
        capo_glue.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_glue.errors.invalid_state_exception.InvalidStateException: <p>An error that indicates your data is in an invalid state.</p>
        capo_glue.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_glue.errors.resource_not_ready_exception.ResourceNotReadyException: <p>A resource was not ready for a transaction.</p>
        capo_glue.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_glue.types.get_partitions_request.GetPartitionsRequest]",
    ) -> AsyncOperationResponse[
        "capo_glue.types.get_partitions_response.GetPartitionsResponse"
    ]:
        import capo_glue._operations.aws_glue.get_partitions

        (
            output,
            http_response,
        ) = await capo_glue._operations.aws_glue.get_partitions.async_get_partitions(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetPartitions")
    )
    input_: capo_glue.types.get_partitions_request.GetPartitionsRequest = {
        "database_name": database_name,
        "table_name": table_name,
    }
    if catalog_id is not None:
        input_["catalog_id"] = catalog_id
    if expression is not None:
        input_["expression"] = expression
    if next_token is not None:
        input_["next_token"] = next_token
    if segment is not None:
        input_["segment"] = segment
    if max_results is not None:
        input_["max_results"] = max_results
    if exclude_column_schema is not None:
        input_["exclude_column_schema"] = exclude_column_schema
    if transaction_id is not None:
        input_["transaction_id"] = transaction_id
    if query_as_of_time is not None:
        input_["query_as_of_time"] = query_as_of_time
    if audit_context is not None:
        input_["audit_context"] = audit_context

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output