tinybird 0.0.1.dev149__tar.gz → 0.0.1.dev151__tar.gz
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-0.0.1.dev149 → tinybird-0.0.1.dev151}/PKG-INFO +1 -1
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/__cli__.py +2 -2
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/cli.py +10 -3
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/common.py +0 -8
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/deprecations.py +7 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/local_common.py +19 -5
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/test.py +33 -5
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird.egg-info/PKG-INFO +1 -1
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/setup.cfg +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/config.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/datafile.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/prompts.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/sql_template.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/cli.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/client.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/config.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/auth.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/build.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/create.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datasource.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/deployment.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/login.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/mock.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/open.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/project.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/shell.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/token.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird.egg-info/SOURCES.txt +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
|
|
|
4
4
|
__url__ = 'https://www.tinybird.co/docs/cli/introduction.html'
|
|
5
5
|
__author__ = 'Tinybird'
|
|
6
6
|
__author_email__ = 'support@tinybird.co'
|
|
7
|
-
__version__ = '0.0.1.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev151'
|
|
8
|
+
__revision__ = 'd9da445'
|
|
@@ -323,16 +323,23 @@ async def create_ctx_client(ctx: Context, config: Dict[str, Any], cloud: bool, s
|
|
|
323
323
|
return None
|
|
324
324
|
|
|
325
325
|
commands_always_cloud = ["pull", "infra"]
|
|
326
|
-
commands_always_local = ["build", "
|
|
327
|
-
|
|
326
|
+
commands_always_local = ["build", "dev"]
|
|
327
|
+
command_always_test = ["test"]
|
|
328
|
+
|
|
329
|
+
if (
|
|
330
|
+
(cloud or command in commands_always_cloud)
|
|
331
|
+
and command not in commands_always_local
|
|
332
|
+
and command not in command_always_test
|
|
333
|
+
):
|
|
328
334
|
click.echo(
|
|
329
335
|
FeedbackManager.gray(message=f"Running against Tinybird Cloud: Workspace {config.get('name', 'default')}")
|
|
330
336
|
)
|
|
331
337
|
return _get_tb_client(config.get("token", None), config["host"], staging=staging)
|
|
332
338
|
local = command in commands_always_local
|
|
339
|
+
test = command in command_always_test
|
|
333
340
|
if not local and command not in commands_always_local and command:
|
|
334
341
|
click.echo(FeedbackManager.gray(message="Running against Tinybird Local"))
|
|
335
|
-
return await get_tinybird_local_client(config, staging=staging)
|
|
342
|
+
return await get_tinybird_local_client(config, test=test, staging=staging)
|
|
336
343
|
|
|
337
344
|
|
|
338
345
|
def get_target_env(cloud: bool) -> str:
|
|
@@ -846,14 +846,6 @@ def _parse_table_structure(schema: str) -> List[Dict[str, Any]]:
|
|
|
846
846
|
lineno=line,
|
|
847
847
|
pos=pos,
|
|
848
848
|
)
|
|
849
|
-
if detected_type in ("Int", "UInt"):
|
|
850
|
-
t = detected_type
|
|
851
|
-
raise SchemaSyntaxError(
|
|
852
|
-
message=f"Precision is mandatory for {t} types",
|
|
853
|
-
hint=f"Hint: use one of {t}8, {t}16, {t}32, {t}64, {t}128, {t}256",
|
|
854
|
-
lineno=line,
|
|
855
|
-
pos=pos - len(t),
|
|
856
|
-
)
|
|
857
849
|
|
|
858
850
|
try:
|
|
859
851
|
# Imported in the body to be compatible with the CLI
|
|
@@ -9,6 +9,7 @@ from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
|
9
9
|
context_settings=dict(
|
|
10
10
|
ignore_unknown_options=True,
|
|
11
11
|
),
|
|
12
|
+
hidden=True,
|
|
12
13
|
)
|
|
13
14
|
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
14
15
|
def branch(args) -> None:
|
|
@@ -30,6 +31,7 @@ def branch(args) -> None:
|
|
|
30
31
|
context_settings=dict(
|
|
31
32
|
ignore_unknown_options=True,
|
|
32
33
|
),
|
|
34
|
+
hidden=True,
|
|
33
35
|
)
|
|
34
36
|
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
35
37
|
def check(args) -> None:
|
|
@@ -47,6 +49,7 @@ def check(args) -> None:
|
|
|
47
49
|
context_settings=dict(
|
|
48
50
|
ignore_unknown_options=True,
|
|
49
51
|
),
|
|
52
|
+
hidden=True,
|
|
50
53
|
)
|
|
51
54
|
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
52
55
|
def diff(args) -> None:
|
|
@@ -64,6 +67,7 @@ def diff(args) -> None:
|
|
|
64
67
|
context_settings=dict(
|
|
65
68
|
ignore_unknown_options=True,
|
|
66
69
|
),
|
|
70
|
+
hidden=True,
|
|
67
71
|
)
|
|
68
72
|
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
69
73
|
def fmt(args) -> None:
|
|
@@ -81,6 +85,7 @@ def fmt(args) -> None:
|
|
|
81
85
|
context_settings=dict(
|
|
82
86
|
ignore_unknown_options=True,
|
|
83
87
|
),
|
|
88
|
+
hidden=True,
|
|
84
89
|
)
|
|
85
90
|
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
86
91
|
def init(args) -> None:
|
|
@@ -98,6 +103,7 @@ def init(args) -> None:
|
|
|
98
103
|
context_settings=dict(
|
|
99
104
|
ignore_unknown_options=True,
|
|
100
105
|
),
|
|
106
|
+
hidden=True,
|
|
101
107
|
)
|
|
102
108
|
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
103
109
|
def push(args) -> None:
|
|
@@ -115,6 +121,7 @@ def push(args) -> None:
|
|
|
115
121
|
context_settings=dict(
|
|
116
122
|
ignore_unknown_options=True,
|
|
117
123
|
),
|
|
124
|
+
hidden=True,
|
|
118
125
|
)
|
|
119
126
|
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
120
127
|
def tag(args) -> None:
|
|
@@ -18,14 +18,14 @@ TB_LOCAL_HOST = re.sub(r"^https?://", "", os.getenv("TB_LOCAL_HOST", "localhost"
|
|
|
18
18
|
TB_LOCAL_ADDRESS = f"http://{TB_LOCAL_HOST}:{TB_LOCAL_PORT}"
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
async def get_tinybird_local_client(config_obj: Dict[str, Any], staging: bool = False) -> TinyB:
|
|
21
|
+
async def get_tinybird_local_client(config_obj: Dict[str, Any], test: bool = False, staging: bool = False) -> TinyB:
|
|
22
22
|
"""Get a Tinybird client connected to the local environment."""
|
|
23
23
|
|
|
24
|
-
config = await get_tinybird_local_config(config_obj)
|
|
24
|
+
config = await get_tinybird_local_config(config_obj, test=test)
|
|
25
25
|
return config.get_client(host=TB_LOCAL_ADDRESS, staging=staging)
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
async def get_tinybird_local_config(config_obj: Dict[str, Any]) -> CLIConfig:
|
|
28
|
+
async def get_tinybird_local_config(config_obj: Dict[str, Any], test: bool = False) -> CLIConfig:
|
|
29
29
|
"""Craft a client config with a workspace name based on the path of the project files
|
|
30
30
|
|
|
31
31
|
It uses the tokens from tinybird local
|
|
@@ -47,7 +47,10 @@ async def get_tinybird_local_config(config_obj: Dict[str, Any]) -> CLIConfig:
|
|
|
47
47
|
# Create a new workspace if path is provided. This is used to isolate the build in a different workspace.
|
|
48
48
|
if path:
|
|
49
49
|
user_client = config.get_client(host=TB_LOCAL_ADDRESS, token=user_token)
|
|
50
|
-
|
|
50
|
+
if test:
|
|
51
|
+
ws_name = get_test_workspace_name(path)
|
|
52
|
+
else:
|
|
53
|
+
ws_name = config.get("name") or config_obj.get("name") or get_build_workspace_name(path)
|
|
51
54
|
if not ws_name:
|
|
52
55
|
raise AuthNoTokenException()
|
|
53
56
|
|
|
@@ -61,6 +64,13 @@ async def get_tinybird_local_config(config_obj: Dict[str, Any]) -> CLIConfig:
|
|
|
61
64
|
|
|
62
65
|
ws = next((ws for ws in local_workspaces if ws["name"] == ws_name), None)
|
|
63
66
|
|
|
67
|
+
# If we are running a test, we need to delete the workspace if it already exists
|
|
68
|
+
if test and ws:
|
|
69
|
+
requests.delete(
|
|
70
|
+
f"{TB_LOCAL_ADDRESS}/v1/workspaces/{ws['id']}?token={user_token}&hard_delete_confirmation=yes"
|
|
71
|
+
)
|
|
72
|
+
ws = None
|
|
73
|
+
|
|
64
74
|
if not ws:
|
|
65
75
|
await user_client.create_workspace(
|
|
66
76
|
ws_name, template=None, assign_to_organization_id=user_org_id, version="v1"
|
|
@@ -71,7 +81,6 @@ async def get_tinybird_local_config(config_obj: Dict[str, Any]) -> CLIConfig:
|
|
|
71
81
|
raise AuthNoTokenException()
|
|
72
82
|
|
|
73
83
|
ws_token = ws["token"]
|
|
74
|
-
|
|
75
84
|
config.set_token(ws_token)
|
|
76
85
|
config.set_token_for_host(TB_LOCAL_ADDRESS, ws_token)
|
|
77
86
|
config.set_host(TB_LOCAL_ADDRESS)
|
|
@@ -86,3 +95,8 @@ async def get_tinybird_local_config(config_obj: Dict[str, Any]) -> CLIConfig:
|
|
|
86
95
|
def get_build_workspace_name(path: str) -> str:
|
|
87
96
|
folder_hash = hashlib.sha256(path.encode()).hexdigest()
|
|
88
97
|
return f"Tinybird_Local_Build_{folder_hash}"
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def get_test_workspace_name(path: str) -> str:
|
|
101
|
+
folder_hash = hashlib.sha256(path.encode()).hexdigest()
|
|
102
|
+
return f"Tinybird_Local_Test_{folder_hash}"
|
|
@@ -8,22 +8,25 @@ import difflib
|
|
|
8
8
|
import glob
|
|
9
9
|
import sys
|
|
10
10
|
import urllib.parse
|
|
11
|
+
from copy import deepcopy
|
|
11
12
|
from pathlib import Path
|
|
12
13
|
from typing import Any, Dict, List, Optional, Tuple
|
|
13
14
|
|
|
14
15
|
import click
|
|
16
|
+
import requests
|
|
15
17
|
import yaml
|
|
16
18
|
from requests import Response
|
|
17
19
|
|
|
18
20
|
from tinybird.prompts import test_create_prompt
|
|
19
21
|
from tinybird.tb.client import TinyB
|
|
20
|
-
from tinybird.tb.modules.build import process
|
|
22
|
+
from tinybird.tb.modules.build import process as build_project
|
|
21
23
|
from tinybird.tb.modules.cli import cli
|
|
22
24
|
from tinybird.tb.modules.config import CLIConfig
|
|
23
|
-
from tinybird.tb.modules.exceptions import CLITestException
|
|
25
|
+
from tinybird.tb.modules.exceptions import CLILocalException, CLITestException
|
|
24
26
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
25
27
|
from tinybird.tb.modules.llm import LLM
|
|
26
28
|
from tinybird.tb.modules.llm_utils import extract_xml, parse_xml
|
|
29
|
+
from tinybird.tb.modules.local_common import TB_LOCAL_ADDRESS, get_test_workspace_name
|
|
27
30
|
from tinybird.tb.modules.project import Project
|
|
28
31
|
|
|
29
32
|
yaml.SafeDumper.org_represent_str = yaml.SafeDumper.represent_str # type: ignore[attr-defined]
|
|
@@ -77,7 +80,7 @@ def test_create(ctx: click.Context, name_or_filename: str, prompt: str) -> None:
|
|
|
77
80
|
project: Project = ctx.ensure_object(dict)["project"]
|
|
78
81
|
client: TinyB = ctx.ensure_object(dict)["client"]
|
|
79
82
|
click.echo(FeedbackManager.highlight(message="\n» Building project"))
|
|
80
|
-
|
|
83
|
+
build_project(project=project, tb_client=client, watch=False, silent=True)
|
|
81
84
|
click.echo(FeedbackManager.info(message="✓ Done!\n"))
|
|
82
85
|
config = CLIConfig.get_project_config()
|
|
83
86
|
folder = project.folder
|
|
@@ -140,6 +143,8 @@ def test_create(ctx: click.Context, name_or_filename: str, prompt: str) -> None:
|
|
|
140
143
|
click.echo(FeedbackManager.success(message="✓ Done!\n"))
|
|
141
144
|
except Exception as e:
|
|
142
145
|
raise CLITestException(FeedbackManager.error(message=str(e)))
|
|
146
|
+
finally:
|
|
147
|
+
cleanup_test_workspace(client, project.folder)
|
|
143
148
|
|
|
144
149
|
|
|
145
150
|
@test.command(
|
|
@@ -154,7 +159,7 @@ def test_update(ctx: click.Context, pipe: str) -> None:
|
|
|
154
159
|
project: Project = ctx.ensure_object(dict)["project"]
|
|
155
160
|
folder = project.folder
|
|
156
161
|
click.echo(FeedbackManager.highlight(message="\n» Building project"))
|
|
157
|
-
|
|
162
|
+
build_project(project=project, tb_client=client, watch=False, silent=True)
|
|
158
163
|
click.echo(FeedbackManager.info(message="✓ Done!"))
|
|
159
164
|
pipe_tests_path = get_pipe_path(pipe, folder)
|
|
160
165
|
pipe_name = pipe_tests_path.stem
|
|
@@ -191,6 +196,8 @@ def test_update(ctx: click.Context, pipe: str) -> None:
|
|
|
191
196
|
click.echo(FeedbackManager.success(message="✓ Done!\n"))
|
|
192
197
|
except Exception as e:
|
|
193
198
|
raise CLITestException(FeedbackManager.error(message=str(e)))
|
|
199
|
+
finally:
|
|
200
|
+
cleanup_test_workspace(client, project.folder)
|
|
194
201
|
|
|
195
202
|
|
|
196
203
|
@test.command(
|
|
@@ -204,7 +211,7 @@ def run_tests(ctx: click.Context, name: Tuple[str, ...]) -> None:
|
|
|
204
211
|
client: TinyB = ctx.ensure_object(dict)["client"]
|
|
205
212
|
project: Project = ctx.ensure_object(dict)["project"]
|
|
206
213
|
click.echo(FeedbackManager.highlight(message="\n» Building project"))
|
|
207
|
-
|
|
214
|
+
build_project(project=project, tb_client=client, watch=False, silent=True)
|
|
208
215
|
click.echo(FeedbackManager.info(message="✓ Done!"))
|
|
209
216
|
|
|
210
217
|
click.echo(FeedbackManager.highlight(message="\n» Running tests"))
|
|
@@ -268,6 +275,8 @@ def run_tests(ctx: click.Context, name: Tuple[str, ...]) -> None:
|
|
|
268
275
|
click.echo(FeedbackManager.success(message=f"\n✓ {test_count}/{test_count} passed"))
|
|
269
276
|
except Exception as e:
|
|
270
277
|
raise CLITestException(FeedbackManager.error(message=str(e)))
|
|
278
|
+
finally:
|
|
279
|
+
cleanup_test_workspace(client, project.folder)
|
|
271
280
|
|
|
272
281
|
|
|
273
282
|
async def get_pipe_data(client: TinyB, pipe_name: str, test_params: str) -> Response:
|
|
@@ -301,3 +310,22 @@ def get_pipe_path(name_or_filename: str, folder: str) -> Path:
|
|
|
301
310
|
raise Exception(f"Pipe {name_or_filename} not found")
|
|
302
311
|
|
|
303
312
|
return pipe_path
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def cleanup_test_workspace(client: TinyB, path: str) -> None:
|
|
316
|
+
user_client = deepcopy(client)
|
|
317
|
+
try:
|
|
318
|
+
# ruff: noqa: ASYNC210
|
|
319
|
+
tokens = requests.get(f"{TB_LOCAL_ADDRESS}/tokens").json()
|
|
320
|
+
except Exception:
|
|
321
|
+
raise CLILocalException(
|
|
322
|
+
FeedbackManager.error(message="Tinybird local is not running. Please run `tb local start` first.")
|
|
323
|
+
)
|
|
324
|
+
try:
|
|
325
|
+
user_token = tokens["user_token"]
|
|
326
|
+
user_client.token = user_token
|
|
327
|
+
asyncio.run(
|
|
328
|
+
user_client.delete_workspace(get_test_workspace_name(path), hard_delete_confirmation="yes", version="v1")
|
|
329
|
+
)
|
|
330
|
+
except Exception:
|
|
331
|
+
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/build_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/build_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/format_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/format_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/parse_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/datafile/pipe_checker.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb/modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/tinyunit/tinyunit.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev149 → tinybird-0.0.1.dev151}/tinybird/tb_cli_modules/workspace_members.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|