tinybird 0.0.1.dev26__py3-none-any.whl → 0.0.1.dev27__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tinybird might be problematic. Click here for more details.
- tinybird/config.py +1 -1
- tinybird/datatypes.py +46 -57
- tinybird/git_settings.py +4 -4
- tinybird/prompts.py +644 -0
- tinybird/sql.py +9 -0
- tinybird/sql_toolset.py +17 -3
- tinybird/syncasync.py +1 -1
- tinybird/tb/__cli__.py +2 -2
- tinybird/tb/cli.py +2 -0
- tinybird/tb/modules/build.py +44 -16
- tinybird/tb/modules/build_server.py +75 -0
- tinybird/tb/modules/cli.py +22 -0
- tinybird/tb/modules/common.py +2 -2
- tinybird/tb/modules/config.py +13 -14
- tinybird/tb/modules/create.py +124 -119
- tinybird/tb/modules/datafile/build.py +28 -0
- tinybird/tb/modules/datafile/common.py +1 -0
- tinybird/tb/modules/datafile/fixture.py +10 -6
- tinybird/tb/modules/datafile/parse_pipe.py +2 -0
- tinybird/tb/modules/datasource.py +1 -1
- tinybird/tb/modules/deploy.py +160 -0
- tinybird/tb/modules/llm.py +32 -16
- tinybird/tb/modules/llm_utils.py +24 -0
- tinybird/tb/modules/local.py +2 -2
- tinybird/tb/modules/login.py +8 -6
- tinybird/tb/modules/mock.py +10 -6
- tinybird/tb/modules/test.py +69 -47
- tinybird/tb/modules/watch.py +1 -1
- tinybird/tb_cli_modules/common.py +2 -2
- tinybird/tb_cli_modules/config.py +5 -5
- tinybird/tornado_template.py +1 -3
- {tinybird-0.0.1.dev26.dist-info → tinybird-0.0.1.dev27.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev26.dist-info → tinybird-0.0.1.dev27.dist-info}/RECORD +36 -33
- {tinybird-0.0.1.dev26.dist-info → tinybird-0.0.1.dev27.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev26.dist-info → tinybird-0.0.1.dev27.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev26.dist-info → tinybird-0.0.1.dev27.dist-info}/top_level.txt +0 -0
tinybird/config.py
CHANGED
|
@@ -83,7 +83,7 @@ async def get_config(host: str, token: Optional[str], semver: Optional[str] = No
|
|
|
83
83
|
async with aiofiles.open(config_file) as file:
|
|
84
84
|
res = await file.read()
|
|
85
85
|
config = json.loads(res)
|
|
86
|
-
except
|
|
86
|
+
except OSError:
|
|
87
87
|
pass
|
|
88
88
|
except json.decoder.JSONDecodeError:
|
|
89
89
|
click.echo(FeedbackManager.error_load_file_config(config_file=config_file))
|
tinybird/datatypes.py
CHANGED
|
@@ -2,6 +2,7 @@ import ast
|
|
|
2
2
|
import decimal
|
|
3
3
|
import re
|
|
4
4
|
from decimal import Decimal
|
|
5
|
+
from typing import Callable, Dict, List, Optional, Tuple
|
|
5
6
|
|
|
6
7
|
datetime64_patterns = [
|
|
7
8
|
r"\d\d\d\d.\d\d.\d\d(T|\s)\d\d:\d\d:\d\d.\d\d\d",
|
|
@@ -53,7 +54,7 @@ bool_allowed_values = {
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
|
|
56
|
-
def is_type_datetime64(type_to_check):
|
|
57
|
+
def is_type_datetime64(type_to_check: str) -> bool:
|
|
57
58
|
"""
|
|
58
59
|
>>> is_type_datetime64('DateTime64')
|
|
59
60
|
True
|
|
@@ -73,7 +74,7 @@ def is_type_datetime64(type_to_check):
|
|
|
73
74
|
return re.match(datetime64_type_pattern, type_to_check) is not None
|
|
74
75
|
|
|
75
76
|
|
|
76
|
-
def is_type_datetime(type_to_check):
|
|
77
|
+
def is_type_datetime(type_to_check: str) -> bool:
|
|
77
78
|
"""
|
|
78
79
|
>>> is_type_datetime('DateTime')
|
|
79
80
|
True
|
|
@@ -89,87 +90,87 @@ def is_type_datetime(type_to_check):
|
|
|
89
90
|
return re.match(datetime_type_pattern, type_to_check) is not None
|
|
90
91
|
|
|
91
92
|
|
|
92
|
-
def string_test(x):
|
|
93
|
+
def string_test(x: str) -> bool:
|
|
93
94
|
return True
|
|
94
95
|
|
|
95
96
|
|
|
96
|
-
def date_test(x):
|
|
97
|
-
return re.match(r"\d\d\d\d-\d\d-\d\d$", x)
|
|
97
|
+
def date_test(x: str) -> bool:
|
|
98
|
+
return re.match(r"\d\d\d\d-\d\d-\d\d$", x) is not None
|
|
98
99
|
|
|
99
100
|
|
|
100
|
-
def datetime64_test(x):
|
|
101
|
+
def datetime64_test(x: str) -> bool:
|
|
101
102
|
return any([re.match(p, x) for p in datetime64_patterns])
|
|
102
103
|
|
|
103
104
|
|
|
104
|
-
def datetime_test(x):
|
|
105
|
+
def datetime_test(x: str) -> bool:
|
|
105
106
|
return any([re.match(p, x) for p in datetime_patterns])
|
|
106
107
|
|
|
107
108
|
|
|
108
|
-
def int_8_test(x):
|
|
109
|
-
return re.match(intx_re, x) and -int_8_max <= int(x) < int_8_max
|
|
109
|
+
def int_8_test(x: str) -> bool:
|
|
110
|
+
return re.match(intx_re, x) is not None and -int_8_max <= int(x) < int_8_max
|
|
110
111
|
|
|
111
112
|
|
|
112
|
-
def int16_test(x):
|
|
113
|
-
return re.match(intx_re, x) and -int16_max <= int(x) < int16_max
|
|
113
|
+
def int16_test(x: str) -> bool:
|
|
114
|
+
return re.match(intx_re, x) is not None and -int16_max <= int(x) < int16_max
|
|
114
115
|
|
|
115
116
|
|
|
116
|
-
def int32_test(x):
|
|
117
|
-
return re.match(intx_re, x) and -int32_max <= int(x) < int32_max
|
|
117
|
+
def int32_test(x: str) -> bool:
|
|
118
|
+
return re.match(intx_re, x) is not None and -int32_max <= int(x) < int32_max
|
|
118
119
|
|
|
119
120
|
|
|
120
|
-
def int64_test(x):
|
|
121
|
-
return re.match(intx_re, x) and -int64_max <= int(x) < int64_max
|
|
121
|
+
def int64_test(x: str) -> bool:
|
|
122
|
+
return re.match(intx_re, x) is not None and -int64_max <= int(x) < int64_max
|
|
122
123
|
|
|
123
124
|
|
|
124
|
-
def int128_test(x):
|
|
125
|
-
return re.match(intx_re, x) and -int128_max <= int(x) < int128_max
|
|
125
|
+
def int128_test(x: str) -> bool:
|
|
126
|
+
return re.match(intx_re, x) is not None and -int128_max <= int(x) < int128_max
|
|
126
127
|
|
|
127
128
|
|
|
128
|
-
def int256_test(x):
|
|
129
|
-
return re.match(intx_re, x) and -int256_max <= int(x) < int256_max
|
|
129
|
+
def int256_test(x: str) -> bool:
|
|
130
|
+
return re.match(intx_re, x) is not None and -int256_max <= int(x) < int256_max
|
|
130
131
|
|
|
131
132
|
|
|
132
|
-
def uint_8_test(x):
|
|
133
|
-
return re.match(uintx_re, x) and 0 <= int(x) < uint_8_max
|
|
133
|
+
def uint_8_test(x: str) -> bool:
|
|
134
|
+
return re.match(uintx_re, x) is not None and 0 <= int(x) < uint_8_max
|
|
134
135
|
|
|
135
136
|
|
|
136
|
-
def uint16_test(x):
|
|
137
|
-
return re.match(uintx_re, x) and 0 <= int(x) < uint16_max
|
|
137
|
+
def uint16_test(x: str) -> bool:
|
|
138
|
+
return re.match(uintx_re, x) is not None and 0 <= int(x) < uint16_max
|
|
138
139
|
|
|
139
140
|
|
|
140
|
-
def uint32_test(x):
|
|
141
|
-
return re.match(uintx_re, x) and 0 <= int(x) < uint32_max
|
|
141
|
+
def uint32_test(x: str) -> bool:
|
|
142
|
+
return re.match(uintx_re, x) is not None and 0 <= int(x) < uint32_max
|
|
142
143
|
|
|
143
144
|
|
|
144
|
-
def uint64_test(x):
|
|
145
|
-
return re.match(uintx_re, x) and 0 <= int(x) < uint64_max
|
|
145
|
+
def uint64_test(x: str) -> bool:
|
|
146
|
+
return re.match(uintx_re, x) is not None and 0 <= int(x) < uint64_max
|
|
146
147
|
|
|
147
148
|
|
|
148
|
-
def uint128_test(x):
|
|
149
|
-
return re.match(intx_re, x) and 0 <= int(x) < uint128_max
|
|
149
|
+
def uint128_test(x: str) -> bool:
|
|
150
|
+
return re.match(intx_re, x) is not None and 0 <= int(x) < uint128_max
|
|
150
151
|
|
|
151
152
|
|
|
152
|
-
def uint256_test(x):
|
|
153
|
-
return re.match(intx_re, x) and 0 <= int(x) < uint256_max
|
|
153
|
+
def uint256_test(x: str) -> bool:
|
|
154
|
+
return re.match(intx_re, x) is not None and 0 <= int(x) < uint256_max
|
|
154
155
|
|
|
155
156
|
|
|
156
|
-
def float_test(x):
|
|
157
|
+
def float_test(x: str) -> bool:
|
|
157
158
|
return "_" not in x and type_test(x, float)
|
|
158
159
|
|
|
159
160
|
|
|
160
|
-
def float32_test(x):
|
|
161
|
+
def float32_test(x: str) -> bool:
|
|
161
162
|
return "_" not in x and type_test(x, float) and -float32_max <= float(x) < float32_max
|
|
162
163
|
|
|
163
164
|
|
|
164
|
-
def float64_test(x):
|
|
165
|
+
def float64_test(x: str) -> bool:
|
|
165
166
|
return "_" not in x and type_test(x, float) and -float64_max < float(x) < float64_max
|
|
166
167
|
|
|
167
168
|
|
|
168
|
-
def bool_test(x):
|
|
169
|
+
def bool_test(x: str) -> bool:
|
|
169
170
|
return x in bool_allowed_values
|
|
170
171
|
|
|
171
172
|
|
|
172
|
-
def test_numeric_testers(fn, n):
|
|
173
|
+
def test_numeric_testers(fn: Callable[[str], bool], n: int) -> bool:
|
|
173
174
|
"""
|
|
174
175
|
>>> test_numeric_testers(int32_test, (2**31)-1)
|
|
175
176
|
True
|
|
@@ -192,7 +193,7 @@ def test_numeric_testers(fn, n):
|
|
|
192
193
|
return fn(str(n))
|
|
193
194
|
|
|
194
195
|
|
|
195
|
-
def array_test(_type_test):
|
|
196
|
+
def array_test(_type_test: type) -> Callable[[str], bool]:
|
|
196
197
|
"""
|
|
197
198
|
>>> array_test(str)("['blabla']")
|
|
198
199
|
True
|
|
@@ -220,7 +221,7 @@ def array_test(_type_test):
|
|
|
220
221
|
False
|
|
221
222
|
"""
|
|
222
223
|
|
|
223
|
-
def _test(x):
|
|
224
|
+
def _test(x: str) -> bool:
|
|
224
225
|
if x[0] != "[":
|
|
225
226
|
return False
|
|
226
227
|
try:
|
|
@@ -234,7 +235,7 @@ def array_test(_type_test):
|
|
|
234
235
|
return _test
|
|
235
236
|
|
|
236
237
|
|
|
237
|
-
numbers_types = (
|
|
238
|
+
numbers_types: Tuple[str, ...] = (
|
|
238
239
|
"Int8",
|
|
239
240
|
"UInt8",
|
|
240
241
|
"Int16",
|
|
@@ -253,7 +254,7 @@ numbers_types = (
|
|
|
253
254
|
|
|
254
255
|
# Use guessers for discovering types
|
|
255
256
|
# I.e., when you have to take into consideration things like float precision
|
|
256
|
-
guessers = {
|
|
257
|
+
guessers: Dict[str, Callable[[str], bool]] = {
|
|
257
258
|
"DateTime64": datetime64_test,
|
|
258
259
|
"DateTime": datetime_test,
|
|
259
260
|
"Date": date_test,
|
|
@@ -274,7 +275,7 @@ guessers = {
|
|
|
274
275
|
|
|
275
276
|
# Use testers validating a value against a type
|
|
276
277
|
# I.e., you already know the type and you need to check if a value fits there
|
|
277
|
-
testers = {
|
|
278
|
+
testers: Dict[str, Callable[[str], bool]] = {
|
|
278
279
|
"DateTime64": datetime64_test,
|
|
279
280
|
"DateTime": datetime_test,
|
|
280
281
|
"Date": date_test,
|
|
@@ -300,7 +301,7 @@ testers = {
|
|
|
300
301
|
|
|
301
302
|
|
|
302
303
|
# Search for `canBeInsideNullable` under CH code and see which ones are true.
|
|
303
|
-
nullable_types = [
|
|
304
|
+
nullable_types: List[str] = [
|
|
304
305
|
"Date",
|
|
305
306
|
"Date32",
|
|
306
307
|
"DateTime",
|
|
@@ -340,7 +341,7 @@ nullable_types = [
|
|
|
340
341
|
]
|
|
341
342
|
|
|
342
343
|
|
|
343
|
-
def type_test(i, t):
|
|
344
|
+
def type_test(i: str, t: type) -> bool:
|
|
344
345
|
try:
|
|
345
346
|
t(i)
|
|
346
347
|
return True
|
|
@@ -348,7 +349,7 @@ def type_test(i, t):
|
|
|
348
349
|
return False
|
|
349
350
|
|
|
350
351
|
|
|
351
|
-
def parse_decimal_type(typ):
|
|
352
|
+
def parse_decimal_type(typ: str) -> Optional[Tuple[int, int, int]]:
|
|
352
353
|
"""
|
|
353
354
|
>>> parse_decimal_type("decimal")
|
|
354
355
|
|
|
@@ -407,19 +408,7 @@ def parse_decimal_type(typ):
|
|
|
407
408
|
return b, p, s
|
|
408
409
|
|
|
409
410
|
|
|
410
|
-
def
|
|
411
|
-
"""
|
|
412
|
-
>>> is_type_decimal('Decimal')
|
|
413
|
-
True
|
|
414
|
-
>>> is_type_decimal("Decimal(10, 2)")
|
|
415
|
-
True
|
|
416
|
-
>>> is_type_decimal("decimal")
|
|
417
|
-
False
|
|
418
|
-
"""
|
|
419
|
-
return parse_decimal_type(type_to_check) is not None
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
def get_decimal_limits(p, s):
|
|
411
|
+
def get_decimal_limits(p: int, s: int) -> Tuple[Decimal, Decimal]:
|
|
423
412
|
"""
|
|
424
413
|
>>> get_decimal_limits(1, 0)
|
|
425
414
|
(Decimal('-9'), Decimal('9'))
|
tinybird/git_settings.py
CHANGED
|
@@ -105,10 +105,10 @@ DEFAULT_INIT_FILES_DEPLOY = {
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
class SemverVersions(Enum):
|
|
108
|
-
MAJOR
|
|
109
|
-
MINOR
|
|
110
|
-
PATCH
|
|
111
|
-
CURRENT
|
|
108
|
+
MAJOR = "major"
|
|
109
|
+
MINOR = "minor"
|
|
110
|
+
PATCH = "patch"
|
|
111
|
+
CURRENT = "current"
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
def bump_version(version: str, next_version: Optional[str]) -> str:
|