Skip to content

Config

cognite_data_quality._config

CredentialsConfig

Bases: BaseModel

CDF credentials loaded from a TOML config file.

Attributes:

Name Type Description
project str

CDF project name.

tenant_id str

Azure AD tenant ID.

cdf_cluster str

CDF cluster (e.g. "api" or "westeurope-1").

client_id str

Service principal client ID.

client_secret str

Service principal client secret.

login_flow str

Authentication flow. Default: "client_credentials".

Source code in cognite_data_quality/_config.py
class CredentialsConfig(BaseModel):
    """CDF credentials loaded from a TOML config file.

    Attributes:
        project: CDF project name.
        tenant_id: Azure AD tenant ID.
        cdf_cluster: CDF cluster (e.g. ``"api"`` or ``"westeurope-1"``).
        client_id: Service principal client ID.
        client_secret: Service principal client secret.
        login_flow: Authentication flow. Default: ``"client_credentials"``.
    """

    project: str
    tenant_id: str
    cdf_cluster: str
    client_id: str
    client_secret: str
    login_flow: str = Field(default="client_credentials")

DataModelConfig

Bases: BaseModel

Identifies a CDF Data Model used during instance validation.

Attributes:

Name Type Description
space str

CDF space that contains the data model.

external_id str

External ID of the data model.

version str

Version string of the data model.

Source code in cognite_data_quality/_config.py
class DataModelConfig(BaseModel):
    """Identifies a CDF Data Model used during instance validation.

    Attributes:
        space: CDF space that contains the data model.
        external_id: External ID of the data model.
        version: Version string of the data model.
    """

    space: str
    external_id: str
    version: str

RuleConfig

Bases: BaseModel

Resolved validation rule configuration passed to a validation handler.

Attributes:

Name Type Description
datamodel DataModelConfig | None

Target data model for instance loading.

instance_space str | None

CDF space from which instances are read.

auto_load_depth int

Levels of referenced instances to auto-load (0-3). Default: 2.

verbose bool

Enable verbose logging in the handler. Default: True.

records RecordsConfig | None

Records API configuration for result ingestion.

Source code in cognite_data_quality/_config.py
class RuleConfig(BaseModel):
    """Resolved validation rule configuration passed to a validation handler.

    Attributes:
        datamodel: Target data model for instance loading.
        instance_space: CDF space from which instances are read.
        auto_load_depth: Levels of referenced instances to auto-load (0-3).
            Default: 2.
        verbose: Enable verbose logging in the handler. Default: ``True``.
        records: Records API configuration for result ingestion.
    """

    datamodel: DataModelConfig | None = None
    instance_space: str | None = None
    auto_load_depth: int = Field(default=2)
    verbose: bool = Field(default=True)
    records: RecordsConfig | None = None

ValidationInput

Bases: BaseModel

Input payload consumed by validation handler functions.

Attributes:

Name Type Description
instance_space str

CDF space from which instances are fetched and validated.

shacl_rules str | None

Inline SHACL rules string (Turtle format). Mutually exclusive with shacl_rules_file_external_id and ruleset_references.

shacl_rules_file_external_id str | None

CDF Files external ID of the SHACL rules file to load at runtime. Mutually exclusive with shacl_rules and ruleset_references.

ruleset_references list[dict] | None

List of {"externalId": ..., "version": ...} dicts pointing to CDF RuleSet API versions. When set, SHACL rules are fetched from the RuleSet API at runtime. Mutually exclusive with shacl_rules and shacl_rules_file_external_id.

datamodel_space str | None

Space of the data model used for instance loading.

datamodel_external_id str | None

External ID of the data model.

datamodel_version str | None

Version of the data model.

verbose bool

Enable verbose logging. Default: True.

job_run_id str | None

Unique identifier for this validation run, written to every record. Auto-generated if None.

records_config RecordsConfig | None

Records API configuration. Pass None to skip Records API ingestion.

Source code in cognite_data_quality/_config.py
class ValidationInput(BaseModel):
    """Input payload consumed by validation handler functions.

    Attributes:
        instance_space: CDF space from which instances are fetched and
            validated.
        shacl_rules: Inline SHACL rules string (Turtle format). Mutually
            exclusive with *shacl_rules_file_external_id* and
            *ruleset_references*.
        shacl_rules_file_external_id: CDF Files external ID of the SHACL
            rules file to load at runtime. Mutually exclusive with
            *shacl_rules* and *ruleset_references*.
        ruleset_references: List of ``{"externalId": ..., "version": ...}``
            dicts pointing to CDF RuleSet API versions.  When set, SHACL
            rules are fetched from the RuleSet API at runtime.  Mutually
            exclusive with *shacl_rules* and *shacl_rules_file_external_id*.
        datamodel_space: Space of the data model used for instance loading.
        datamodel_external_id: External ID of the data model.
        datamodel_version: Version of the data model.
        verbose: Enable verbose logging. Default: ``True``.
        job_run_id: Unique identifier for this validation run, written to
            every record.  Auto-generated if ``None``.
        records_config: Records API configuration. Pass ``None`` to skip
            Records API ingestion.
    """

    instance_space: str
    shacl_rules: str | None = None
    shacl_rules_file_external_id: str | None = None
    ruleset_references: list[dict] | None = None
    datamodel_space: str | None = None
    datamodel_external_id: str | None = None
    datamodel_version: str | None = None
    verbose: bool = Field(default=True)
    job_run_id: str | None = None
    records_config: RecordsConfig | None = None

ValidationResult

Bases: BaseModel

Aggregated result returned by a validation handler.

Attributes:

Name Type Description
conforms bool

True when no Violation-severity constraints failed.

violations list[Violation]

List of individual constraint violations.

report_text str | None

Human-readable SHACL validation report text.

instance_count int

Number of instances that were validated.

records list[dict]

List of Records API payloads built from the violations.

schema_issues list[dict]

List of schema inconsistency dicts detected in the data model (e.g. missing properties, type mismatches).

Source code in cognite_data_quality/_config.py
class ValidationResult(BaseModel):
    """Aggregated result returned by a validation handler.

    Attributes:
        conforms: ``True`` when no Violation-severity constraints failed.
        violations: List of individual constraint violations.
        report_text: Human-readable SHACL validation report text.
        instance_count: Number of instances that were validated.
        records: List of Records API payloads built from the violations.
        schema_issues: List of schema inconsistency dicts detected in the
            data model (e.g. missing properties, type mismatches).
    """

    conforms: bool
    violations: list[Violation] = Field(default_factory=list)
    report_text: str | None = None
    instance_count: int = 0
    records: list[dict] = Field(default_factory=list)
    schema_issues: list[dict] = Field(default_factory=list)  # Schema inconsistencies from data model