validio_sdk package

Subpackages

Submodules

validio_sdk.config module

Persistent configuration.

class validio_sdk.config.Config(config_dir: Path | None = None)

Bases: object

Config management.

A class to work with configuration such as reading, writing and deleting.

exists() bool

Check if any configuration exist.

read() ValidioConfig

Read persistent configuration.

Will return None if no configuration is created yet.

Returns:

The configuration, or None

Return type:

ValidioConfig | None

Raises:

ConfigNotFoundError if no configuration exists

Raises:

ConfigNotFoundError if the configuration is invalid

remove() None

Remove the configuration at the instance’s config_path.

write(config: ValidioConfig) None

Write the passed configuration to disk.

This will fully overwrite the existing configuration, including any fields that’s not a part of the ValidioConfig.

Parameters:

config – A ValidioConfig object.

class validio_sdk.config.ValidioConfig(endpoint: str = '', access_key: str = '', access_secret: str = '', default_namespace: str = 'default')

Bases: object

Representation of configuration to use in the Validio system and SDK.

property access_secret: str
asdict() dict[str, str]

Return a dictionary representation of the class.

This is used from our ClassJSONEncoder to ensure we save JSON representing the class with the external property names. By doing this we can also ensure that we can serialize the config by passing the JSON to the constructor.

validio_sdk.config.default_config_dir() Path

Get the default config dir based on the OS.

validio_sdk.dbt module

Utilities for dbt.

validio_sdk.dbt.trim_manifest_json(manifest: dict) dict

Takes a dbt manifest json and discards all the fields that are not relevant used by the validio platform.

Parameters:

manifest – The manifest object

async validio_sdk.dbt.upload_artifacts(client: APIClient, credential_id: str, job_name: str, manifest: dict, run_results: dict | None) None

Helper function to upload dbt artifacts. The artifacts are additionally trimmed before uploading.

Parameters:
  • client – ValidioAPIClient to use for the artifacts upload.

  • credential_id – DBTCore credential id to upload artifacts on behalf of.

  • job_name – Job associated with the artifacts.

  • manifest – manifest.json payload

  • run_results – run_results.json payload

validio_sdk.exception module

Exceptions used throughout the system.

exception validio_sdk.exception.ConfigInvalidError

Bases: ValidioError

Exception when the configuration file is invalid.

exception validio_sdk.exception.ConfigNotFoundError(endpoint_env: str, access_key_env: str, secret_access_key_env: str)

Bases: ValidioError

Exception when no configuration is found.

exception validio_sdk.exception.ForbiddenError

Bases: ValidioError

Exception throw when doing forbidden request.

This happens when trying to access API methods not allowed, e.g. adding resources to a namespace the API key is not part of.

exception validio_sdk.exception.UnauthorizedError(access_key_env: str, secret_access_key_env: str)

Bases: ValidioError

Exception thrown when unauthorized request is made.

exception validio_sdk.exception.ValidioBugError(*args: Any)

Bases: ValidioError

Same as ValidioError but marked for bugs to be reported.

exception validio_sdk.exception.ValidioConnectionError(endpoint_env: str, e: Exception)

Bases: ValidioError

Exception thrown when connection to Validio backend fails.

exception validio_sdk.exception.ValidioError(*args: Any)

Bases: Exception

Base exception used for every exception thrown by Validio.

validio_sdk.metadata module

Metadata information about the package.

validio_sdk.metadata.version() str

Get the version of the SDK from the metadata.

Module contents

class validio_sdk.BooleanFilter(field: str | FieldSelector, operator: BooleanFilterOperator, name: str | None = None, source: Source | None = None, display_name: str | None = None, ignore_changes: bool = False)

Bases: Filter

A Boolean filter configuration.

https://docs.validio.io/docs/filters#boolean-filter

class validio_sdk.BooleanFilterOperator(value)

Bases: str, Enum

Configures the behavior of a Boolean filter.

IS_TRUE: Allow values equal to TRUE IS_FALSE: Allow values equal to FALSE

IS_FALSE = 'IS_FALSE'
IS_TRUE = 'IS_TRUE'
exception validio_sdk.ConfigInvalidError

Bases: ValidioError

Exception when the configuration file is invalid.

exception validio_sdk.ConfigNotFoundError(endpoint_env: str, access_key_env: str, secret_access_key_env: str)

Bases: ValidioError

