tinybird 0.0.1.dev43__py3-none-any.whl → 0.0.1.dev44__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.

@@ -6,7 +6,7 @@ tinybird/context.py,sha256=A3GBApac9xO6hrAMJ1s9dMrI_ou9aKF84CdEjtPddMk,1417
6
6
  tinybird/datatypes.py,sha256=XNypumfqNjsvLJ5iNXnbVHRvAJe0aQwI3lS6Cxox-e0,10979
7
7
  tinybird/feedback_manager.py,sha256=g1r9NcFfKXdk_13soaiTZLvdoUGleVfawl6Yfj3zmRw,67823
8
8
  tinybird/git_settings.py,sha256=Sw_8rGmribEFJ4Z_6idrVytxpFYk7ez8ei0qHULzs3E,3934
9
- tinybird/prompts.py,sha256=GEf-14SZZIAYcNUIbwnmmCrhylrRy6EuDyGo8-_Z6jo,25672
9
+ tinybird/prompts.py,sha256=pgG-Gwtx8ZQf6XWjMibYVTmW4doykP4gnJda1qA54NY,26746
10
10
  tinybird/sql.py,sha256=igHaRIeEREN5XYowwpIGYG8gDB5kn5p2cDNL1t8uc40,46168
11
11
  tinybird/sql_template.py,sha256=GmMLAI10MTqjQo9qztuQHLRWs67teozsWDxUBdvkAn4,93668
12
12
  tinybird/sql_template_fmt.py,sha256=KUHdj5rYCYm_rKKdXYSJAE9vIyXUQLB0YSZnUXHeBlY,10196
@@ -15,20 +15,19 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
15
15
  tinybird/tornado_template.py,sha256=FL85SMPq2dH4JqKovmSbaolGdEzwOO91NqOzqXo2Qr0,41863
16
16
  tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
17
17
  tinybird/ch_utils/engine.py,sha256=OXkBhlzGjZotjD0vaT-rFIbSGV4tpiHxE8qO_ip0SyQ,40454
18
- tinybird/tb/__cli__.py,sha256=ezvYUt2sERQfnRCQPlsLhgBYbA8MgSBu2-Y-q-WNVug,251
19
- tinybird/tb/cli.py,sha256=_kYDnDS3a45MMKJFZnYZx1gLuVqs4N_Rt8GO4sueAeg,957
18
+ tinybird/tb/__cli__.py,sha256=Hf3ON8UnNJYBmDMYOxmtXUDe3zHYepJYO2kbuaSwKvc,251
19
+ tinybird/tb/cli.py,sha256=X6zLCVI10wOxcu-USGfbp_jjz1cojH5X-9dL7D8c8aI,960
20
20
  tinybird/tb/modules/auth.py,sha256=EzRWFmwRkXNhUmRaruEVFLdkbUg8xMSix0cAWl5D4Jg,9029
21
- tinybird/tb/modules/build.py,sha256=mdry4XN8rIOomgOXBJmJwF53y2xzY8sej58PQEdSzz0,7647
22
- tinybird/tb/modules/build_client.py,sha256=3gKxFFNjgUDDPiBpGeLhmm6RB2TNj6e3Z8yUuEg3DEc,7232
21
+ tinybird/tb/modules/build.py,sha256=sE9SYshNS10kFJor1oLES_ivG6Z573dnrk2W_7EvGmg,7973
23
22
  tinybird/tb/modules/cicd.py,sha256=xxXwy-QekJcG14kkJeGNl7LkHduhZXfvBZE8WrU6-t4,5351
24
- tinybird/tb/modules/cli.py,sha256=8pyz442S-s_Xdr-jPCfVeBwQ4RJC09B4BDKaVhYfpR4,19442
25
- tinybird/tb/modules/common.py,sha256=e4U7AT0dUBG6O-7Iq2CVN1UHPd6-ZCFucyW0L5gBi4g,70592
23
+ tinybird/tb/modules/cli.py,sha256=O-kmEanr1W1Uxun8N8CM9aD6dlTLsuccoWgdQYpKqco,17271
24
+ tinybird/tb/modules/common.py,sha256=4eaiTsjbjg_UtW52PrhdcBdjiBQs8G5Iih42wW8eTi8,70613
26
25
  tinybird/tb/modules/config.py,sha256=mie3oMVTf5YOUFEiLs88P16U4LkJafJjSpjwyAkFHog,10979
