Skip to content

create_data_quality_evaluation_config

create_data_quality_evaluation_config(
    name: NameString,
    level: DataQualityEvaluationConfigLevel,
    data_source: DataQualityEvaluationConfigDataSource,
    role: RoleString,
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    ruleset_name: Optional[NameString] = None,
    managed_ruleset_name: Optional[DataQualityEvaluationConfigManagedRuleset] = None,
    triggers: Optional[DataQualityEvaluationConfigTriggers] = None,
    schedule_expression: Optional[DataQualityEvaluationConfigScheduleExpression] = None,
    start_at: Optional[Timestamp] = None,
    end_at: Optional[Timestamp] = None,
    number_of_workers: Optional[NullableInteger] = None,
    timeout: Optional[Timeout] = None,
    additional_run_options: Optional[
        DataQualityEvaluationConfigAdditionalRunOptions
    ] = None,
    additional_data_sources: Optional[DataSourceMap] = None,
    tags: Optional[TagsMap] = None,
    client_token: Optional[ClientTokenString] = None,
) -> CreateDataQualityEvaluationConfigResponse

Creates a data quality evaluation configuration, which evaluates the data quality of a collection of tables in the Glue Data Catalog once, on a schedule, or when table metadata changes. A configuration applies to a catalog, a database, or a single table, and evaluates every table in scope, including tables added later, without per-table setup.

When configurations at more than one level apply to the same table, the most specific configuration applies. Each table is evaluated at most once an hour, whichever triggers you choose.