Exception when no configuration is found.

class validio_sdk.EnumFilter(field: str | FieldSelector, values: list[str], operator: EnumFilterOperator = EnumFilterOperator.ALLOW, name: str | None = None, source: Source | None = None, display_name: str | None = None, ignore_changes: bool = False)

Bases: Filter

An Enum filter configuration.

https://docs.validio.io/docs/filters#enum

class validio_sdk.EnumFilterOperator(value)

Bases: str, Enum

Configures the behavior of an Enum filter.

ALLOW: Allow values in the enum DENY: Deny values in the enum

ALLOW = 'ALLOW'
DENY = 'DENY'
class validio_sdk.NullFilter(field: str | FieldSelector, operator: NullFilterOperator = NullFilterOperator.IS, name: str | None = None, source: Source | None = None, display_name: str | None = None, ignore_changes: bool = False)

Bases: Filter

A Null filter configuration.

https://docs.validio.io/docs/filters#null

class validio_sdk.NullFilterOperator(value)

Bases: str, Enum

Configures the behavior of a Null filter.

IS: Filter in NULL values IS_NOT: Filter in Non-NULL values

IS = 'IS'
IS_NOT = 'IS_NOT'
class validio_sdk.SqlFilter(query: str, name: str | None = None, source: Source | None = None, display_name: str | None = None, ignore_changes: bool = False)

Bases: Filter

A SQL filter configuration.

https://docs.validio.io/docs/filters#sql-filter

class validio_sdk.StringFilter(field: str | FieldSelector, operator: StringFilterOperator, value: str | None = None, name: str | None = None, source: Source | None = None, display_name: str | None = None, ignore_changes: bool = False)

Bases: Filter

A String filter configuration.

https://docs.validio.io/docs/filters#string

class validio_sdk.StringFilterOperator(value)

Bases: str, Enum

Configures the behavior of a String filter.

IS_EMPTY: The string is empty IS_NOT_EMPTY: The string is not empty CONTAINS: The string contains DOES_NOT_CONTAIN: The string does not contain STARTS_WITH: The string is prefixed with ENDS_WITH: The string is suffixed with IS_EXACTLY: Exact match of full string REGEX: Regular expressions

CONTAINS = 'CONTAINS'
DOES_NOT_CONTAIN = 'DOES_NOT_CONTAIN'
ENDS_WITH = 'ENDS_WITH'
IS_EMPTY = 'IS_EMPTY'
IS_EXACTLY = 'IS_EXACTLY'
IS_NOT_EMPTY = 'IS_NOT_EMPTY'
REGEX = 'REGEX'
STARTS_WITH = 'STARTS_WITH'
class validio_sdk.ThresholdFilter(field: str | FieldSelector, value: float, operator: ThresholdFilterOperator, name: str | None = None, source: Source | None = None, display_name: str | None = None, ignore_changes: bool = False)

Bases: Filter

A Threshold filter configuration.

https://docs.validio.io/docs/filters#threshold-filter

class validio_sdk.ThresholdFilterOperator(value)

Bases: str, Enum

Configures the behavior of a String filter.

EQUAL: The value equals (==) NOT_EQUAL: The value does not equal (!=) LESS_THAN: The value is less than (<) LESS_THAN_OR_EQUAL: The value is less than or equal (<=) GREATER_THAN: The value is greater than (>) GREATER_THAN_OR_EQUAL: The value is greater than or equal (>=)

EQUAL = 'EQUAL'
GREATER_THAN = 'GREATER'
GREATER_THAN_OR_EQUAL = 'GREATER_EQUAL'
LESS_THAN = 'LESS'
LESS_THAN_OR_EQUAL = 'LESS_EQUAL'
NOT_EQUAL = 'NOT_EQUAL'
exception validio_sdk.UnauthorizedError(access_key_env: str, secret_access_key_env: str)

Bases: ValidioError

Exception thrown when unauthorized request is made.

exception validio_sdk.ValidioConnectionError(endpoint_env: str, e: Exception)

Bases: ValidioError

Exception thrown when connection to Validio backend fails.

exception validio_sdk.ValidioError(*args: Any)

Bases: Exception

Base exception used for every exception thrown by Validio.

validio_sdk.load_jtd_schema(filepath: Path) dict

Reads a jtd schema from a file on disk.

Parameters:

filepath – Path to the file containing the schema contents.