27
- tinybird/tb/modules/copy.py,sha256=QwEloYVSM4zIQ8iTRyLx355-GvZ-BEJ-kzSX81PcRXw,5927
28
- tinybird/tb/modules/create.py,sha256=iUYt5XG-GPwE3LnHrWqlOHmke0Bv8VMPxjAffxRFYoQ,11438
29
- tinybird/tb/modules/datasource.py,sha256=-VG2qKlu0fmkhsIB5bPiTp3XuktB_r-ZkIoohEBEXtI,13713
30
- tinybird/tb/modules/deployment.py,sha256=TaFpS6aowGaZ-XjvMdof2sO7yJS2MCsZRqmB3v3_eSs,10228
31
- tinybird/tb/modules/endpoint.py,sha256=tR0_NEZd0INJEPO6e4manWc6Qw5FT4IZFW6muxTCnrI,6498
26
+ tinybird/tb/modules/copy.py,sha256=wxyxZg8BPiWDgbW5HXJKYQp7_EumBXmAilo3McbCQOo,5916
27
+ tinybird/tb/modules/create.py,sha256=AJz-oFJGHzKuH7_Dy-shYjTI9KSf9ZaE0Ely4rgvXPw,13646
28
+ tinybird/tb/modules/datasource.py,sha256=hHt-rn4VWrQ4EWG797wnLqRhRP-3C4chAdk_vXxCmVI,13712
29
+ tinybird/tb/modules/deployment.py,sha256=0e00lLMaNoVnONYdA51Zy9Sa_-4jWqePoYeFyHUn5PU,10241
30
+ tinybird/tb/modules/endpoint.py,sha256=9arqN1JQCMb0Nd3-EJ7lukOYkGHHCpQmiiZpp5FqPhc,9432
32
31
  tinybird/tb/modules/exceptions.py,sha256=4A2sSjCEqKUMqpP3WI00zouCWW4uLaghXXLZBSw04mY,3363
33
32
  tinybird/tb/modules/feedback_manager.py,sha256=e8tqehRR0Buhs8O0n8N2Sg2vnnBVb1NLtnZqkPrYD_A,68379
34
33
  tinybird/tb/modules/fmt.py,sha256=poh6_cwVGSf-sBu6LKWuO2TANL_J8Sgm25sPpwxa3Aw,3558
@@ -38,21 +37,22 @@ tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCf
38
37
  tinybird/tb/modules/local.py,sha256=x4xuCGVkoa8KLYGZEJnFUP8HUkKX05Frp_djRVjVjTs,5669
39
38
  tinybird/tb/modules/local_common.py,sha256=afPW6bSc-YI7Q4ngvBV53sM7QxnPGBMe5N91iETM2yE,2783
40
39
  tinybird/tb/modules/login.py,sha256=0cS-f3MsQFHc6xjw8FRWJm4EJBH9C7Ri68EcO_tiwes,6508
41
- tinybird/tb/modules/mock.py,sha256=XoCaFFroJf2jWVxEztPelwXYNle__KilON1e81Mxkd4,3764
42
- tinybird/tb/modules/pipe.py,sha256=fQAlH5V00rKl9kvBWTjgAC3scvNA00ogANGT5hozxkI,14051
43
- tinybird/tb/modules/project.py,sha256=9bP6G4LUMkkeC_M47d89fKt2Bg_yEMPsO9u5eQW68uo,2450
40
+ tinybird/tb/modules/materialization.py,sha256=HQKRTH6lkcYiDQJihbFqF_in58ezXG4ggZ_7Ywp_nUM,5738
41
+ tinybird/tb/modules/mock.py,sha256=maaPY91mQx8m9x-1-2r9svljRO8VO8-uqD-71VfXBCU,5271
42
+ tinybird/tb/modules/pipe.py,sha256=NdzqLsyU2WZ4S5JXGc2CozvGh0WaGL2rsoZ8iQERjm8,2359
43
+ tinybird/tb/modules/project.py,sha256=YH-pwioIBIYxSmy6awM6Ya6WoB7MSM2fte-x9Gbr6lc,2604
44
44
  tinybird/tb/modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