Parameters:

  • name (NameString) –

    A name for the data quality evaluation configuration. The name must be unique within your account.

  • level (DataQualityEvaluationConfigLevel) –

    The Glue Data Catalog hierarchical level that the configuration applies to. Valid values are CATALOG, DATABASE, and TABLE.

  • data_source (DataQualityEvaluationConfigDataSource) –

    The catalog, database, or table that the configuration applies to, as specified by Level.

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

    The name of a Data Quality Definition Language (DQDL) ruleset, containing analyzers, rules, or both, to evaluate tables with. You create the ruleset using the CreateDataQualityRuleset API. Specify either RulesetName or ManagedRulesetName, not both.

  • managed_ruleset_name (Optional[DataQualityEvaluationConfigManagedRuleset], default: None ) –

    A built-in ruleset that profiles each table, used when RulesetName is not set. The default is SIMPLE. Choose from the following built-in rulesets:

    SIMPLE

    Row count and column count, completeness, minimum, and maximum for every column, mean, sum, and standard deviation for numeric columns, and column length for string columns.

    ADVANCED

    Every statistic in SIMPLE, plus distribution, uniqueness, and distinct values count.

  • triggers (Optional[DataQualityEvaluationConfigTriggers], default: None ) –

    When the configuration evaluates tables. You can choose one or more triggers, and each table is evaluated at most once an hour. The default is ONCE. Choose from the following triggers:

    ONCE

    Evaluates each table one time, including when tables are added to a database or catalog.

    SCHEDULE

    Evaluates each table on the cron or rate expression in ScheduleExpression, between the optional StartAt and EndAt times.

    METADATA_CHANGE

    Evaluates a table whenever its Glue Data Catalog metadata changes, such as a schema change or an Apache Iceberg commit.

  • schedule_expression (Optional[DataQualityEvaluationConfigScheduleExpression], default: None ) –

    A cron or rate expression, in UTC, for the SCHEDULE trigger, for example cron(0 6 * * ? *). The schedule can run at most once an hour.

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

    The time from which the schedule runs, inclusive.

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

    The time at which the schedule stops running, exclusive.

  • role (RoleString) –

    The IAM role that evaluations assume. You can specify the role name or the role Amazon Resource Name (ARN).

    The role must allow the glue.amazonaws.com service principal to assume it, and needs permissions to read the catalog (glue:GetCatalog, glue:GetDatabase, glue:GetTable, glue:SearchTables, and glue:GetPartitions), read and create rulesets (glue:GetDataQualityRuleset and glue:CreateDataQualityRuleset), start evaluations (glue:StartDataQualityRulesetEvaluationRun, glue:PublishDataQuality, and iam:PassRole on the role itself), read the tables' data in Amazon S3, and write logs to Amazon CloudWatch Logs. If a catalog-level or database-level configuration applies to an Amazon S3 Tables catalog, the role also needs s3tables:ListTableBuckets and s3tables:ListTables. If you use Lake Formation, the role needs the DESCRIBE permission on the tables.

  • number_of_workers (Optional[NullableInteger], default: None ) –

    The number of G.1X workers to be used in the run. The default is 5.

  • timeout (Optional[Timeout], default: None ) –

    The timeout for a run in minutes. This is the maximum time that a run can consume resources before it is terminated and enters TIMEOUT status. The default is 2,880 minutes (48 hours).

  • additional_run_options (Optional[DataQualityEvaluationConfigAdditionalRunOptions], default: None ) –

    Additional run options you can specify for an evaluation run.

  • additional_data_sources (Optional[DataSourceMap], default: None ) –

    A map of reference strings to additional data sources you can specify for an evaluation run.

  • tags (Optional[TagsMap], default: None ) –

    A list of tags applied to the data quality evaluation configuration.

  • client_token (Optional[ClientTokenString], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the operation completes no more than one time. If this token matches a previous request, the service ignores the request, but does not return an error.

Raises:

Source code in docs_src/capo_glue/_services/glue.py
def create_data_quality_evaluation_config(
    self,
    name: "capo_glue.types.name_string.NameString",
    level: "capo_glue.types.data_quality_evaluation_config_level.DataQualityEvaluationConfigLevel",
    data_source: "capo_glue.types.data_quality_evaluation_config_data_source.DataQualityEvaluationConfigDataSource",
    role: "capo_glue.types.role_string.RoleString",
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    ruleset_name: Optional["capo_glue.types.name_string.NameString"] = None,
    managed_ruleset_name: Optional[
        "capo_glue.types.data_quality_evaluation_config_managed_ruleset.DataQualityEvaluationConfigManagedRuleset"
    ] = None,
    triggers: Optional[
        "capo_glue.types.data_quality_evaluation_config_triggers.DataQualityEvaluationConfigTriggers"
    ] = None,
    schedule_expression: Optional[
        "capo_glue.types.data_quality_evaluation_config_schedule_expression.DataQualityEvaluationConfigScheduleExpression"
    ] = None,
    start_at: Optional["capo_glue.types.timestamp.Timestamp"] = None,
    end_at: Optional["capo_glue.types.timestamp.Timestamp"] = None,
    number_of_workers: Optional[
        "capo_glue.types.nullable_integer.NullableInteger"
    ] = None,
    timeout: Optional["capo_glue.types.timeout.Timeout"] = None,
    additional_run_options: Optional[
        "capo_glue.types.data_quality_evaluation_config_additional_run_options.DataQualityEvaluationConfigAdditionalRunOptions"
    ] = None,
    additional_data_sources: Optional[
        "capo_glue.types.data_source_map.DataSourceMap"
    ] = None,
    tags: Optional["capo_glue.types.tags_map.TagsMap"] = None,
    client_token: Optional[
        "capo_glue.types.client_token_string.ClientTokenString"
    ] = None,
) -> "capo_glue.types.create_data_quality_evaluation_config_response.CreateDataQualityEvaluationConfigResponse":
    """<p>Creates a data quality evaluation configuration, which evaluates the data quality of a collection of tables in the Glue Data Catalog once, on a schedule, or when table metadata changes. A configuration applies to a catalog, a database, or a single table, and evaluates every table in scope, including tables added later, without per-table setup.</p> <p>When configurations at more than one level apply to the same table, the most specific configuration applies. Each table is evaluated at most once an hour, whichever triggers you choose.</p>

    Args:
        name: <p>A name for the data quality evaluation configuration. The name must be unique within your account.</p>
        level: <p>The Glue Data Catalog hierarchical level that the configuration applies to. Valid values are <code>CATALOG</code>, <code>DATABASE</code>, and <code>TABLE</code>.</p>
        data_source: <p>The catalog, database, or table that the configuration applies to, as specified by <code>Level</code>.</p>
        ruleset_name: <p>The name of a Data Quality Definition Language (DQDL) ruleset, containing analyzers, rules, or both, to evaluate tables with. You create the ruleset using the <code>CreateDataQualityRuleset</code> API. Specify either <code>RulesetName</code> or <code>ManagedRulesetName</code>, not both.</p>
        managed_ruleset_name: <p>A built-in ruleset that profiles each table, used when <code>RulesetName</code> is not set. The default is <code>SIMPLE</code>. Choose from the following built-in rulesets:</p> <dl> <dt>SIMPLE</dt> <dd> <p>Row count and column count, completeness, minimum, and maximum for every column, mean, sum, and standard deviation for numeric columns, and column length for string columns.</p> </dd> <dt>ADVANCED</dt> <dd> <p>Every statistic in <code>SIMPLE</code>, plus distribution, uniqueness, and distinct values count.</p> </dd> </dl>
        triggers: <p>When the configuration evaluates tables. You can choose one or more triggers, and each table is evaluated at most once an hour. The default is <code>ONCE</code>. Choose from the following triggers:</p> <dl> <dt>ONCE</dt> <dd> <p>Evaluates each table one time, including when tables are added to a database or catalog.</p> </dd> <dt>SCHEDULE</dt> <dd> <p>Evaluates each table on the cron or rate expression in <code>ScheduleExpression</code>, between the optional <code>StartAt</code> and <code>EndAt</code> times.</p> </dd> <dt>METADATA_CHANGE</dt> <dd> <p>Evaluates a table whenever its Glue Data Catalog metadata changes, such as a schema change or an Apache Iceberg commit.</p> </dd> </dl>
        schedule_expression: <p>A cron or rate expression, in UTC, for the <code>SCHEDULE</code> trigger, for example <code>cron(0 6 * * ? *)</code>. The schedule can run at most once an hour.</p>
        start_at: <p>The time from which the schedule runs, inclusive.</p>
        end_at: <p>The time at which the schedule stops running, exclusive.</p>
        role: <p>The IAM role that evaluations assume. You can specify the role name or the role Amazon Resource Name (ARN).</p> <p>The role must allow the <code>glue.amazonaws.com</code> service principal to assume it, and needs permissions to read the catalog (<code>glue:GetCatalog</code>, <code>glue:GetDatabase</code>, <code>glue:GetTable</code>, <code>glue:SearchTables</code>, and <code>glue:GetPartitions</code>), read and create rulesets (<code>glue:GetDataQualityRuleset</code> and <code>glue:CreateDataQualityRuleset</code>), start evaluations (<code>glue:StartDataQualityRulesetEvaluationRun</code>, <code>glue:PublishDataQuality</code>, and <code>iam:PassRole</code> on the role itself), read the tables' data in Amazon S3, and write logs to Amazon CloudWatch Logs. If a catalog-level or database-level configuration applies to an Amazon S3 Tables catalog, the role also needs <code>s3tables:ListTableBuckets</code> and <code>s3tables:ListTables</code>. If you use Lake Formation, the role needs the <code>DESCRIBE</code> permission on the tables.</p>
        number_of_workers: <p>The number of <code>G.1X</code> workers to be used in the run. The default is 5.</p>
        timeout: <p>The timeout for a run in minutes. This is the maximum time that a run can consume resources before it is terminated and enters <code>TIMEOUT</code> status. The default is 2,880 minutes (48 hours).</p>
        additional_run_options: <p>Additional run options you can specify for an evaluation run.</p>
        additional_data_sources: <p>A map of reference strings to additional data sources you can specify for an evaluation run.</p>
        tags: <p>A list of tags applied to the data quality evaluation configuration.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the operation completes no more than one time. If this token matches a previous request, the service ignores the request, but does not return an error.</p>

    Raises:
        capo_glue.errors.access_denied_exception.AccessDeniedException: <p>Access to a resource was denied.</p>
        capo_glue.errors.already_exists_exception.AlreadyExistsException: <p>A resource to be created or added already exists.</p>
        capo_glue.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist</p>
        capo_glue.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>The same unique identifier was associated with two different records.</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.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_glue.errors.resource_number_limit_exceeded_exception.ResourceNumberLimitExceededException: <p>A resource numerical limit was exceeded.</p>
        capo_glue.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_glue.types.create_data_quality_evaluation_config_request.CreateDataQualityEvaluationConfigRequest]",
    ) -> OperationResponse[
        "capo_glue.types.create_data_quality_evaluation_config_response.CreateDataQualityEvaluationConfigResponse"
    ]:
        import capo_glue._operations.aws_glue.create_data_quality_evaluation_config

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDataQualityEvaluationConfig")
    )
    input_: capo_glue.types.create_data_quality_evaluation_config_request.CreateDataQualityEvaluationConfigRequest = {
        "name": name,
        "level": level,
        "data_source": data_source,
        "role": role,
    }
    if ruleset_name is not None:
        input_["ruleset_name"] = ruleset_name
    if managed_ruleset_name is not None:
        input_["managed_ruleset_name"] = managed_ruleset_name
    if triggers is not None:
        input_["triggers"] = triggers
    if schedule_expression is not None:
        input_["schedule_expression"] = schedule_expression
    if start_at is not None:
        input_["start_at"] = start_at
    if end_at is not None:
        input_["end_at"] = end_at
    if number_of_workers is not None:
        input_["number_of_workers"] = number_of_workers
    if timeout is not None:
        input_["timeout"] = timeout
    if additional_run_options is not None:
        input_["additional_run_options"] = additional_run_options
    if additional_data_sources is not None:
        input_["additional_data_sources"] = additional_data_sources
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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