Skip to content

get_entity_records

get_entity_records(
    entity_name: EntityName,
    limit: Limit,
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    connection_name: Optional[NameString] = None,
    catalog_id: Optional[CatalogIdString] = None,
    next_token: Optional[NextToken] = None,
    data_store_api_version: Optional[ApiVersion] = None,
    connection_options: Optional[ConnectionOptions] = None,
    filter_predicate: Optional[FilterPredicate] = None,
    order_by: Optional[str] = None,
    selected_fields: Optional[SelectedFields] = None,
) -> GetEntityRecordsResponse

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.

Parameters:

  • connection_name (Optional[NameString], default: None ) –

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

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

    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.

  • entity_name (EntityName) –

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

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

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

  • data_store_api_version (Optional[ApiVersion], default: None ) –

    The API version of the SaaS connector.

  • connection_options (Optional[ConnectionOptions], default: None ) –

    Connector options that are required to query the data.

  • filter_predicate (Optional[FilterPredicate], default: None ) –

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

  • limit (Limit) –

    Limits the number of records fetched with the request.

  • order_by (Optional[str], default: None ) –

    A parameter that orders the response preview data.

  • selected_fields (Optional[SelectedFields], default: None ) –

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

Raises:

Source code in docs_src/capo_glue/_services/glue.py
def get_entity_records(
    self,
    entity_name: "capo_glue.types.entity_name.EntityName",
    limit: "capo_glue.types.limit.Limit",
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    connection_name: Optional["capo_glue.types.name_string.NameString"] = None,
    catalog_id: Optional[
        "capo_glue.types.catalog_id_string.CatalogIdString"
    ] = None,
    next_token: Optional["capo_glue.types.next_token.NextToken"] = None,
    data_store_api_version: Optional[
        "capo_glue.types.api_version.ApiVersion"
    ] = None,
    connection_options: Optional[
        "capo_glue.types.connection_options.ConnectionOptions"
    ] = None,
    filter_predicate: Optional[
        "capo_glue.types.filter_predicate.FilterPredicate"
    ] = None,
    order_by: Optional[str] = None,
    selected_fields: Optional[
        "capo_glue.types.selected_fields.SelectedFields"
    ] = None,
) -> "capo_glue.types.get_entity_records_response.GetEntityRecordsResponse":
    """<p>This API is used to query preview data from a given connection type or from a native Amazon S3 based Glue Data Catalog.</p> <p>Returns records as an array of JSON blobs. Each record is formatted using Jackson JsonNode based on the field type defined by the <code>DescribeEntity</code> API.</p> <p>Spark connectors generate schemas according to the same data type mapping as in the <code>DescribeEntity</code> API. Spark connectors convert data to the appropriate data types matching the schema when returning rows.</p>

    Args:
        connection_name: <p>The name of the connection that contains the connection type credentials.</p>
        catalog_id: <p>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.</p>
        entity_name: <p>Name of the entity that we want to query the preview data from the given connection type.</p>
        next_token: <p>A continuation token, included if this is a continuation call.</p>
        data_store_api_version: <p>The API version of the SaaS connector.</p>
        connection_options: <p>Connector options that are required to query the data.</p>
        filter_predicate: <p>A filter predicate that you can apply in the query request.</p>
        limit: <p>Limits the number of records fetched with the request.</p>
        order_by: <p>A parameter that orders the response preview data.</p>
        selected_fields: <p> List of fields that we want to fetch as part of preview data.</p>

    Raises:
        capo_glue.errors.access_denied_exception.AccessDeniedException: <p>Access to a resource was denied.</p>
        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.glue_encryption_exception.GlueEncryptionException: <p>An encryption operation failed.</p>
        capo_glue.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_glue.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_glue.errors.validation_exception.ValidationException: <p>A value could not be validated.</p>
        capo_glue.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_glue.types.get_entity_records_request.GetEntityRecordsRequest]",
    ) -> OperationResponse[
        "capo_glue.types.get_entity_records_response.GetEntityRecordsResponse"
    ]:
        import capo_glue._operations.aws_glue.get_entity_records

        output, http_response = (
            capo_glue._operations.aws_glue.get_entity_records.get_entity_records(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_glue.types.get_entity_records_response.GetEntityRecordsResponse",
    ) -> dict[str, Any]:
        import capo_glue.types.get_entity_records_response

        return capo_glue.types.get_entity_records_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetEntityRecords", redact_output=_redact_output),
    )
    input_: capo_glue.types.get_entity_records_request.GetEntityRecordsRequest = {
        "entity_name": entity_name,
        "limit": limit,
    }
    if connection_name is not None:
        input_["connection_name"] = connection_name
    if catalog_id is not None:
        input_["catalog_id"] = catalog_id
    if next_token is not None:
        input_["next_token"] = next_token
    if data_store_api_version is not None:
        input_["data_store_api_version"] = data_store_api_version
    if connection_options is not None:
        input_["connection_options"] = connection_options
    if filter_predicate is not None:
        input_["filter_predicate"] = filter_predicate
    if order_by is not None:
        input_["order_by"] = order_by
    if selected_fields is not None:
        input_["selected_fields"] = selected_fields

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output