45
45
  tinybird/tb/modules/shell.py,sha256=iCX9HsvNhVDecop-s4zDPjXfL9GQ56-QODqwHsN5oT8,12994
46
46
  tinybird/tb/modules/table.py,sha256=4XrtjM-N0zfNtxVkbvLDQQazno1EPXnxTyo7llivfXk,11035
47
47
  tinybird/tb/modules/tag.py,sha256=anPmMUBc-TbFovlpFi8GPkKA18y7Y0GczMsMms5TZsU,3502
48
48
  tinybird/tb/modules/telemetry.py,sha256=iEGnMuCuNhvF6ln__j6X9MSTwL_0Hm-GgFHHHvhfknk,10466
49
- tinybird/tb/modules/test.py,sha256=zciS9klk2dNBiyncqtXgGTVao1B7p4S9hg_Oat_FJIY,11616
49
+ tinybird/tb/modules/test.py,sha256=_I3xufediPNrAi1L2JkFHNwZEWebwVPzSF0iWJCzTsc,13088
50
50
  tinybird/tb/modules/token.py,sha256=sPdJoBE-6dd3Sd6W-prst7VOoJ0NbvP0uTaB6dXHs5s,12711
51
- tinybird/tb/modules/update.py,sha256=RCOGhxJPhlwCzRzPPYFfbvpJeDKu3yEISWUJinr953M,6821
51
+ tinybird/tb/modules/update.py,sha256=GWYfbKnB0yf4ywAUp8jItaZY0ltBnaIMcLSiPpwtbMc,6832
52
52
  tinybird/tb/modules/watch.py,sha256=Kredt5C7OOiI6YOivuR5QBdiDY4J_xLiwqHOROnfcsU,8591
53
53
  tinybird/tb/modules/workspace.py,sha256=M0RtXCaw7RdZ3c_fqtmjbVb7HqlV742Drn4OiyZlp3M,6345
54
54
  tinybird/tb/modules/workspace_members.py,sha256=Ai6iCOzXX1zQ8q9iXIFSFHsBJlT-8Q28DaG5Ie-UweY,8726
55
- tinybird/tb/modules/datafile/build.py,sha256=bq_As61bOqPF0NzeUq8sx3EnCCte4KDoDQZYW6n6UIw,59060
55
+ tinybird/tb/modules/datafile/build.py,sha256=VgQ0k-dBNE0hXdnxB12NW5I0XpxEosN2vaszboj3LZY,51045
56
56
  tinybird/tb/modules/datafile/build_common.py,sha256=IXl-Z51zUi1dypV7meNenX0iu2UmowNeqgG6WHyMHlk,4562
57
57
  tinybird/tb/modules/datafile/build_datasource.py,sha256=4aP8_DYCRGghXntZSeWDNJxjps1QRVa7WHoYCzQwQts,17355
58
58
  tinybird/tb/modules/datafile/build_pipe.py,sha256=Jgv3YKIvMfjPiSIdw1k2mpaoDdAWMiMRaSHwRgyI97E,28258
@@ -75,8 +75,8 @@ tinybird/tb_cli_modules/config.py,sha256=6u6B5QCdiQLbJkCkwtnKGs9H3nP-KXXhC75mF7B
75
75
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
76
76
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
77
77
  tinybird/tb_cli_modules/telemetry.py,sha256=iEGnMuCuNhvF6ln__j6X9MSTwL_0Hm-GgFHHHvhfknk,10466
