tinybird 0.0.1.dev277__py3-none-any.whl → 0.0.1.dev279__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/tb/__cli__.py +2 -2
- tinybird/tb/modules/agent/agent.py +7 -7
- tinybird/tb/modules/agent/command_agent.py +6 -2
- tinybird/tb/modules/agent/prompts.py +68 -0
- tinybird/tb/modules/agent/tools/run_command.py +2 -2
- tinybird/tb/modules/agent/tools/secret.py +0 -1
- tinybird/tb/modules/agent/utils.py +0 -1
- tinybird/tb/modules/build.py +0 -3
- tinybird/tb/modules/build_common.py +0 -2
- tinybird/tb/modules/cli.py +5 -3
- tinybird/tb/modules/datasource.py +2 -0
- tinybird/tb/modules/exceptions.py +7 -0
- tinybird/tb/modules/local_common.py +4 -1
- tinybird/tb/modules/secret_common.py +7 -11
- tinybird/tb/modules/test_common.py +10 -7
- {tinybird-0.0.1.dev277.dist-info → tinybird-0.0.1.dev279.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev277.dist-info → tinybird-0.0.1.dev279.dist-info}/RECORD +20 -20
- {tinybird-0.0.1.dev277.dist-info → tinybird-0.0.1.dev279.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev277.dist-info → tinybird-0.0.1.dev279.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev277.dist-info → tinybird-0.0.1.dev279.dist-info}/top_level.txt +0 -0
tinybird/tb/__cli__.py
CHANGED
|
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
|
|
|
4
4
|
__url__ = 'https://www.tinybird.co/docs/forward/commands'
|
|
5
5
|
__author__ = 'Tinybird'
|
|
6
6
|
__author_email__ = 'support@tinybird.co'
|
|
7
|
-
__version__ = '0.0.1.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev279'
|
|
8
|
+
__revision__ = '9848d86'
|
|
@@ -64,7 +64,6 @@ from tinybird.tb.modules.local_common import get_tinybird_local_client
|
|
|
64
64
|
from tinybird.tb.modules.login_common import login
|
|
65
65
|
from tinybird.tb.modules.mock_common import append_mock_data, create_mock_data
|
|
66
66
|
from tinybird.tb.modules.project import Project
|
|
67
|
-
from tinybird.tb.modules.secret_common import load_secrets
|
|
68
67
|
from tinybird.tb.modules.test_common import run_tests as run_tests_common
|
|
69
68
|
|
|
70
69
|
|
|
@@ -95,7 +94,7 @@ class TinybirdAgent:
|
|
|
95
94
|
self.agent = Agent(
|
|
96
95
|
model=create_model(user_token, host, workspace_id),
|
|
97
96
|
deps_type=TinybirdAgentContext,
|
|
98
|
-
|
|
97
|
+
instructions=[agent_system_prompt],
|
|
99
98
|
tools=[
|
|
100
99
|
Tool(create_datafile, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
|
|
101
100
|
Tool(remove_file, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
|
|
@@ -193,7 +192,7 @@ class TinybirdAgent:
|
|
|
193
192
|
str: The result of the command.
|
|
194
193
|
"""
|
|
195
194
|
result = self.command_agent.run(task, deps=ctx.deps, usage=ctx.usage)
|
|
196
|
-
return result.output
|
|
195
|
+
return f"Result: {result.output}\nDo not repeat in your response the result again, because it is already displayed in the terminal."
|
|
197
196
|
|
|
198
197
|
@self.agent.tool
|
|
199
198
|
def explore_data(ctx: RunContext[TinybirdAgentContext], task: str) -> str:
|
|
@@ -206,7 +205,6 @@ class TinybirdAgent:
|
|
|
206
205
|
str: The summary of the result.
|
|
207
206
|
"""
|
|
208
207
|
result = self.explore_agent.run(task, deps=ctx.deps, usage=ctx.usage)
|
|
209
|
-
self.explore_agent.clear_messages()
|
|
210
208
|
return result.output or "No result returned"
|
|
211
209
|
|
|
212
210
|
@self.agent.instructions
|
|
@@ -297,7 +295,6 @@ class TinybirdAgent:
|
|
|
297
295
|
local_host=local_client.host,
|
|
298
296
|
local_token=local_client.token,
|
|
299
297
|
run_id=run_id,
|
|
300
|
-
load_secrets_local=partial(load_secrets, project=project, client=local_client),
|
|
301
298
|
)
|
|
302
299
|
|
|
303
300
|
def run(self, user_prompt: str, config: dict[str, Any]) -> None:
|
|
@@ -740,7 +737,7 @@ def is_natural_language(user_input: str, user_token: str, host: str) -> bool:
|
|
|
740
737
|
|
|
741
738
|
prompt = """Analyze the following text and determine if it's natural language or a SQL query.
|
|
742
739
|
|
|
743
|
-
Respond with only "NATURAL" if it's natural language (like a question, request, or conversational text), or "SQL" if it's a SQL query
|
|
740
|
+
Respond with only "NATURAL" if it's natural language (like a question, request, or conversational text), or "SQL" if it's a SQL query starting with SELECT or WITH statements.
|
|
744
741
|
|
|
745
742
|
Examples:
|
|
746
743
|
- "show me all users" -> NATURAL
|
|
@@ -748,8 +745,11 @@ Examples:
|
|
|
748
745
|
- "SELECT * FROM users" -> SQL
|
|
749
746
|
- "WITH cte AS (SELECT...) SELECT..." -> SQL
|
|
750
747
|
- "select count(*) from orders" -> SQL
|
|
751
|
-
- "help me analyze the data" -> NATURAL
|
|
748
|
+
- "help me analyze the data" -> NATURAL
|
|
749
|
+
- "select some page hits from analytics_events that happened yesterday" -> NATURAL
|
|
752
750
|
|
|
751
|
+
IMPORTANT: If you're not sure, default to NATURAL.
|
|
752
|
+
"""
|
|
753
753
|
try:
|
|
754
754
|
thinking_animation = ThinkingAnimation()
|
|
755
755
|
thinking_animation.start()
|
|
@@ -4,7 +4,7 @@ from pydantic_ai.usage import Usage
|
|
|
4
4
|
|
|
5
5
|
from tinybird.tb.modules.agent.animations import ThinkingAnimation
|
|
6
6
|
from tinybird.tb.modules.agent.models import create_model
|
|
7
|
-
from tinybird.tb.modules.agent.prompts import tests_files_prompt
|
|
7
|
+
from tinybird.tb.modules.agent.prompts import available_commands, tests_files_prompt
|
|
8
8
|
from tinybird.tb.modules.agent.tools.run_command import run_command
|
|
9
9
|
from tinybird.tb.modules.agent.utils import TinybirdAgentContext
|
|
10
10
|
from tinybird.tb.modules.project import Project
|
|
@@ -34,13 +34,17 @@ class CommandAgent:
|
|
|
34
34
|
model=create_model(user_token, host, workspace_id),
|
|
35
35
|
deps_type=TinybirdAgentContext,
|
|
36
36
|
instructions=[
|
|
37
|
-
"""
|
|
37
|
+
f"""
|
|
38
38
|
You are part of Tinybird Code, an agentic CLI that can help users to work with Tinybird.
|
|
39
39
|
You are a sub-agent of the main Tinybird Code agent. You are responsible for running commands on the user's machine.
|
|
40
40
|
You will be given a task to perform and you will use `run_command` tool to complete it.
|
|
41
41
|
If you do not find a command that can solve the task, just say that there is no command that can solve the task.
|
|
42
42
|
You can run `-h` in every level of the command to get help. E.g. `tb -h`, `tb datasource -h`, `tb datasource ls -h`.
|
|
43
43
|
When you need to access Tinybird Cloud, add the `--cloud` flag. E.g. `tb --cloud datasource ls`.
|
|
44
|
+
Available commands:
|
|
45
|
+
{available_commands}
|
|
46
|
+
IMPORTANT: Do NOT use any command that is not in the list above.
|
|
47
|
+
IMPORTANT: If you don't have the proper command to solve the task, just answer that you cannot solve the task.
|
|
44
48
|
Token and host are not required to add to the commands.
|
|
45
49
|
Always run first help commands to be sure that the commands you are running is not interactive.
|
|
46
50
|
""",
|
|
@@ -15,6 +15,28 @@ from tinybird.prompts import (
|
|
|
15
15
|
)
|
|
16
16
|
from tinybird.tb.modules.project import Project
|
|
17
17
|
|
|
18
|
+
available_commands = [
|
|
19
|
+
"`tb connection ls`: List all connections",
|
|
20
|
+
"`tb copy ls`: List all copy pipes",
|
|
21
|
+
"`tb copy run [pipe_name] --mode [mode] --param [param]`: Run a copy pipe",
|
|
22
|
+
"`tb datasource ls`: List all datasources",
|
|
23
|
+
"`tb datasource sync [datasource_name] --yes`: Sync a datasource with an s3 or gcs connection",
|
|
24
|
+
"`tb datasource truncate [datasource_name] --yes`: Truncate a datasource",
|
|
25
|
+
"`tb endpoint ls`: List all endpoints",
|
|
26
|
+
"`tb open`: Open the dashboard in the browser",
|
|
27
|
+
"`tb info`: Show information about the project",
|
|
28
|
+
"`tb job ls`: List all jobs",
|
|
29
|
+
"`tb job cancel [job_id]`: Cancel a job",
|
|
30
|
+
"`tb deployment ls`: List all deployments (if user does not specify use tb --cloud)",
|
|
31
|
+
"`tb deployment discard`: Discard a deployment (if user does not specify use tb --cloud)",
|
|
32
|
+
"`tb token ls`: List all tokens",
|
|
33
|
+
"`tb materialization ls`: List all materializations",
|
|
34
|
+
"`tb pipe ls`: List all pipes",
|
|
35
|
+
"`tb sink ls`: List all sinks",
|
|
36
|
+
"`tb workspace current`: Show the current workspace",
|
|
37
|
+
"`tb workspace clear --yes`: Delete all resources in the workspace (Only available in Tinybird Local)",
|
|
38
|
+
]
|
|
39
|
+
|
|
18
40
|
plan_instructions = """
|
|
19
41
|
When asked to create a plan, you MUST respond with this EXACT format and NOTHING ELSE:
|
|
20
42
|
|
|
@@ -118,6 +140,32 @@ datafile_instructions = """
|
|
|
118
140
|
</datafile_instructions>
|
|
119
141
|
"""
|
|
120
142
|
|
|
143
|
+
datasource_example_with_token = """
|
|
144
|
+
<datasource_example_with_token>
|
|
145
|
+
TOKEN app_read READ
|
|
146
|
+
TOKEN landing_read READ
|
|
147
|
+
TOKEN landing_append APPEND
|
|
148
|
+
|
|
149
|
+
DESCRIPTION >
|
|
150
|
+
...
|
|
151
|
+
|
|
152
|
+
SCHEMA >
|
|
153
|
+
...
|
|
154
|
+
</datasource_example_with_token>
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
pipe_example_with_token = """
|
|
158
|
+
<pipe_example_with_token>
|
|
159
|
+
TOKEN app_read READ
|
|
160
|
+
|
|
161
|
+
NODE node_1
|
|
162
|
+
SQL >
|
|
163
|
+
%
|
|
164
|
+
SELECT
|
|
165
|
+
..
|
|
166
|
+
</pipe_example_with_token>
|
|
167
|
+
"""
|
|
168
|
+
|
|
121
169
|
|
|
122
170
|
def resources_prompt(project: Project) -> str:
|
|
123
171
|
files = project.get_project_files()
|
|
@@ -796,6 +844,22 @@ IMPORTANT: Every time you finish a plan and start a new resource creation or upd
|
|
|
796
844
|
{pipe_instructions}
|
|
797
845
|
{pipe_example}
|
|
798
846
|
|
|
847
|
+
# When working with tokens:
|
|
848
|
+
- Resource-scoped tokens are created and updated through datafiles.
|
|
849
|
+
- Tinybird will keep track of which ones to create or destroy based on all the tokens defined within the data files in your project.
|
|
850
|
+
- Scopes available are:
|
|
851
|
+
- DATASOURCES:READ:datasource_name => `TOKEN <token_name> READ` in .datasource files
|
|
852
|
+
- DATASOURCES:APPEND:datasource_name => `TOKEN <token_name> APPEND` in .datasource files
|
|
853
|
+
- PIPES:READ:pipe_name => `TOKEN <token_name> READ` in .pipe files
|
|
854
|
+
- Examples:
|
|
855
|
+
{datasource_example_with_token}
|
|
856
|
+
{pipe_example_with_token}
|
|
857
|
+
- For operational tokens that are not tied to specific resources. Run the following command in the CLI:
|
|
858
|
+
```
|
|
859
|
+
tb token create static new_admin_token --scope <scope>
|
|
860
|
+
```
|
|
861
|
+
where <scope> is one of the following: `TOKENS`, `ADMIN`, `ORG_DATASOURCES:READ`
|
|
862
|
+
|
|
799
863
|
# Working with materialized pipe files:
|
|
800
864
|
{materialized_pipe_instructions}
|
|
801
865
|
|
|
@@ -844,6 +908,10 @@ IMPORTANT: Every time you finish a plan and start a new resource creation or upd
|
|
|
844
908
|
|
|
845
909
|
# Working with commands:
|
|
846
910
|
- If you dont have a tool that can solve the task, use `run_command` tool to check if the task can be solved with a normal tinybird cli command.
|
|
911
|
+
- Available commands: {available_commands}
|
|
912
|
+
|
|
913
|
+
# When asked about the files in the project:
|
|
914
|
+
- You can rely in your own context to answer the question.
|
|
847
915
|
|
|
848
916
|
# Info
|
|
849
917
|
Today is {datetime.now().strftime("%Y-%m-%d")}
|
|
@@ -15,10 +15,10 @@ def run_command(ctx: RunContext[TinybirdAgentContext], command: str):
|
|
|
15
15
|
"""
|
|
16
16
|
try:
|
|
17
17
|
ctx.deps.thinking_animation.stop()
|
|
18
|
-
|
|
18
|
+
force_confirmation = " deploy" in command.lower() or " truncate" in command.lower()
|
|
19
19
|
confirmation = show_confirmation(
|
|
20
20
|
title=f"Run command: {command}?",
|
|
21
|
-
skip_confirmation=ctx.deps.dangerously_skip_permissions and not
|
|
21
|
+
skip_confirmation=ctx.deps.dangerously_skip_permissions and not force_confirmation,
|
|
22
22
|
)
|
|
23
23
|
|
|
24
24
|
if confirmation == "review":
|
|
@@ -84,7 +84,6 @@ def create_or_update_secrets(ctx: RunContext[TinybirdAgentContext], secrets: dic
|
|
|
84
84
|
action = "Updating" if env_file_path.exists() and updated_keys else "Creating"
|
|
85
85
|
click.echo(FeedbackManager.highlight(message=f"» {action} secrets in .env.local..."))
|
|
86
86
|
env_file_path.write_text(new_content)
|
|
87
|
-
ctx.deps.load_secrets_local()
|
|
88
87
|
ctx.deps.build_project(test=False, silent=True, load_fixtures=False)
|
|
89
88
|
|
|
90
89
|
# Generate success message
|
|
@@ -61,7 +61,6 @@ class TinybirdAgentContext(BaseModel):
|
|
|
61
61
|
get_connection_datafile_cloud: Callable[..., str]
|
|
62
62
|
get_connection_datafile_local: Callable[..., str]
|
|
63
63
|
run_tests: Callable[..., Optional[str]]
|
|
64
|
-
load_secrets_local: Callable[..., None]
|
|
65
64
|
dangerously_skip_permissions: bool
|
|
66
65
|
token: str
|
|
67
66
|
user_token: str
|
tinybird/tb/modules/build.py
CHANGED
|
@@ -20,7 +20,6 @@ from tinybird.tb.modules.datafile.playground import folder_playground
|
|
|
20
20
|
from tinybird.tb.modules.dev_server import BuildStatus, start_server
|
|
21
21
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
22
22
|
from tinybird.tb.modules.project import Project
|
|
23
|
-
from tinybird.tb.modules.secret_common import load_secrets
|
|
24
23
|
from tinybird.tb.modules.shell import Shell, print_table_formatted
|
|
25
24
|
from tinybird.tb.modules.watch import watch_files, watch_project
|
|
26
25
|
|
|
@@ -47,7 +46,6 @@ def build(ctx: click.Context, watch: bool) -> None:
|
|
|
47
46
|
)
|
|
48
47
|
)
|
|
49
48
|
|
|
50
|
-
load_secrets(project, tb_client)
|
|
51
49
|
click.echo(FeedbackManager.highlight_building_project())
|
|
52
50
|
process(project=project, tb_client=tb_client, watch=False)
|
|
53
51
|
if watch:
|
|
@@ -76,7 +74,6 @@ def dev(ctx: click.Context, data_origin: str, ui: bool) -> None:
|
|
|
76
74
|
# Wait for the server to start
|
|
77
75
|
time.sleep(0.5)
|
|
78
76
|
|
|
79
|
-
load_secrets(project, tb_client)
|
|
80
77
|
click.echo(FeedbackManager.highlight_building_project())
|
|
81
78
|
process(project=project, tb_client=tb_client, watch=True, build_status=build_status)
|
|
82
79
|
run_watch(
|
|
@@ -14,7 +14,6 @@ from tinybird.tb.modules.datafile.fixture import FixtureExtension, get_fixture_d
|
|
|
14
14
|
from tinybird.tb.modules.dev_server import BuildStatus
|
|
15
15
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
16
16
|
from tinybird.tb.modules.project import Project
|
|
17
|
-
from tinybird.tb.modules.secret_common import load_secrets
|
|
18
17
|
from tinybird.tb.modules.shell import print_table_formatted
|
|
19
18
|
|
|
20
19
|
|
|
@@ -49,7 +48,6 @@ def process(
|
|
|
49
48
|
build_status.building = False
|
|
50
49
|
build_status.error = None
|
|
51
50
|
elif file_changed and (file_changed.endswith(".env.local") or file_changed.endswith(".env")):
|
|
52
|
-
load_secrets(project, tb_client)
|
|
53
51
|
if build_status:
|
|
54
52
|
build_status.building = False
|
|
55
53
|
build_status.error = None
|
tinybird/tb/modules/cli.py
CHANGED
|
@@ -195,12 +195,12 @@ def cli(
|
|
|
195
195
|
if "--help" in sys.argv or "-h" in sys.argv:
|
|
196
196
|
return
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
ctx.ensure_object(dict)["project"] = project
|
|
199
|
+
client = create_ctx_client(ctx, config, cloud, staging, project=project, show_warnings=version_warning)
|
|
199
200
|
|
|
200
201
|
if client:
|
|
201
202
|
ctx.ensure_object(dict)["client"] = client
|
|
202
203
|
|
|
203
|
-
ctx.ensure_object(dict)["project"] = project
|
|
204
204
|
ctx.ensure_object(dict)["env"] = get_target_env(cloud)
|
|
205
205
|
ctx.ensure_object(dict)["output"] = output
|
|
206
206
|
|
|
@@ -368,7 +368,9 @@ def __hide_click_output() -> None:
|
|
|
368
368
|
click.secho = silent_secho # type: ignore
|
|
369
369
|
|
|
370
370
|
|
|
371
|
-
def create_ctx_client(
|
|
371
|
+
def create_ctx_client(
|
|
372
|
+
ctx: Context, config: Dict[str, Any], cloud: bool, staging: bool, project: Project, show_warnings: bool = True
|
|
373
|
+
):
|
|
372
374
|
commands_without_ctx_client = [
|
|
373
375
|
"auth",
|
|
374
376
|
"check",
|
|
@@ -629,6 +629,8 @@ def datasource_export(
|
|
|
629
629
|
@click.option("--yes", is_flag=True, default=False, help="Do not ask for confirmation")
|
|
630
630
|
@click.pass_context
|
|
631
631
|
def datasource_sync(ctx: Context, datasource_name: str, yes: bool):
|
|
632
|
+
"""Sync from a GCS or S3 connection defined in .datasource file"""
|
|
633
|
+
|
|
632
634
|
try:
|
|
633
635
|
client: TinyB = ctx.obj["client"]
|
|
634
636
|
ds = client.get_datasource(datasource_name)
|
|
@@ -139,3 +139,10 @@ class CLILocalException(CLIException):
|
|
|
139
139
|
|
|
140
140
|
def __init__(self, message: str, **kw_telemetry_event_data: Any) -> None:
|
|
141
141
|
super().__init__(message, "local_error", **kw_telemetry_event_data)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class CLISecretException(CLIException):
|
|
145
|
+
"""Exceptions generated by the secret commands"""
|
|
146
|
+
|
|
147
|
+
def __init__(self, message: str, **kw_telemetry_event_data: Any) -> None:
|
|
148
|
+
super().__init__(message, "secret_error", **kw_telemetry_event_data)
|
|
@@ -18,6 +18,7 @@ from tinybird.tb.client import AuthNoTokenException, TinyB
|
|
|
18
18
|
from tinybird.tb.modules.config import CLIConfig
|
|
19
19
|
from tinybird.tb.modules.exceptions import CLILocalException
|
|
20
20
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
21
|
+
from tinybird.tb.modules.secret_common import load_secrets
|
|
21
22
|
from tinybird.tb.modules.telemetry import add_telemetry_event
|
|
22
23
|
|
|
23
24
|
TB_IMAGE_NAME = "tinybirdco/tinybird-local:latest"
|
|
@@ -34,7 +35,9 @@ def get_tinybird_local_client(
|
|
|
34
35
|
"""Get a Tinybird client connected to the local environment."""
|
|
35
36
|
|
|
36
37
|
config = get_tinybird_local_config(config_obj, test=test, silent=silent)
|
|
37
|
-
|
|
38
|
+
client = config.get_client(host=TB_LOCAL_ADDRESS, staging=staging)
|
|
39
|
+
load_secrets(config_obj.get("path", ""), client)
|
|
40
|
+
return client
|
|
38
41
|
|
|
39
42
|
|
|
40
43
|
def get_tinybird_local_config(config_obj: Dict[str, Any], test: bool = False, silent: bool = False) -> CLIConfig:
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
+
from pathlib import Path
|
|
1
2
|
from typing import Dict
|
|
2
3
|
|
|
3
|
-
import click
|
|
4
4
|
from dotenv import dotenv_values
|
|
5
5
|
|
|
6
6
|
from tinybird.tb.client import TinyB
|
|
7
|
-
from tinybird.tb.modules.
|
|
8
|
-
from tinybird.tb.modules.project import Project
|
|
7
|
+
from tinybird.tb.modules.exceptions import CLISecretException
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
def load_secrets(
|
|
10
|
+
def load_secrets(project_folder: str, client: TinyB):
|
|
12
11
|
try:
|
|
13
12
|
env_vars: Dict[str, str] = {}
|
|
14
13
|
|
|
15
14
|
# Load secrets from .env file
|
|
16
15
|
env_file = ".env"
|
|
17
|
-
env_path =
|
|
16
|
+
env_path = Path(project_folder) / env_file
|
|
18
17
|
|
|
19
18
|
if env_path.exists():
|
|
20
19
|
env_values = dotenv_values(env_path)
|
|
@@ -23,7 +22,7 @@ def load_secrets(project: Project, client: TinyB):
|
|
|
23
22
|
|
|
24
23
|
# Load secrets from .env.local file
|
|
25
24
|
env_file = ".env.local"
|
|
26
|
-
env_path =
|
|
25
|
+
env_path = Path(project_folder) / env_file
|
|
27
26
|
|
|
28
27
|
if env_path.exists():
|
|
29
28
|
env_values = dotenv_values(env_path)
|
|
@@ -33,8 +32,6 @@ def load_secrets(project: Project, client: TinyB):
|
|
|
33
32
|
if len(env_vars.keys()) == 0:
|
|
34
33
|
return
|
|
35
34
|
|
|
36
|
-
click.echo(FeedbackManager.highlight(message="\n» Loading secrets from .env files..."))
|
|
37
|
-
|
|
38
35
|
for name, value in env_vars.items():
|
|
39
36
|
if not value:
|
|
40
37
|
continue
|
|
@@ -49,8 +46,7 @@ def load_secrets(project: Project, client: TinyB):
|
|
|
49
46
|
else:
|
|
50
47
|
client.create_secret(name, value)
|
|
51
48
|
except Exception as e:
|
|
52
|
-
|
|
49
|
+
raise Exception(f"Error setting secret '{name}': {e}")
|
|
53
50
|
|
|
54
|
-
click.echo(FeedbackManager.success(message="✓ Secrets loaded!"))
|
|
55
51
|
except Exception as e:
|
|
56
|
-
|
|
52
|
+
raise CLISecretException(str(e))
|
|
@@ -25,7 +25,6 @@ from tinybird.tb.modules.llm import LLM
|
|
|
25
25
|
from tinybird.tb.modules.llm_utils import extract_xml, parse_xml
|
|
26
26
|
from tinybird.tb.modules.local_common import get_local_tokens, get_test_workspace_name
|
|
27
27
|
from tinybird.tb.modules.project import Project
|
|
28
|
-
from tinybird.tb.modules.secret_common import load_secrets
|
|
29
28
|
|
|
30
29
|
yaml.SafeDumper.org_represent_str = yaml.SafeDumper.represent_str # type: ignore[attr-defined]
|
|
31
30
|
|
|
@@ -64,9 +63,10 @@ def create_test(
|
|
|
64
63
|
tests: List[Dict[str, Any]] = []
|
|
65
64
|
|
|
66
65
|
try:
|
|
67
|
-
load_secrets(project=project, client=client)
|
|
68
66
|
click.echo(FeedbackManager.highlight(message="\n» Building test environment"))
|
|
69
|
-
build_project(project=project, tb_client=client, watch=False, silent=True)
|
|
67
|
+
build_error = build_project(project=project, tb_client=client, watch=False, silent=True, exit_on_error=False)
|
|
68
|
+
if build_error:
|
|
69
|
+
raise Exception(build_error)
|
|
70
70
|
click.echo(FeedbackManager.info(message="✓ Done!\n"))
|
|
71
71
|
config = CLIConfig.get_project_config()
|
|
72
72
|
folder = project.folder
|
|
@@ -145,9 +145,11 @@ def dump_tests(tests: List[Dict[str, Any]]) -> str:
|
|
|
145
145
|
def update_test(pipe: str, project: Project, client: TinyB) -> None:
|
|
146
146
|
try:
|
|
147
147
|
folder = project.folder
|
|
148
|
-
load_secrets(project=project, client=client)
|
|
149
148
|
click.echo(FeedbackManager.highlight(message="\n» Building test environment"))
|
|
150
|
-
build_project(project=project, tb_client=client, watch=False, silent=True)
|
|
149
|
+
build_error = build_project(project=project, tb_client=client, watch=False, silent=True, exit_on_error=False)
|
|
150
|
+
if build_error:
|
|
151
|
+
raise Exception(build_error)
|
|
152
|
+
|
|
151
153
|
click.echo(FeedbackManager.info(message="✓ Done!"))
|
|
152
154
|
pipe_tests_path = get_pipe_path(pipe, folder)
|
|
153
155
|
pipe_name = pipe_tests_path.stem
|
|
@@ -191,9 +193,10 @@ def update_test(pipe: str, project: Project, client: TinyB) -> None:
|
|
|
191
193
|
def run_tests(name: Tuple[str, ...], project: Project, client: TinyB) -> Optional[str]:
|
|
192
194
|
full_error = ""
|
|
193
195
|
try:
|
|
194
|
-
load_secrets(project=project, client=client)
|
|
195
196
|
click.echo(FeedbackManager.highlight(message="\n» Building test environment"))
|
|
196
|
-
build_project(project=project, tb_client=client, watch=False, silent=True)
|
|
197
|
+
build_error = build_project(project=project, tb_client=client, watch=False, silent=True, exit_on_error=False)
|
|
198
|
+
if build_error:
|
|
199
|
+
raise Exception(build_error)
|
|
197
200
|
click.echo(FeedbackManager.info(message="✓ Done!"))
|
|
198
201
|
|
|
199
202
|
click.echo(FeedbackManager.highlight(message="\n» Running tests"))
|
|
@@ -17,27 +17,27 @@ tinybird/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1w
|
|
|
17
17
|
tinybird/datafile/parse_connection.py,sha256=tRyn2Rpr1TeWet5BXmMoQgaotbGdYep1qiTak_OqC5E,1825
|
|
18
18
|
tinybird/datafile/parse_datasource.py,sha256=ssW8QeFSgglVFi3sDZj_HgkJiTJ2069v2JgqnH3CkDE,1825
|
|
19
19
|
tinybird/datafile/parse_pipe.py,sha256=xf4m0Tw44QWJzHzAm7Z7FwUoUUtr7noMYjU1NiWnX0k,3880
|
|
20
|
-
tinybird/tb/__cli__.py,sha256=
|
|
20
|
+
tinybird/tb/__cli__.py,sha256=BhEnCKben6XkQIpGAiFqJfgnLmzN6r_Drzso-JZ6Xs0,247
|
|
21
21
|
tinybird/tb/check_pypi.py,sha256=Gp0HkHHDFMSDL6nxKlOY51z7z1Uv-2LRexNTZSHHGmM,552
|
|
22
22
|
tinybird/tb/cli.py,sha256=FdDFEIayjmsZEVsVSSvRiVYn_FHOVg_zWQzchnzfWho,1008
|
|
23
23
|
tinybird/tb/client.py,sha256=IQRaInDjOwr9Fzaz3_xXc3aUGqh94tM2lew7IZbB9eM,53733
|
|
24
24
|
tinybird/tb/config.py,sha256=mhMTGnMB5KcxGoh3dewIr2Jjsa6pHE183gCPAQWyp6o,3973
|
|
25
|
-
tinybird/tb/modules/build.py,sha256=
|
|
26
|
-
tinybird/tb/modules/build_common.py,sha256=
|
|
25
|
+
tinybird/tb/modules/build.py,sha256=lSCbmrqDxqa8bG009qgp2nNRpQW7JWgSen7UQNCfLVE,7657
|
|
26
|
+
tinybird/tb/modules/build_common.py,sha256=KGCtyY1JGexXXhcMVFI3e-gRavmRfCoZnfGPSTYHGxk,12962
|
|
27
27
|
tinybird/tb/modules/cicd.py,sha256=0KLKccha9IP749QvlXBmzdWv1On3mFwMY4DUcJlBxiE,7326
|
|
28
|
-
tinybird/tb/modules/cli.py,sha256
|
|
28
|
+
tinybird/tb/modules/cli.py,sha256=-52CJC_JXXCoR91LecUuSD7wyKa-A779bECtFr1UCTM,16726
|
|
29
29
|
tinybird/tb/modules/common.py,sha256=tj6DR2yOqMMQ0PILwFGXmMogxdrbQCgj36HdSM611rs,82657
|
|
30
30
|
tinybird/tb/modules/config.py,sha256=gK7rgaWTDd4ZKCrNEg_Uemr26EQjqWt6TjyQKujxOws,11462
|
|
31
31
|
tinybird/tb/modules/connection.py,sha256=axp8Fny1_4PSLJGN4UF6WygyRbQtM3Lbt6thxHKTxzw,17790
|
|
32
32
|
tinybird/tb/modules/copy.py,sha256=dPZkcIDvxjJrlQUIvToO0vsEEEs4EYumbNV77-BzNoU,4404
|
|
33
33
|
tinybird/tb/modules/create.py,sha256=pJxHXG69c9Z_21s-7VuJ3RZOF_nJU51LEwiAkvI3dZY,23251
|
|
34
|
-
tinybird/tb/modules/datasource.py,sha256=
|
|
34
|
+
tinybird/tb/modules/datasource.py,sha256=kDFHdxckTnRosk2829icfltQvlJd8EY5c9oWB5eS5Xo,41797
|
|
35
35
|
tinybird/tb/modules/deployment.py,sha256=v0layOmG0IMnuXc3RT39mpGfa5M8yPlrL9F089fJFCo,15964
|
|
36
36
|
tinybird/tb/modules/deployment_common.py,sha256=2NJgoONEfhFpGIPeE_wULDuUkomxPsIu2gbHgL1qcw8,19653
|
|
37
37
|
tinybird/tb/modules/deprecations.py,sha256=rrszC1f_JJeJ8mUxGoCxckQTJFBCR8wREf4XXXN-PRc,4507
|
|
38
38
|
tinybird/tb/modules/dev_server.py,sha256=57FCKuWpErwYUYgHspYDkLWEm9F4pbvVOtMrFXX1fVU,10129
|
|
39
39
|
tinybird/tb/modules/endpoint.py,sha256=ksRj6mfDb9Xv63PhTkV_uKSosgysHElqagg3RTt21Do,11958
|
|
40
|
-
tinybird/tb/modules/exceptions.py,sha256=
|
|
40
|
+
tinybird/tb/modules/exceptions.py,sha256=KEj3E-zN7Z28igvptlngXIjlHR9vAJk59Vs4zpwm4vA,5469
|
|
41
41
|
tinybird/tb/modules/feedback_manager.py,sha256=xkZjwGOV50-oc0y9h58ei4MZ1mwOMOaN_kUcGrtNH48,78132
|
|
42
42
|
tinybird/tb/modules/info.py,sha256=F5vY4kHS_kyO2uSBKac92HoOb447oDeRlzpwtAHTuKc,6872
|
|
43
43
|
tinybird/tb/modules/infra.py,sha256=JE9oLIyF4bi_JBoe-BgZ5HhKp_lQgSihuSV1KIS02Qs,32709
|
|
@@ -45,7 +45,7 @@ tinybird/tb/modules/job.py,sha256=wBsnu8UPTOha2rkLvucgmw4xYv73ubmui3eeSIF68ZM,31
|
|
|
45
45
|
tinybird/tb/modules/llm.py,sha256=fPBBCmM3KlCksLlgJkg4joDn6y3H5QjDzE-Pm4YNf7E,1782
|
|
46
46
|
tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
|
|
47
47
|
tinybird/tb/modules/local.py,sha256=tpiw_F_qOIp42h3kTBwTm5GQDyuVLF0QNF1jmB0zR94,6845
|
|
48
|
-
tinybird/tb/modules/local_common.py,sha256=
|
|
48
|
+
tinybird/tb/modules/local_common.py,sha256=8cnBh3eoHRV6Ze7Rg9bueF3Zb_wYDe54bm5cGRvrwbY,17596
|
|
49
49
|
tinybird/tb/modules/login.py,sha256=zerXZqIv15pbFk5XRt746xGcVnp01YmL_403byBf4jQ,1245
|
|
50
50
|
tinybird/tb/modules/login_common.py,sha256=IfthYbHmC7EtsCXCB1iF4TngPOwfaHJ6Dfi_t7oBXnI,11640
|
|
51
51
|
tinybird/tb/modules/logout.py,sha256=sniI4JNxpTrVeRCp0oGJuQ3yRerG4hH5uz6oBmjv724,1009
|
|
@@ -57,29 +57,29 @@ tinybird/tb/modules/pipe.py,sha256=xPKtezhnWZ6k_g82r4XpgKslofhuIxb_PvynH4gdUzI,2
|
|
|
57
57
|
tinybird/tb/modules/project.py,sha256=_P6wUOFTY87ixE06SjfYIROMoVr6oipi6qHu-RAHLD8,7356
|
|
58
58
|
tinybird/tb/modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
|
|
59
59
|
tinybird/tb/modules/secret.py,sha256=9BIdh2PZDAbY2wRbf4ZDvkEltygztz1RMxgDmY1D0LI,3521
|
|
60
|
-
tinybird/tb/modules/secret_common.py,sha256=
|
|
60
|
+
tinybird/tb/modules/secret_common.py,sha256=8mEXOdNFrTuVWu7rgZ5-C8v-rB1EAdZQUHIyBIgwISI,1578
|
|
61
61
|
tinybird/tb/modules/shell.py,sha256=_9PaKkkh6ZjkixVtKNAtoCPqXMXMn1aQJM_Xzirn7ZM,13621
|
|
62
62
|
tinybird/tb/modules/sink.py,sha256=dK2s__my0ePIUYrqBzhPSgdWN9rbpvP1G4dT7DJzz80,3865
|
|
63
63
|
tinybird/tb/modules/table.py,sha256=4XrtjM-N0zfNtxVkbvLDQQazno1EPXnxTyo7llivfXk,11035
|
|
64
64
|
tinybird/tb/modules/telemetry.py,sha256=T9gtsQffWqG_4hRBaUJPzOfMkPwz7mH-R6Bn1XRYViA,11482
|
|
65
65
|
tinybird/tb/modules/test.py,sha256=O2-mS4uMU6nPi7yWPpWzshAgOlYKiGS-tkM12pXQGMI,1906
|
|
66
|
-
tinybird/tb/modules/test_common.py,sha256=
|
|
66
|
+
tinybird/tb/modules/test_common.py,sha256=7EpwGVs3SQTVUOM4fX3iq2fITquYvLtsEz599mN6Eqc,14525
|
|
67
67
|
tinybird/tb/modules/token.py,sha256=ZhW_o7XCr90wJRhMN6816vyo_TVfnzPXyIhrhzQ7oZ0,13807
|
|
68
68
|
tinybird/tb/modules/watch.py,sha256=No0bK1M1_3CYuMaIgylxf7vYFJ72lTJe3brz6xQ-mJo,8819
|
|
69
69
|
tinybird/tb/modules/workspace.py,sha256=USsG8YEXlwf7F2PjTMCuQ2lB8ya-erbv8VywNJYq6mc,11173
|
|
70
70
|
tinybird/tb/modules/workspace_members.py,sha256=5JdkJgfuEwbq-t6vxkBhYwgsiTDxF790wsa6Xfif9nk,8608
|
|
71
71
|
tinybird/tb/modules/agent/__init__.py,sha256=i3oe3vDIWWPaicdCM0zs7D7BJ1W0k7th93ooskHAV00,54
|
|
72
|
-
tinybird/tb/modules/agent/agent.py,sha256=
|
|
72
|
+
tinybird/tb/modules/agent/agent.py,sha256=2RUOPhTszUXQKcZW3v9NcjC9vQrY7ShetVmgIcI2mgs,33004
|
|
73
73
|
tinybird/tb/modules/agent/animations.py,sha256=4WOC5_2BracttmMCrV0H91tXfWcUzQHBUaIJc5FA7tE,3490
|
|
74
74
|
tinybird/tb/modules/agent/banner.py,sha256=l6cO5Fi7lbVKp-GsBP8jf3IkjOWxg2jpAt9NBCy0WR8,4085
|
|
75
|
-
tinybird/tb/modules/agent/command_agent.py,sha256=
|
|
75
|
+
tinybird/tb/modules/agent/command_agent.py,sha256=Wcdtmo7vJZ5EbBFW9J7zPCME0ShG_KqF6-qHmMB1XXk,3103
|
|
76
76
|
tinybird/tb/modules/agent/compactor.py,sha256=BK5AxZFhrp3xWnsRnYaleiYoIWtVNc-_m650Hsopt8g,13841
|
|
77
77
|
tinybird/tb/modules/agent/explore_agent.py,sha256=HkzKmggfSMz7S3RSeKnZXufq-z_U0tTQJpF7JfNIaGQ,3504
|
|
78
78
|
tinybird/tb/modules/agent/memory.py,sha256=vBewB_64L_wHoT4tLT6UX2uxcHwSY880QZ26F9rPqXs,3793
|
|
79
79
|
tinybird/tb/modules/agent/models.py,sha256=IAxqlnHy8c2OeSnDrrSp2Mg38W9_r0GsDM87Wv-YNfM,925
|
|
80
|
-
tinybird/tb/modules/agent/prompts.py,sha256=
|
|
80
|
+
tinybird/tb/modules/agent/prompts.py,sha256=TSzfK255Y6oBSOgy10hVU8TxalhJVcopT27hD4gELQU,37575
|
|
81
81
|
tinybird/tb/modules/agent/testing_agent.py,sha256=AtwtJViH7805i7djyBgDb7SSUtDyJnw0TWJu6lBFsrg,2953
|
|
82
|
-
tinybird/tb/modules/agent/utils.py,sha256=
|
|
82
|
+
tinybird/tb/modules/agent/utils.py,sha256=4jsQCAH2zBx13w20DOBrrDnQq9n2rKG9sGhBkJYiPzs,31744
|
|
83
83
|
tinybird/tb/modules/agent/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
84
84
|
tinybird/tb/modules/agent/tools/analyze.py,sha256=CR5LXg4fou-zYEksqnjpJ0icvxJVoKnTctoI1NRvqCM,3873
|
|
85
85
|
tinybird/tb/modules/agent/tools/append.py,sha256=6uByExBpb9rVzB0tebWyLFbfkjEPSNxIGFbZrJTaGVI,8056
|
|
@@ -94,8 +94,8 @@ tinybird/tb/modules/agent/tools/get_openapi_definition.py,sha256=4TIMO2XzHBMhpt9
|
|
|
94
94
|
tinybird/tb/modules/agent/tools/mock.py,sha256=RvdsKIr0vKEs91GuK5vKg0fDj8SI-cdcX4XqgvnSwuQ,4508
|
|
95
95
|
tinybird/tb/modules/agent/tools/plan.py,sha256=2KHLNkr2f1RfkbAR4mCVsv94LGosXd8-ky7v6BB1OtQ,985
|
|
96
96
|
tinybird/tb/modules/agent/tools/request_endpoint.py,sha256=xseEDQez2xfnPWNOoGnRmHB2KR9WLCx_q-vzS6NtaOY,3972
|
|
97
|
-
tinybird/tb/modules/agent/tools/run_command.py,sha256=
|
|
98
|
-
tinybird/tb/modules/agent/tools/secret.py,sha256=
|
|
97
|
+
tinybird/tb/modules/agent/tools/run_command.py,sha256=ypvIU0j1XVUWghqt-dpWHm3GQIYsZwE7kRHC3Wau_H0,1708
|
|
98
|
+
tinybird/tb/modules/agent/tools/secret.py,sha256=wUeM-5CCjXiwLEF-H121VypOw3_77OMoZthJedPENl4,4254
|
|
99
99
|
tinybird/tb/modules/agent/tools/test.py,sha256=4XuEWVHLOTSO51Z9xJ08dTjk0j3IWY_JlPtSBO5aaUs,10373
|
|
100
100
|
tinybird/tb/modules/datafile/build.py,sha256=NFKBrusFLU0WJNCXePAFWiEDuTaXpwc0lHlOQWEJ43s,51117
|
|
101
101
|
tinybird/tb/modules/datafile/build_common.py,sha256=2yNdxe49IMA9wNvl25NemY2Iaz8L66snjOdT64dm1is,4511
|
|
@@ -117,8 +117,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
|
|
|
117
117
|
tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
|
|
118
118
|
tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
|
|
119
119
|
tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
|
|
120
|
-
tinybird-0.0.1.
|
|
121
|
-
tinybird-0.0.1.
|
|
122
|
-
tinybird-0.0.1.
|
|
123
|
-
tinybird-0.0.1.
|
|
124
|
-
tinybird-0.0.1.
|
|
120
|
+
tinybird-0.0.1.dev279.dist-info/METADATA,sha256=ghm_pGTehvUVQoLGPbTWB0ufWGyo1EflvV-uaeXtt74,1763
|
|
121
|
+
tinybird-0.0.1.dev279.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
122
|
+
tinybird-0.0.1.dev279.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
123
|
+
tinybird-0.0.1.dev279.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
124
|
+
tinybird-0.0.1.dev279.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|