tinybird 0.0.1.dev271__tar.gz → 0.0.1.dev273__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.dev271 → tinybird-0.0.1.dev273}/PKG-INFO +1 -1
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/__cli__.py +2 -2
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/client.py +4 -23
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/agent.py +34 -6
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/prompts.py +12 -9
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/append.py +36 -5
- tinybird-0.0.1.dev271/tinybird/tb/modules/agent/tools/create_datafile.py → tinybird-0.0.1.dev273/tinybird/tb/modules/agent/tools/datafile.py +78 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/deploy.py +19 -4
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/execute_query.py +15 -2
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/get_endpoint_stats.py +16 -3
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/get_openapi_definition.py +16 -3
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/request_endpoint.py +13 -3
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/utils.py +25 -1
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/connection.py +1 -1
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/pull.py +1 -1
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird.egg-info/PKG-INFO +1 -1
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird.egg-info/SOURCES.txt +1 -1
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/setup.cfg +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/config.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/datafile/common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/datafile/parse_connection.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/prompts.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/sql_template.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/cli.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/config.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/__init__.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/animations.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/banner.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/command_agent.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/compactor.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/explore_agent.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/memory.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/models.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/testing_agent.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/__init__.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/analyze.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/build.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/deploy_check.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/diff_resource.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/mock.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/plan.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/run_command.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/secret.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/test.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/build.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/build_common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/cli.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/create.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datasource.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/deployment.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/deployment_common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/deprecations.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/dev_server.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/info.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/login.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/login_common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/mock.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/mock_common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/open.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/project.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/secret_common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/shell.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/sink.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/test.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/test_common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/token.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/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/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.dev273'
|
|
8
|
+
__revision__ = '9f4ea9e'
|
|
@@ -300,13 +300,10 @@ class TinyB:
|
|
|
300
300
|
response = self._req(f"/v0/connectors?{urlencode(params)}")
|
|
301
301
|
return response["connectors"]
|
|
302
302
|
|
|
303
|
-
def connections(self, connector: Optional[str] = None
|
|
303
|
+
def connections(self, connector: Optional[str] = None):
|
|
304
304
|
response = self._req("/v0/connectors")
|
|
305
305
|
connectors = response["connectors"]
|
|
306
|
-
|
|
307
|
-
if not skip_bigquery:
|
|
308
|
-
bigquery_connection = self.bigquery_connection() if connector == "bigquery" or connector is None else None
|
|
309
|
-
connectors = [*connectors, bigquery_connection] if bigquery_connection else connectors
|
|
306
|
+
|
|
310
307
|
if connector:
|
|
311
308
|
return [
|
|
312
309
|
{
|
|
@@ -328,24 +325,9 @@ class TinyB:
|
|
|
328
325
|
**c["settings"],
|
|
329
326
|
}
|
|
330
327
|
for c in connectors
|
|
328
|
+
if c["service"] != "gcscheduler"
|
|
331
329
|
]
|
|
332
330
|
|
|
333
|
-
def bigquery_connection(self):
|
|
334
|
-
bigquery_resources = self.list_gcp_resources()
|
|
335
|
-
if len(bigquery_resources) == 0:
|
|
336
|
-
return None
|
|
337
|
-
|
|
338
|
-
gcp_account_details: Dict[str, Any] = self.get_gcp_service_account_details()
|
|
339
|
-
datasources = self.datasources()
|
|
340
|
-
bigquery_datasources = [ds["name"] for ds in datasources if ds["type"] == "bigquery"]
|
|
341
|
-
return {
|
|
342
|
-
"id": gcp_account_details["account"].split("@")[0],
|
|
343
|
-
"service": "bigquery",
|
|
344
|
-
"name": "bigquery",
|
|
345
|
-
"linkers": bigquery_datasources,
|
|
346
|
-
"settings": gcp_account_details,
|
|
347
|
-
}
|
|
348
|
-
|
|
349
331
|
def get_datasource(self, ds_name: str, used_by: bool = False) -> Dict[str, Any]:
|
|
350
332
|
params = {
|
|
351
333
|
"attrs": "used_by" if used_by else "",
|
|
@@ -1037,10 +1019,9 @@ class TinyB:
|
|
|
1037
1019
|
name_or_id: str,
|
|
1038
1020
|
service: Optional[str] = None,
|
|
1039
1021
|
key: Optional[str] = "name",
|
|
1040
|
-
skip_bigquery: Optional[bool] = False,
|
|
1041
1022
|
) -> Optional[Dict[str, Any]]:
|
|
1042
1023
|
return next(
|
|
1043
|
-
(c for c in self.connections(connector=service
|
|
1024
|
+
(c for c in self.connections(connector=service) if c[key] == name_or_id),
|
|
1044
1025
|
None,
|
|
1045
1026
|
)
|
|
1046
1027
|
|
|
@@ -37,7 +37,7 @@ from tinybird.tb.modules.agent.testing_agent import TestingAgent
|
|
|
37
37
|
from tinybird.tb.modules.agent.tools.analyze import analyze_file, analyze_url
|
|
38
38
|
from tinybird.tb.modules.agent.tools.append import append_file, append_url
|
|
39
39
|
from tinybird.tb.modules.agent.tools.build import build
|
|
40
|
-
from tinybird.tb.modules.agent.tools.
|
|
40
|
+
from tinybird.tb.modules.agent.tools.datafile import create_datafile, remove_file, rename_datafile_or_fixture
|
|
41
41
|
from tinybird.tb.modules.agent.tools.deploy import deploy
|
|
42
42
|
from tinybird.tb.modules.agent.tools.deploy_check import deploy_check
|
|
43
43
|
from tinybird.tb.modules.agent.tools.diff_resource import diff_resource
|
|
@@ -48,7 +48,13 @@ from tinybird.tb.modules.agent.tools.plan import plan
|
|
|
48
48
|
from tinybird.tb.modules.agent.tools.secret import create_or_update_secrets
|
|
49
49
|
from tinybird.tb.modules.agent.utils import AgentRunCancelled, TinybirdAgentContext, show_confirmation, show_input
|
|
50
50
|
from tinybird.tb.modules.build_common import process as build_process
|
|
51
|
-
from tinybird.tb.modules.common import
|
|
51
|
+
from tinybird.tb.modules.common import (
|
|
52
|
+
_analyze,
|
|
53
|
+
_get_tb_client,
|
|
54
|
+
echo_safe_humanfriendly_tables_format_pretty_table,
|
|
55
|
+
get_region_from_host,
|
|
56
|
+
get_regions,
|
|
57
|
+
)
|
|
52
58
|
from tinybird.tb.modules.config import CLIConfig
|
|
53
59
|
from tinybird.tb.modules.deployment_common import create_deployment
|
|
54
60
|
from tinybird.tb.modules.exceptions import CLIBuildException, CLIDeploymentException, CLIMockException
|
|
@@ -83,13 +89,15 @@ class TinybirdAgent:
|
|
|
83
89
|
self.messages: list[ModelMessage] = get_last_messages_from_last_user_prompt()
|
|
84
90
|
else:
|
|
85
91
|
self.messages = []
|
|
86
|
-
|
|
92
|
+
cli_config = CLIConfig.get_project_config()
|
|
93
|
+
regions = get_regions(cli_config)
|
|
87
94
|
self.agent = Agent(
|
|
88
95
|
model=create_model(user_token, host, workspace_id),
|
|
89
96
|
deps_type=TinybirdAgentContext,
|
|
90
97
|
system_prompt=agent_system_prompt,
|
|
91
98
|
tools=[
|
|
92
99
|
Tool(create_datafile, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
|
|
100
|
+
Tool(remove_file, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
|
|
93
101
|
Tool(
|
|
94
102
|
rename_datafile_or_fixture,
|
|
95
103
|
docstring_format="google",
|
|
@@ -206,7 +214,27 @@ class TinybirdAgent:
|
|
|
206
214
|
|
|
207
215
|
@self.agent.instructions
|
|
208
216
|
def get_cloud_host(ctx: RunContext[TinybirdAgentContext]) -> str:
|
|
209
|
-
|
|
217
|
+
try:
|
|
218
|
+
region = get_region_from_host(ctx.deps.host, regions) or {
|
|
219
|
+
"provider": "Unknown",
|
|
220
|
+
"name": "Unknown",
|
|
221
|
+
}
|
|
222
|
+
except Exception as e:
|
|
223
|
+
click.echo(FeedbackManager.error(message=f"Error getting region info: {e}"))
|
|
224
|
+
region = {
|
|
225
|
+
"provider": "Unknown",
|
|
226
|
+
"name": "Unknown",
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
region_provider = region["provider"]
|
|
230
|
+
region_name = region["name"]
|
|
231
|
+
return f"""Tinybird Cloud info (region details):
|
|
232
|
+
- API Host: {ctx.deps.host}
|
|
233
|
+
- Workspace ID: {ctx.deps.workspace_id}
|
|
234
|
+
- Workspace Name: {project.workspace_name} (in Tinybird Local the workspace name is the same because it is synced with Cloud)
|
|
235
|
+
- Region provider: {region_provider}
|
|
236
|
+
- Region name: {region_name}
|
|
237
|
+
"""
|
|
210
238
|
|
|
211
239
|
@self.agent.instructions
|
|
212
240
|
def get_local_token(ctx: RunContext[TinybirdAgentContext]) -> str:
|
|
@@ -533,7 +561,7 @@ def build_project_test(
|
|
|
533
561
|
raise CLIBuildException(build_error)
|
|
534
562
|
|
|
535
563
|
|
|
536
|
-
def deploy_project(config: dict[str, Any], project: Project) -> None:
|
|
564
|
+
def deploy_project(config: dict[str, Any], project: Project, allow_destructive_operations: bool = False) -> None:
|
|
537
565
|
client = _get_tb_client(config["token"], config["host"])
|
|
538
566
|
try:
|
|
539
567
|
create_deployment(
|
|
@@ -542,7 +570,7 @@ def deploy_project(config: dict[str, Any], project: Project) -> None:
|
|
|
542
570
|
config=config,
|
|
543
571
|
wait=True,
|
|
544
572
|
auto=True,
|
|
545
|
-
allow_destructive_operations=
|
|
573
|
+
allow_destructive_operations=allow_destructive_operations,
|
|
546
574
|
)
|
|
547
575
|
except SystemExit as e:
|
|
548
576
|
raise CLIDeploymentException(e.args[0])
|
|
@@ -31,14 +31,17 @@ Steps:
|
|
|
31
31
|
8. Copy: [name] - [description] - Depends on: [resources]
|
|
32
32
|
9. Generate mock data: [datasource_name]
|
|
33
33
|
10. Append existing fixture: [fixture_pathname] - Target: [datasource_name]
|
|
34
|
+
11. Delete file: [file_pathname] - [reason for deletion]
|
|
34
35
|
|
|
35
36
|
<dev_notes>
|
|
36
37
|
You can skip steps where resources will not be created or updated.
|
|
37
38
|
Always add 'Create secrets' as the FIRST step if any secrets/environment variables are required for the implementation. This step should include ALL required secrets at once.
|
|
38
39
|
Always add 'Generate mock data' step if a landing datasource was created without providing a fixture file.
|
|
39
40
|
Always add 'Append existing fixture' step if a landing datasource was created after providing a fixture file.
|
|
41
|
+
Always add 'Delete file' step when removing datafiles, fixtures, or any other project files.
|
|
40
42
|
Solve the specific user request, do not add extra steps that are not related to the user request.
|
|
41
43
|
Reuse the existing resources if possible.
|
|
44
|
+
If a plan only has one step, skip the plan and go directly to the next tool needed.
|
|
42
45
|
</dev_notes>
|
|
43
46
|
|
|
44
47
|
Resource dependencies:
|
|
@@ -735,7 +738,7 @@ You are an interactive CLI tool that helps users with data engineering tasks. Us
|
|
|
735
738
|
|
|
736
739
|
# Tools
|
|
737
740
|
You have access to the following tools:
|
|
738
|
-
1. `
|
|
741
|
+
1. `datafile` - Create datafiles and remove files (datasource, endpoint, materialized, sink, copy, connection, fixtures) in the project folder. Confirmation will be asked by the tool before creating or removing the file.
|
|
739
742
|
2. `plan` - Plan the creation or update of resources.
|
|
740
743
|
3. `build` - Build the project.
|
|
741
744
|
4. `deploy` - Deploy the project to Tinybird Cloud.
|
|
@@ -753,14 +756,14 @@ You have access to the following tools:
|
|
|
753
756
|
16. `diff_resource` - Diff the content of a resource in Tinybird Cloud vs Tinybird Local vs Project local file.
|
|
754
757
|
17. `rename_datafile_or_fixture` - Rename a datafile or fixture.
|
|
755
758
|
|
|
756
|
-
# When creating or
|
|
757
|
-
1. Use `plan` tool to plan the creation, update or
|
|
758
|
-
2. If the user confirms the plan, go from 3 to 7 steps until all the resources are created, updated or skipped.
|
|
759
|
-
3. Without asking, use the `create_datafile` tool to create the
|
|
760
|
-
4. Check the result of the `create_datafile` tool to see if the
|
|
761
|
-
5. If the
|
|
762
|
-
6. If the
|
|
763
|
-
7. If the
|
|
759
|
+
# When creating, updating, or deleting files:
|
|
760
|
+
1. Use `plan` tool to plan the creation, update, rename, or deletion of resources.
|
|
761
|
+
2. If the user confirms the plan, go from 3 to 7 steps until all the resources are created, updated, deleted, or skipped.
|
|
762
|
+
3. Without asking, use the `create_datafile` or `remove_file` tool to create or remove the file, because it will ask for confirmation before creating or removing the file.
|
|
763
|
+
4. Check the result of the `create_datafile` or `remove_file` tool to see if the file was created or removed successfully.
|
|
764
|
+
5. If the file was created or removed successfully, report the result to the user.
|
|
765
|
+
6. If the file was not created or removed, finish the process and just wait for a new user prompt.
|
|
766
|
+
7. If the file was created or removed successfully, but the build failed, try to fix the error and repeat the process.
|
|
764
767
|
|
|
765
768
|
# When creating a landing datasource given a .ndjson file:
|
|
766
769
|
- If the user does not specify anything about the desired schema, create a schema like this (sorting key not needed in this case)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
from typing import Optional
|
|
2
3
|
|
|
3
4
|
import click
|
|
4
5
|
from pydantic_ai import RunContext
|
|
@@ -8,6 +9,7 @@ from tinybird.tb.modules.agent.utils import (
|
|
|
8
9
|
TinybirdAgentContext,
|
|
9
10
|
copy_fixture_to_project_folder_if_needed,
|
|
10
11
|
show_confirmation,
|
|
12
|
+
show_env_options,
|
|
11
13
|
show_input,
|
|
12
14
|
)
|
|
13
15
|
from tinybird.tb.modules.common import echo_safe_humanfriendly_tables_format_pretty_table
|
|
@@ -15,14 +17,14 @@ from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
def append_file(
|
|
18
|
-
ctx: RunContext[TinybirdAgentContext], datasource_name: str, fixture_pathname: str, cloud: bool =
|
|
20
|
+
ctx: RunContext[TinybirdAgentContext], datasource_name: str, fixture_pathname: str, cloud: Optional[bool] = None
|
|
19
21
|
) -> str:
|
|
20
22
|
"""Append a fixture file to a datasource
|
|
21
23
|
|
|
22
24
|
Args:
|
|
23
25
|
datasource_name: Name of the datasource to append fixture to
|
|
24
26
|
fixture_pathname: Path to the fixture file to append
|
|
25
|
-
cloud: Whether to append the fixture to the cloud or local environment.
|
|
27
|
+
cloud: Whether to append the fixture to the cloud or local environment. If None (user didn't specify), will ask user to clarify. Defaults to local (False) in dangerous skip permissions mode.
|
|
26
28
|
|
|
27
29
|
Returns:
|
|
28
30
|
str: Message indicating the success or failure of the appending
|
|
@@ -37,6 +39,19 @@ def append_file(
|
|
|
37
39
|
|
|
38
40
|
fixture_path = fixture_path_or_error
|
|
39
41
|
fixture_pathname = os.path.relpath(fixture_path, ctx.deps.folder)
|
|
42
|
+
|
|
43
|
+
# Handle cloud parameter - ask user if uncertain and not in dangerous skip mode
|
|
44
|
+
if cloud is None:
|
|
45
|
+
if ctx.deps.dangerously_skip_permissions:
|
|
46
|
+
# Default to local when in dangerous skip mode
|
|
47
|
+
cloud = False
|
|
48
|
+
else:
|
|
49
|
+
# Ask the user to choose execution mode
|
|
50
|
+
cloud = show_env_options(ctx)
|
|
51
|
+
if cloud is None:
|
|
52
|
+
ctx.deps.thinking_animation.start()
|
|
53
|
+
return "Append operation cancelled by user."
|
|
54
|
+
|
|
40
55
|
cloud_or_local = "Cloud" if cloud else "Local"
|
|
41
56
|
confirmation = show_confirmation(
|
|
42
57
|
title=f"Append fixture {fixture_pathname} to datasource '{datasource_name}' in Tinybird {cloud_or_local}?",
|
|
@@ -69,20 +84,33 @@ def append_file(
|
|
|
69
84
|
|
|
70
85
|
|
|
71
86
|
def append_url(
|
|
72
|
-
ctx: RunContext[TinybirdAgentContext], datasource_name: str, fixture_url: str, cloud: bool =
|
|
87
|
+
ctx: RunContext[TinybirdAgentContext], datasource_name: str, fixture_url: str, cloud: Optional[bool] = None
|
|
73
88
|
) -> str:
|
|
74
89
|
"""Append existing fixture to a datasource
|
|
75
90
|
|
|
76
91
|
Args:
|
|
77
92
|
datasource_name: Name of the datasource to append fixture to
|
|
78
93
|
fixture_url: external url to the fixture file to append
|
|
79
|
-
cloud: Whether to append the fixture to the cloud or local environment.
|
|
94
|
+
cloud: Whether to append the fixture to the cloud or local environment. If None (user didn't specify), will ask user to clarify. Defaults to local (False) in dangerous skip permissions mode.
|
|
80
95
|
|
|
81
96
|
Returns:
|
|
82
97
|
str: Message indicating the success or failure of the appending
|
|
83
98
|
"""
|
|
84
99
|
try:
|
|
85
100
|
ctx.deps.thinking_animation.stop()
|
|
101
|
+
|
|
102
|
+
# Handle cloud parameter - ask user if uncertain and not in dangerous skip mode
|
|
103
|
+
if cloud is None:
|
|
104
|
+
if ctx.deps.dangerously_skip_permissions:
|
|
105
|
+
# Default to local when in dangerous skip mode
|
|
106
|
+
cloud = False
|
|
107
|
+
else:
|
|
108
|
+
# Ask the user to choose execution mode
|
|
109
|
+
cloud = show_env_options(ctx)
|
|
110
|
+
if cloud is None:
|
|
111
|
+
ctx.deps.thinking_animation.start()
|
|
112
|
+
return "Append operation cancelled by user."
|
|
113
|
+
|
|
86
114
|
cloud_or_local = "Cloud" if cloud else "Local"
|
|
87
115
|
confirmation = show_confirmation(
|
|
88
116
|
title=f"Append URL {fixture_url} to datasource '{datasource_name}' in Tinybird {cloud_or_local}?",
|
|
@@ -115,10 +143,13 @@ def append_url(
|
|
|
115
143
|
|
|
116
144
|
|
|
117
145
|
def handle_quarantine_error(
|
|
118
|
-
ctx: RunContext[TinybirdAgentContext], error_message: str, datasource_name: str, cloud: bool =
|
|
146
|
+
ctx: RunContext[TinybirdAgentContext], error_message: str, datasource_name: str, cloud: Optional[bool] = None
|
|
119
147
|
) -> str:
|
|
120
148
|
try:
|
|
121
149
|
if "in quarantine" in error_message:
|
|
150
|
+
# Default to local if cloud is None for error handling
|
|
151
|
+
if cloud is None:
|
|
152
|
+
cloud = False
|
|
122
153
|
cloud_or_local = "Cloud" if cloud else "Local"
|
|
123
154
|
click.echo(FeedbackManager.highlight(message=f"» Looking for errors in {datasource_name}_quarantine..."))
|
|
124
155
|
query = f"select * from {datasource_name}_quarantine order by insertion_date desc limit 5 FORMAT JSON"
|
|
@@ -191,3 +191,81 @@ def rename_datafile_or_fixture(ctx: RunContext[TinybirdAgentContext], path: str,
|
|
|
191
191
|
click.echo(FeedbackManager.error(message=e))
|
|
192
192
|
ctx.deps.thinking_animation.start()
|
|
193
193
|
return f"Error renaming {path} to {new_path}: {e}"
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def remove_file(ctx: RunContext[TinybirdAgentContext], path: str) -> str:
|
|
197
|
+
"""Removes a datafile or fixture from the project folder and rebuilds the project if needed
|
|
198
|
+
|
|
199
|
+
Args:
|
|
200
|
+
path (str): The path to the file to remove. Required.
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
str: If the resource was removed successfully.
|
|
204
|
+
"""
|
|
205
|
+
try:
|
|
206
|
+
ctx.deps.thinking_animation.stop()
|
|
207
|
+
path = path.removeprefix("/")
|
|
208
|
+
full_path = Path(ctx.deps.folder) / path
|
|
209
|
+
|
|
210
|
+
if not full_path.exists():
|
|
211
|
+
click.echo(FeedbackManager.error(message=f"Error: File {path} not found"))
|
|
212
|
+
ctx.deps.thinking_animation.start()
|
|
213
|
+
return f"Error: File {path} not found (double check the file path)"
|
|
214
|
+
|
|
215
|
+
confirmation = show_confirmation(
|
|
216
|
+
title=f"Delete '{path}'?",
|
|
217
|
+
skip_confirmation=ctx.deps.dangerously_skip_permissions,
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
if confirmation == "review":
|
|
221
|
+
feedback = show_input(ctx.deps.workspace_name)
|
|
222
|
+
ctx.deps.thinking_animation.start()
|
|
223
|
+
return f"User did not confirm the proposed changes and gave the following feedback: {feedback}"
|
|
224
|
+
|
|
225
|
+
click.echo(FeedbackManager.highlight(message=f"» Removing {path}..."))
|
|
226
|
+
|
|
227
|
+
# Check if it's a datafile that requires project rebuild
|
|
228
|
+
is_datafile = full_path.suffix in (".connection", ".datasource", ".pipe")
|
|
229
|
+
|
|
230
|
+
# Remove the file
|
|
231
|
+
full_path.unlink()
|
|
232
|
+
|
|
233
|
+
# Check for corresponding .sql file (for fixtures)
|
|
234
|
+
sql_file_path = full_path.with_suffix(".sql")
|
|
235
|
+
sql_file_removed = False
|
|
236
|
+
if sql_file_path.exists():
|
|
237
|
+
sql_file_path.unlink()
|
|
238
|
+
sql_file_removed = True
|
|
239
|
+
|
|
240
|
+
# Rebuild project if it's a datafile
|
|
241
|
+
if is_datafile:
|
|
242
|
+
ctx.deps.build_project(test=False, silent=True, load_fixtures=False)
|
|
243
|
+
|
|
244
|
+
success_message = f"✓ {path} removed"
|
|
245
|
+
if sql_file_removed:
|
|
246
|
+
success_message += f" (and {sql_file_path.name})"
|
|
247
|
+
|
|
248
|
+
click.echo(FeedbackManager.success(message=success_message))
|
|
249
|
+
ctx.deps.thinking_animation.start()
|
|
250
|
+
|
|
251
|
+
result_message = f"Removed {path}"
|
|
252
|
+
if sql_file_removed:
|
|
253
|
+
result_message += f" and {sql_file_path.name}"
|
|
254
|
+
if is_datafile:
|
|
255
|
+
result_message += ". Project built successfully."
|
|
256
|
+
else:
|
|
257
|
+
result_message += "."
|
|
258
|
+
|
|
259
|
+
return result_message
|
|
260
|
+
except AgentRunCancelled as e:
|
|
261
|
+
raise e
|
|
262
|
+
except CLIBuildException as e:
|
|
263
|
+
ctx.deps.thinking_animation.stop()
|
|
264
|
+
click.echo(FeedbackManager.error(message=e))
|
|
265
|
+
ctx.deps.thinking_animation.start()
|
|
266
|
+
return f"Error building project: {e}. If the error is related to another resource, fix it and try again."
|
|
267
|
+
except Exception as e:
|
|
268
|
+
ctx.deps.thinking_animation.stop()
|
|
269
|
+
click.echo(FeedbackManager.error(message=e))
|
|
270
|
+
ctx.deps.thinking_animation.start()
|
|
271
|
+
return f"Error removing {path}: {e}"
|
|
@@ -6,13 +6,28 @@ from tinybird.tb.modules.exceptions import CLIDeploymentException
|
|
|
6
6
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
def deploy(ctx: RunContext[TinybirdAgentContext]) -> str:
|
|
10
|
-
"""Deploy the project
|
|
9
|
+
def deploy(ctx: RunContext[TinybirdAgentContext], allow_destructive_operations: bool = False) -> str:
|
|
10
|
+
"""Deploy the project
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
allow_destructive_operations (bool): Set to true if a datasource, pipe or connection file has been deleted locally.
|
|
14
|
+
Optional. Default is False.
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
str: The result of the deployment
|
|
18
|
+
"""
|
|
11
19
|
try:
|
|
12
20
|
ctx.deps.thinking_animation.stop()
|
|
21
|
+
|
|
22
|
+
if allow_destructive_operations:
|
|
23
|
+
click.echo(
|
|
24
|
+
FeedbackManager.warning(message="Destructive operations flag is enabled due to a file deleted recently")
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
click.echo()
|
|
13
28
|
confirmation = show_confirmation(
|
|
14
29
|
title="Deploy the project?",
|
|
15
|
-
skip_confirmation=
|
|
30
|
+
skip_confirmation=False,
|
|
16
31
|
)
|
|
17
32
|
|
|
18
33
|
if confirmation == "review":
|
|
@@ -21,7 +36,7 @@ def deploy(ctx: RunContext[TinybirdAgentContext]) -> str:
|
|
|
21
36
|
return f"User did not confirm deployment and gave the following feedback: {feedback}"
|
|
22
37
|
|
|
23
38
|
click.echo(FeedbackManager.highlight(message="» Deploying project..."))
|
|
24
|
-
ctx.deps.deploy_project()
|
|
39
|
+
ctx.deps.deploy_project(allow_destructive_operations=allow_destructive_operations)
|
|
25
40
|
click.echo(FeedbackManager.success(message="✓ Project deployed successfully"))
|
|
26
41
|
ctx.deps.thinking_animation.start()
|
|
27
42
|
return "Project deployed successfully"
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/execute_query.py
RENAMED
|
@@ -35,7 +35,7 @@ def execute_query(
|
|
|
35
35
|
ctx: RunContext[TinybirdAgentContext],
|
|
36
36
|
query: str,
|
|
37
37
|
task: str,
|
|
38
|
-
cloud: bool =
|
|
38
|
+
cloud: Optional[bool] = None,
|
|
39
39
|
script: Optional[str] = None,
|
|
40
40
|
export_format: Optional[str] = None,
|
|
41
41
|
):
|
|
@@ -44,7 +44,7 @@ def execute_query(
|
|
|
44
44
|
Args:
|
|
45
45
|
query (str): The query to execute. Required.
|
|
46
46
|
task (str): The purpose of the query. Required.
|
|
47
|
-
cloud (bool): Whether to execute the query on cloud or local.
|
|
47
|
+
cloud (bool): Whether to execute the query on cloud or local. If None (user didn't specify), will ask user to clarify. Defaults to local (False) in dangerous skip permissions mode.
|
|
48
48
|
script (str): Python script using plotext to render the query results as a chart. The script will have access to 'data' (list of dicts), 'meta' (list of column info dicts), 'terminal_width' and 'terminal_height' variables. Always use plt.theme("clear") for transparent background and plt.plot_size(terminal_width, terminal_height) for proper sizing. For bar charts, use the simple versions: plt.simple_bar(), plt.simple_multiple_bar(), and plt.simple_stacked_bar(). Optional.
|
|
49
49
|
export_format (str): The format to export the query results to. Options: csv, json, ndjson. Optional.
|
|
50
50
|
|
|
@@ -61,6 +61,19 @@ def execute_query(
|
|
|
61
61
|
if query.lower().startswith(forbidden_command):
|
|
62
62
|
return f"Error executing query: {forbidden_command} is not allowed."
|
|
63
63
|
|
|
64
|
+
# Handle cloud parameter - ask user if uncertain and not in dangerous skip mode
|
|
65
|
+
if cloud is None:
|
|
66
|
+
if ctx.deps.dangerously_skip_permissions:
|
|
67
|
+
# Default to local when in dangerous skip mode
|
|
68
|
+
cloud = False
|
|
69
|
+
else:
|
|
70
|
+
# Ask the user to choose execution mode
|
|
71
|
+
from tinybird.tb.modules.agent.utils import show_env_options
|
|
72
|
+
|
|
73
|
+
cloud = show_env_options(ctx)
|
|
74
|
+
if cloud is None:
|
|
75
|
+
return "Query execution cancelled by user."
|
|
76
|
+
|
|
64
77
|
cloud_or_local = "cloud" if cloud else "local"
|
|
65
78
|
ctx.deps.thinking_animation.stop()
|
|
66
79
|
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
import click
|
|
2
4
|
from pydantic_ai import RunContext
|
|
3
5
|
|
|
4
|
-
from tinybird.tb.modules.agent.utils import TinybirdAgentContext
|
|
6
|
+
from tinybird.tb.modules.agent.utils import TinybirdAgentContext, show_env_options
|
|
5
7
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
def get_endpoint_stats(
|
|
9
|
-
ctx: RunContext[TinybirdAgentContext], endpoint_name: str, interval_days: int = 1, cloud: bool =
|
|
11
|
+
ctx: RunContext[TinybirdAgentContext], endpoint_name: str, interval_days: int = 1, cloud: Optional[bool] = None
|
|
10
12
|
):
|
|
11
13
|
"""Get stats for an endpoint:
|
|
12
14
|
|
|
13
15
|
Args:
|
|
14
16
|
endpoint_name (str): The name of the endpoint to get stats for. Required.
|
|
15
17
|
interval_days (int): The number of days to get stats for. Optional.
|
|
16
|
-
cloud (bool): Whether to get stats from cloud or local.
|
|
18
|
+
cloud (bool): Whether to get stats from cloud or local. If None (user didn't specify), will ask user to clarify. Defaults to local (False) in dangerous skip permissions mode.
|
|
17
19
|
|
|
18
20
|
Returns:
|
|
19
21
|
str: The result of the stats.
|
|
@@ -25,6 +27,17 @@ def get_endpoint_stats(
|
|
|
25
27
|
pipe_stats = "tinybird.pipe_stats"
|
|
26
28
|
date_column = "date"
|
|
27
29
|
|
|
30
|
+
# Handle cloud parameter - ask user if uncertain and not in dangerous skip mode
|
|
31
|
+
if cloud is None:
|
|
32
|
+
if ctx.deps.dangerously_skip_permissions:
|
|
33
|
+
# Default to local when in dangerous skip mode
|
|
34
|
+
cloud = False
|
|
35
|
+
else:
|
|
36
|
+
# Ask the user to choose execution mode
|
|
37
|
+
cloud = show_env_options(ctx)
|
|
38
|
+
if cloud is None:
|
|
39
|
+
return "Get endpoint stats operation cancelled by user."
|
|
40
|
+
|
|
28
41
|
days = "day" if interval_days == 1 else "days"
|
|
29
42
|
cloud_or_local = "cloud" if cloud else "local"
|
|
30
43
|
ctx.deps.thinking_animation.stop()
|
|
@@ -1,22 +1,35 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
import click
|
|
2
4
|
import requests
|
|
3
5
|
from pydantic_ai import RunContext
|
|
4
6
|
|
|
5
|
-
from tinybird.tb.modules.agent.utils import TinybirdAgentContext
|
|
7
|
+
from tinybird.tb.modules.agent.utils import TinybirdAgentContext, show_env_options
|
|
6
8
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
7
9
|
|
|
8
10
|
|
|
9
|
-
def get_openapi_definition(ctx: RunContext[TinybirdAgentContext], endpoint_name: str, cloud: bool =
|
|
11
|
+
def get_openapi_definition(ctx: RunContext[TinybirdAgentContext], endpoint_name: str, cloud: Optional[bool] = None):
|
|
10
12
|
"""Get the OpenAPI definition for an endpoint:
|
|
11
13
|
|
|
12
14
|
Args:
|
|
13
15
|
endpoint_name (str): The name of the endpoint to get the OpenAPI definition for. Required.
|
|
14
|
-
cloud (bool): Whether to get the OpenAPI definition from cloud or local.
|
|
16
|
+
cloud (bool): Whether to get the OpenAPI definition from cloud or local. If None (user didn't specify), will ask user to clarify. Defaults to local (False) in dangerous skip permissions mode.
|
|
15
17
|
|
|
16
18
|
Returns:
|
|
17
19
|
str: The OpenAPI definition for the endpoint.
|
|
18
20
|
"""
|
|
19
21
|
|
|
22
|
+
# Handle cloud parameter - ask user if uncertain and not in dangerous skip mode
|
|
23
|
+
if cloud is None:
|
|
24
|
+
if ctx.deps.dangerously_skip_permissions:
|
|
25
|
+
# Default to local when in dangerous skip mode
|
|
26
|
+
cloud = False
|
|
27
|
+
else:
|
|
28
|
+
# Ask the user to choose execution mode
|
|
29
|
+
cloud = show_env_options(ctx)
|
|
30
|
+
if cloud is None:
|
|
31
|
+
return "Get OpenAPI definition operation cancelled by user."
|
|
32
|
+
|
|
20
33
|
cloud_or_local = "Cloud" if cloud else "Local"
|
|
21
34
|
ctx.deps.thinking_animation.stop()
|
|
22
35
|
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/request_endpoint.py
RENAMED
|
@@ -4,7 +4,7 @@ import click
|
|
|
4
4
|
import humanfriendly
|
|
5
5
|
from pydantic_ai import RunContext
|
|
6
6
|
|
|
7
|
-
from tinybird.tb.modules.agent.utils import TinybirdAgentContext, limit_result_output
|
|
7
|
+
from tinybird.tb.modules.agent.utils import TinybirdAgentContext, limit_result_output, show_env_options
|
|
8
8
|
from tinybird.tb.modules.common import echo_safe_humanfriendly_tables_format_pretty_table
|
|
9
9
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
10
10
|
|
|
@@ -13,19 +13,29 @@ def request_endpoint(
|
|
|
13
13
|
ctx: RunContext[TinybirdAgentContext],
|
|
14
14
|
endpoint_name: str,
|
|
15
15
|
params: Optional[dict[str, str]] = None,
|
|
16
|
-
cloud: bool =
|
|
16
|
+
cloud: Optional[bool] = None,
|
|
17
17
|
):
|
|
18
18
|
"""Request an endpoint:
|
|
19
19
|
|
|
20
20
|
Args:
|
|
21
21
|
endpoint_name (str): The name of the endpoint to request. Required.
|
|
22
22
|
params (dict): The parameters to pass to the endpoint. Optional.
|
|
23
|
-
cloud (bool): Whether to request the endpoint on cloud or local.
|
|
23
|
+
cloud (bool): Whether to request the endpoint on cloud or local. If None (user didn't specify), will ask user to clarify. Defaults to local (False) in dangerous skip permissions mode.
|
|
24
24
|
|
|
25
25
|
Returns:
|
|
26
26
|
str: The result of the query.
|
|
27
27
|
"""
|
|
28
28
|
try:
|
|
29
|
+
# Handle cloud parameter - ask user if uncertain and not in dangerous skip mode
|
|
30
|
+
if cloud is None:
|
|
31
|
+
if ctx.deps.dangerously_skip_permissions:
|
|
32
|
+
# Default to local when in dangerous skip mode
|
|
33
|
+
cloud = False
|
|
34
|
+
else:
|
|
35
|
+
# Ask the user to choose execution mode
|
|
36
|
+
cloud = show_env_options(ctx)
|
|
37
|
+
if cloud is None:
|
|
38
|
+
return "Endpoint request cancelled by user."
|
|
29
39
|
cloud_or_local = "cloud" if cloud else "local"
|
|
30
40
|
ctx.deps.thinking_animation.stop()
|
|
31
41
|
with_params = f" with params {params}" if params else ""
|
|
@@ -43,7 +43,7 @@ class TinybirdAgentContext(BaseModel):
|
|
|
43
43
|
explore_data: Callable[[str], str]
|
|
44
44
|
build_project: Callable[..., None]
|
|
45
45
|
build_project_test: Callable[..., None]
|
|
46
|
-
deploy_project: Callable[
|
|
46
|
+
deploy_project: Callable[..., None]
|
|
47
47
|
deploy_check_project: Callable[[], None]
|
|
48
48
|
mock_data: Callable[..., list[dict[str, Any]]]
|
|
49
49
|
append_data_local: Callable[..., None]
|
|
@@ -743,6 +743,30 @@ def show_confirmation(title: str, skip_confirmation: bool = False, show_review:
|
|
|
743
743
|
raise AgentRunCancelled(f"User cancelled the operation: {title}")
|
|
744
744
|
|
|
745
745
|
|
|
746
|
+
def show_env_options(ctx: "RunContext[TinybirdAgentContext]") -> Optional[bool]:
|
|
747
|
+
"""Show environment options for user to choose between local and cloud.
|
|
748
|
+
|
|
749
|
+
Args:
|
|
750
|
+
ctx: The run context containing TinybirdAgentContext
|
|
751
|
+
|
|
752
|
+
Returns:
|
|
753
|
+
bool: True for cloud, False for local, None if cancelled
|
|
754
|
+
"""
|
|
755
|
+
|
|
756
|
+
ctx.deps.thinking_animation.stop()
|
|
757
|
+
click.echo(FeedbackManager.highlight(message="» Agent is uncertain about target environment"))
|
|
758
|
+
|
|
759
|
+
choice = show_options(
|
|
760
|
+
options=["Tinybird Local", f"Tinybird Cloud ({ctx.deps.host})"], title="Where should this query be executed?"
|
|
761
|
+
)
|
|
762
|
+
ctx.deps.thinking_animation.start()
|
|
763
|
+
|
|
764
|
+
if choice is None:
|
|
765
|
+
return None
|
|
766
|
+
|
|
767
|
+
return choice.startswith("Tinybird Cloud")
|
|
768
|
+
|
|
769
|
+
|
|
746
770
|
def copy_fixture_to_project_folder_if_needed(
|
|
747
771
|
ctx: RunContext[TinybirdAgentContext], fixture_pathname: str
|
|
748
772
|
) -> Union[Path, str]:
|
|
@@ -121,7 +121,7 @@ def connection_ls(ctx: Context, service: Optional[DataConnectorType] = None) ->
|
|
|
121
121
|
obj: Dict[str, Any] = ctx.ensure_object(dict)
|
|
122
122
|
client: TinyB = obj["client"]
|
|
123
123
|
|
|
124
|
-
connections = client.connections(connector=service
|
|
124
|
+
connections = client.connections(connector=service)
|
|
125
125
|
columns = []
|
|
126
126
|
table = []
|
|
127
127
|
|
|
@@ -95,7 +95,7 @@ tinybird/tb/modules/agent/tools/__init__.py
|
|
|
95
95
|
tinybird/tb/modules/agent/tools/analyze.py
|
|
96
96
|
tinybird/tb/modules/agent/tools/append.py
|
|
97
97
|
tinybird/tb/modules/agent/tools/build.py
|
|
98
|
-
tinybird/tb/modules/agent/tools/
|
|
98
|
+
tinybird/tb/modules/agent/tools/datafile.py
|
|
99
99
|
tinybird/tb/modules/agent/tools/deploy.py
|
|
100
100
|
tinybird/tb/modules/agent/tools/deploy_check.py
|
|
101
101
|
tinybird/tb/modules/agent/tools/diff_resource.py
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/deploy_check.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/diff_resource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/agent/tools/run_command.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
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/build_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/build_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/format_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb/modules/datafile/format_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/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
|
|
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.dev271 → tinybird-0.0.1.dev273}/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.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/tinyunit/tinyunit.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev271 → tinybird-0.0.1.dev273}/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
|