78
- tinybird-0.0.1.dev43.dist-info/METADATA,sha256=8vZ7c2enj_Q8TUAt2lEOvC4KgA3VZ3Ony-v89LGotmc,2482
79
- tinybird-0.0.1.dev43.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
80
- tinybird-0.0.1.dev43.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
81
- tinybird-0.0.1.dev43.dist-info/top_level.txt,sha256=pgw6AzERHBcW3YTi2PW4arjxLkulk2msOz_SomfOEuc,45
82
- tinybird-0.0.1.dev43.dist-info/RECORD,,
78
+ tinybird-0.0.1.dev44.dist-info/METADATA,sha256=gJMWTcb2L9oHDngWSBCwCqgelvbVB_8fNyFZC5OBPDk,2482
79
+ tinybird-0.0.1.dev44.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
80
+ tinybird-0.0.1.dev44.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
81
+ tinybird-0.0.1.dev44.dist-info/top_level.txt,sha256=pgw6AzERHBcW3YTi2PW4arjxLkulk2msOz_SomfOEuc,45
82
+ tinybird-0.0.1.dev44.dist-info/RECORD,,
@@ -1,199 +0,0 @@
1
- import asyncio
2
- import os
3
- import threading
4
- import time
5
- from pathlib import Path
6
- from typing import List
7
-
8
- import click
9
-
10
- import tinybird.context as context
11
- from tinybird.client import TinyB
12
- from tinybird.config import FeatureFlags
13
- from tinybird.tb.modules.cli import cli
14
- from tinybird.tb.modules.common import push_data
15
- from tinybird.tb.modules.datafile.build import folder_build
16
- from tinybird.tb.modules.datafile.common import get_project_fixtures, has_internal_datafiles
17
- from tinybird.tb.modules.datafile.exceptions import ParseException
18
- from tinybird.tb.modules.datafile.fixture import build_fixture_name, get_fixture_dir
19
- from tinybird.tb.modules.datafile.parse_datasource import parse_datasource
20
- from tinybird.tb.modules.datafile.parse_pipe import parse_pipe
21
- from tinybird.tb.modules.feedback_manager import FeedbackManager
22
- from tinybird.tb.modules.local_common import get_tinybird_local_client
23
- from tinybird.tb.modules.project import Project
24
- from tinybird.tb.modules.shell import Shell, print_table_formatted
25
- from tinybird.tb.modules.watch import watch_files
26
-
27
-
28
- def is_vendor(f: Path) -> bool:
29
- return f.parts[0] == "vendor"
30
-
31
-
32
- def get_vendor_workspace(f: Path) -> str:
33
- return f.parts[1]
34
-
35
-
36
- def is_endpoint(f: Path) -> bool:
37
- return f.suffix == ".pipe" and not is_vendor(f) and f.parts[0] == "endpoints"
38
-
39
-
40
- def is_pipe(f: Path) -> bool:
41
- return f.suffix == ".pipe" and not is_vendor(f)
42
-
43
-
44
- def check_filenames(filenames: List[str]):
45
- parser_matrix = {".pipe": parse_pipe, ".datasource": parse_datasource}
46
- incl_suffix = ".incl"
47
-
48
- for filename in filenames:
49
- file_suffix = Path(filename).suffix
50
- if file_suffix == incl_suffix:
51
- continue
52
-
53
- parser = parser_matrix.get(file_suffix)
54
- if not parser:
55
- raise ParseException(FeedbackManager.error_unsupported_datafile(extension=file_suffix))
56
-
57
- parser(filename)
58
-
59
-
60
- @cli.command()
61
- @click.option(
62
- "--watch",
63
- is_flag=True,
64
- help="Watch for changes in the files and rebuild them.",
65
- )
66
- @click.pass_context
67
- def build_client(
68
- ctx: click.Context,
69
- watch: bool,
70
- ) -> None:
71
- """Build the project in Tinybird Local."""
72
- project: Project = ctx.ensure_object(dict)["project"]
73
- folder = project.folder
74
- ignore_sql_errors = FeatureFlags.ignore_sql_errors()
75
- context.disable_template_security_validation.set(True)
76
- is_internal = has_internal_datafiles(folder)
77
- folder_path = os.path.abspath(folder)
78
- tb_client = asyncio.run(get_tinybird_local_client(folder_path))
79
-
80
- async def process(filenames: List[str], watch: bool = False):
81
- datafiles = [f for f in filenames if f.endswith(".datasource") or f.endswith(".pipe")]
82
- if len(datafiles) > 0:
83
- check_filenames(filenames=datafiles)
84
- await folder_build(
85
- tb_client,
86
- filenames=datafiles,
87
- ignore_sql_errors=ignore_sql_errors,
88
- is_internal=is_internal,
89
- watch=watch,
90
- folder=folder,
91
- )
92
- if len(filenames) > 0:
93
- filename = filenames[0]
94
- if filename.endswith(".ndjson"):
95
- fixture_path = Path(filename)
96
- datasources_path = Path(folder) / "datasources"
97
- ds_name = fixture_path.stem
98
- ds_path = datasources_path / f"{ds_name}.datasource"
99
-
100
- if not ds_path.exists():
101
- try:
102
- ds_name = "_".join(fixture_path.stem.split("_")[:-1])
103
- ds_path = datasources_path / f"{ds_name}.datasource"
104
- except Exception:
105
- pass
106
-
107
- if ds_path.exists():
108
- await append_datasource(tb_client, ds_name, str(fixture_path))
109
-
110
- if watch:
111
- if filename.endswith(".datasource"):
112
- ds_path = Path(filename)
113
- ds_name = ds_path.stem
114
- name = build_fixture_name(filename, ds_name, ds_path.read_text())
115
- fixture_folder = get_fixture_dir(folder)
116
- fixture_path = fixture_folder / f"{name}.ndjson"
117
-
118
- if not fixture_path.exists():
119
- fixture_path = fixture_folder / f"{ds_name}.ndjson"
120
-
121
- if fixture_path.exists():
122
- await append_datasource(tb_client, ds_name, str(fixture_path))
123
-
124
- if not filename.endswith(".ndjson"):
125
- await build_and_print_resource(tb_client, filename)
126
-
127
- datafiles = project.get_project_files()
128
- fixtures = get_project_fixtures(folder)
129
- filenames = datafiles + fixtures
130
-
131
- async def build_once(filenames: List[str]):
132
- ok = False
133
- try:
134
- click.echo(FeedbackManager.highlight(message="» Building project...\n"))
135
- time_start = time.time()
136
- await process(filenames=filenames, watch=False)
137
- time_end = time.time()
138
- elapsed_time = time_end - time_start
139
- for filename in filenames:
140
- if filename.endswith(".datasource"):
141
- ds_path = Path(filename)
142
- ds_name = ds_path.stem
143
- name = build_fixture_name(filename, ds_name, ds_path.read_text())
144
- fixture_folder = get_fixture_dir(folder)
145
- fixture_path = fixture_folder / f"{name}.ndjson"
146
-
147
- if not fixture_path.exists():
148
- fixture_path = fixture_folder / f"{ds_name}.ndjson"
149
-
150
- if fixture_path.exists():
151
- await append_datasource(tb_client, ds_name, str(fixture_path))
152
- click.echo(FeedbackManager.success(message=f"\n✓ Build completed in {elapsed_time:.1f}s"))
153
- ok = True
154
- except Exception as e:
155
- error_path = Path(".tb_error.txt")
156
- if error_path.exists():
157
- content = error_path.read_text()
158
- content += f"\n\n{str(e)}"
159
- error_path.write_text(content)
160
- else:
161
- error_path.write_text(str(e))
162
- click.echo(FeedbackManager.error_exception(error=e))
163
- ok = False
164
- return ok
165
-
166
- build_ok = asyncio.run(build_once(filenames))
167
-
168
- if watch:
169
- shell = Shell(project=project, tb_client=tb_client)
170
- click.echo(FeedbackManager.gray(message="\nWatching for changes..."))
171
- watcher_thread = threading.Thread(
172
- target=watch_files, args=(filenames, process, shell, project, build_ok), daemon=True
173
- )
174
- watcher_thread.start()
175
- shell.run()
176
-
177
-
178
- async def build_and_print_resource(tb_client: TinyB, filename: str):
179
- resource_path = Path(filename)
180
- name = resource_path.stem
181
- pipeline = name if filename.endswith(".pipe") else None
182
- res = await tb_client.query(f"SELECT * FROM {name} FORMAT JSON", pipeline=pipeline)
183
- print_table_formatted(res, name)
184
-
185
-
186
- async def append_datasource(
187
- tb_client: TinyB,
188
- datasource_name: str,
189
- url: str,
190
- ):
191
- await tb_client.datasource_truncate(datasource_name)
192
- await push_data(
193
- tb_client,
194
- datasource_name,
195
- url,
196
- mode="append",
197
- concurrency=1,
198
- silent=True,
199
- )