Skip to content

Project Configuration

Ivan Zhang edited this page Aug 27, 2023 · 1 revision

Settings

This library exposes a few settings. Create a settings file (e.g. settings.py) and define the following variables:

# Required: URL to the database where check and execution data will be stored
CHECKS_DATABASE_URL = None
# Required: Module where checks are defined
CHECKS_MODULE = None
# Required: Module where suites are defined
SUITES_MODULE = None
# Required if alerting is enabled: Endpoint URL where alerts will be sent
ALERTING_ENDPOINT = None
# Required: Default CRON schedule for suites
DEFAULT_SCHEDULE = None

Then, set the CHECK_SETTINGS_MODULE environment variable to your settings file (e.g. my_data_checks.settings):

export CHECK_SETTINGS_MODULE=my_data_checks.settings

These settings can be accessed from data_checks.conf.settings:

from data_checks.conf.settings import settings

print(settings["CHECKS_DATABASE_URL"])

Data Check Registry

The project's checks (based on CHECKS_MODULE) is stored in the Data Check Registry. This can be accessed from data_checks.conf.data_check_registry:

from data_checks.conf.data_check_registry import data_check_registry

print(data_check_registry["MyFirstDataCheck"])
# <class 'checks.my_first_data_check.MyFirstDataCheck'>

Data Suite Registry

The project's suites (based on SUITES_MODULE) is stored in the Data Suite Registry. This can be accessed from data_checks.conf.data_suite_registry:

from data_checks.conf.data_suite_registry import data_suite_registry

print(data_suite_registry["MyFirstDataSuite"])
# <class 'suites.my_first_data_suite.MyFirstDataSuite'>

Clone this wiki locally