Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dc4324b

Browse files
authored
Add Wursthall project (SQLMesh#236)
* add wursthall project * change owner * fix imports and add faker dependency * pr feedback * remove extra import * add mypy to examples
1 parent 0a48f6a commit dc4324b

29 files changed

Lines changed: 609 additions & 14 deletions

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ repos:
77
language: system
88
"types": [ python ]
99
require_serial: true
10-
files: ^(sqlmesh/|tests/|web/|example/|setup.py)
10+
files: &files ^(sqlmesh/|tests/|web/|examples/|setup.py)
1111
- id: isort
1212
name: isort
1313
entry: isort
1414
language: system
1515
"types": [ python ]
16-
files: ^(sqlmesh/|tests/|web/|example/|setup.py)
16+
files: *files
1717
require_serial: true
1818
- id: black
1919
name: black
2020
language: system
2121
entry: black
2222
require_serial: true
23-
files: ^(sqlmesh/|tests/|web/|example/|setup.py)
23+
files: *files
2424
types_or:
2525
- python
2626
- pyi
@@ -29,5 +29,5 @@ repos:
2929
language: system
3030
entry: mypy
3131
"types": [ python ]
32-
files: ^(sqlmesh/|tests/|web/|setup.py)
32+
files: *files
3333
require_serial: true

examples/__init__.py

Whitespace-only changes.

examples/sushi/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# A stateful DuckDB config.
1212
local_config = Config(
13-
connection=DuckDBConnectionConfig(database=f"{DATA_DIR}/local.duckdb")
13+
connections=DuckDBConnectionConfig(database=f"{DATA_DIR}/local.duckdb"),
1414
)
1515

1616

examples/sushi/hooks/hooks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import typing as t
12
from datetime import datetime
23

34
from sqlmesh import ExecutionContext, hook
@@ -9,6 +10,6 @@ def noop(
910
start: datetime,
1011
end: datetime,
1112
latest: datetime,
12-
**kwargs,
13+
**kwargs: t.Any,
1314
) -> None:
1415
pass

examples/sushi/macros/macros.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
from sqlglot import exp
2+
13
from sqlmesh.core.macros import MacroEvaluator, macro
24

35

46
@macro()
5-
def add_one(evaluator: MacroEvaluator, column: str):
7+
def add_one(evaluator: MacroEvaluator, column: str) -> exp.Expression:
68
return evaluator.parse_one(f"{column} + 1")

examples/sushi/models/items.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import random
2+
import typing as t
23
from datetime import datetime
34

45
import numpy as np
@@ -63,7 +64,7 @@ def execute(
6364
start: datetime,
6465
end: datetime,
6566
latest: datetime,
66-
**kwargs,
67+
**kwargs: t.Any,
6768
) -> pd.DataFrame:
6869
dfs = []
6970
for dt in iter_dates(start, end):

examples/sushi/models/order_items.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def execute(
3131
start: datetime,
3232
end: datetime,
3333
latest: datetime,
34-
**kwargs,
34+
**kwargs: t.Any,
3535
) -> t.Generator[pd.DataFrame, None, None]:
3636
orders_table = context.table("sushi.orders")
3737
items_table = context.table(ITEMS)

examples/sushi/models/orders.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import random
2+
import typing as t
23
from datetime import datetime, timedelta
34

45
import pandas as pd
@@ -33,7 +34,7 @@ def execute(
3334
start: datetime,
3435
end: datetime,
3536
latest: datetime,
36-
**kwargs,
37+
**kwargs: t.Any,
3738
) -> pd.DataFrame:
3839
dfs = []
3940
for dt in iter_dates(start, end):

examples/wursthall/__init__.py

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
AUDIT (
2+
name assert_valid_order_totals,
3+
model db.order_f
4+
);
5+
6+
SELECT *
7+
FROM db.order_f
8+
WHERE
9+
order_ds BETWEEN @start_ds AND @end_ds
10+
AND order_total < 0;

0 commit comments

Comments
 (0)