Skip to content

Commit 9e1111e

Browse files
committed
⚙️ fixed: remove usesage pattern of data-quality.
1 parent c5f80b9 commit 9e1111e

File tree

5 files changed

+39
-18
lines changed

5 files changed

+39
-18
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,18 @@ WHEN NOT MATCHED THEN INSERT
116116
> This feature does not support yet!!!
117117
118118
```python
119-
from sqlplate import SQLity, Condition
119+
from sqlplate import SQLPlate
120+
from sqlplate.rules import Unique, NotNull, Count
120121

121122
report: str = (
122-
SQLity.format('databricks')
123-
.template('quality')
123+
SQLPlate.format('databricks')
124+
.quality(mode="pushdown")
124125
.option('catalog', 'catalog-name')
125126
.option('schema', 'schema-name')
126127
.option('table', 'table-name')
127-
.check('unique', Condition(cols=['pk_col'], rule="unique"))
128-
.check('not-null', Condition(cols=['col01', 'col02'], rule="not-null"))
129-
.check('row-count', Contition(rule="count"))
128+
.check('unique', Unique(cols=['pk_col']))
129+
.check('not-null', NotNull(cols=['col01', 'col02']))
130+
.check('row-count', Count())
130131
.validate(output='html')
131132
)
132133
print(report.strip().strip('\n'))

src/sqlplate/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
from .sqlplate import SQLPlate
2-
from .sqlity import SQLity

src/sqlplate/rules.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class BaseRule: ...
2+
3+
4+
class Unique(BaseRule): ...
5+
6+
7+
class NotNull(BaseRule): ...
8+
9+
10+
class Count(BaseRule): ...

src/sqlplate/sqlity.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/sqlplate/sqlplate.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from __future__ import annotations
77

88
from pathlib import Path
9-
from typing import Any, Iterator, Optional, Callable
9+
from typing import Any, Iterator, Optional, Callable, Literal
1010

1111
from jinja2 import Template
1212

@@ -83,6 +83,9 @@ def template(self, name: str) -> 'SQLPlate':
8383
)
8484
return self
8585

86+
def quality(self, mode: Literal["pushdown", "memory"]) -> 'SQLPlate':
87+
return self
88+
8689
def option(self, key: str, value: Any) -> 'SQLPlate':
8790
"""Pass an option key-value pair before generate template."""
8891
self._option[key] = value
@@ -144,3 +147,21 @@ def stream(
144147
)
145148
if trim(s) != ''
146149
)
150+
151+
def check(
152+
self,
153+
name: str,
154+
rule: Any,
155+
) -> 'SQLPlate':
156+
return self
157+
158+
def validate(
159+
self,
160+
output: Literal["json", "html"],
161+
):
162+
return self
163+
164+
def filter(
165+
self,
166+
):
167+
return self

0 commit comments

Comments
 (0)