-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(configuration): update configuration structure
- Loading branch information
1 parent
ea3bb34
commit e3fb34d
Showing
22 changed files
with
620 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Copyright 2022-present, the Waterdip Labs Pvt. Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from dataclasses import dataclass | ||
from enum import Enum | ||
from typing import Dict, List, Optional, Union | ||
|
||
from datachecks.core.common.models.data_source_resource import Field, Index, Table | ||
from datachecks.core.common.models.metric import MetricsType | ||
|
||
|
||
class DatasourceType(str, Enum): | ||
OPENSEARCH = "opensearch" | ||
ELASTICSEARCH = "elasticsearch" | ||
POSTGRES = "postgres" | ||
MYSQL = "mysql" | ||
MSSQL = "mssql" | ||
BIGQUERY = "bigquery" | ||
REDSHIFT = "redshift" | ||
SNOWFLAKE = "snowflake" | ||
DATABRICKS = "databricks" | ||
MONGODB = "mongodb" | ||
|
||
|
||
@dataclass | ||
class DataSourceConnectionConfiguration: | ||
""" | ||
Connection configuration for a data source | ||
""" | ||
|
||
host: str | ||
port: int | ||
database: Optional[str] | ||
username: Optional[str] = None | ||
password: Optional[str] = None | ||
schema: Optional[str] = "public" | ||
|
||
|
||
@dataclass | ||
class DataSourceConfiguration: | ||
""" | ||
Data source configuration | ||
""" | ||
|
||
name: str | ||
type: DatasourceType | ||
connection_config: DataSourceConnectionConfiguration | ||
|
||
|
||
@dataclass | ||
class MetricsFilterConfiguration: | ||
""" | ||
Filter configuration for a metric | ||
""" | ||
|
||
where: Optional[str] = None | ||
|
||
|
||
@dataclass | ||
class MetricConfiguration: | ||
""" | ||
Metric configuration | ||
""" | ||
|
||
name: str | ||
metric_type: MetricsType | ||
resource: Union[Table, Index, Field] | ||
filters: Optional[MetricsFilterConfiguration] = None | ||
|
||
|
||
@dataclass | ||
class Configuration: | ||
""" | ||
Configuration for the data checks | ||
""" | ||
|
||
data_sources: Dict[str, DataSourceConfiguration] | ||
metrics: Dict[str, MetricConfiguration] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright 2022-present, the Waterdip Labs Pvt. Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from dataclasses import dataclass | ||
from typing import Optional, Union | ||
|
||
|
||
@dataclass | ||
class Table: | ||
""" | ||
Database Table resource | ||
""" | ||
|
||
data_source: str | ||
name: str | ||
|
||
|
||
@dataclass | ||
class Index: | ||
""" | ||
Search Index resource | ||
""" | ||
|
||
data_source: str | ||
name: str | ||
|
||
|
||
@dataclass | ||
class Field: | ||
""" | ||
Search Field resource | ||
""" | ||
|
||
belongs_to: Union[Table, Index] | ||
name: str |
Oops, something went wrong.