tinybird 0.0.1.dev301__tar.gz → 0.0.1.dev303__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.dev301 → tinybird-0.0.1.dev303}/PKG-INFO +1 -1
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/config.py +0 -6
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/__cli__.py +2 -2
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/agent.py +16 -42
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/banner.py +1 -1
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/models.py +6 -2
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/deploy.py +1 -1
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/execute_query.py +1 -1
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/utils.py +0 -1
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/cli.py +1 -2
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/create.py +72 -150
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datasource.py +24 -6
- tinybird-0.0.1.dev303/tinybird/tb/modules/mock.py +41 -0
- tinybird-0.0.1.dev303/tinybird/tb/modules/mock_common.py +17 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/test.py +7 -6
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/test_common.py +0 -89
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird.egg-info/PKG-INFO +1 -1
- tinybird-0.0.1.dev301/tinybird/tb/modules/mock.py +0 -90
- tinybird-0.0.1.dev301/tinybird/tb/modules/mock_common.py +0 -71
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/setup.cfg +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/datafile/common.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/datafile/parse_connection.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/prompts.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/service_datasources.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/sql_template.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/cli.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/client.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/config.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/__init__.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/animations.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/command_agent.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/compactor.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/explore_agent.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/file_agent.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/memory.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/mock_agent.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/prompts.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/testing_agent.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/__init__.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/analyze.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/append.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/build.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/datafile.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/deploy_check.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/diff_resource.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/file.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/get_endpoint_stats.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/get_openapi_definition.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/mock.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/plan.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/request_endpoint.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/run_command.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/secret.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/test.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/build.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/build_common.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/deployment.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/deployment_common.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/deprecations.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/dev_server.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/info.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/login.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/login_common.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/open.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/project.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/secret_common.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/shell.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/sink.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/token.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird.egg-info/SOURCES.txt +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -38,13 +38,10 @@ LEGACY_HOSTS = {
|
|
|
38
38
|
"https://api.wadus3.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus3",
|
|
39
39
|
"https://api.wadus4.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus4",
|
|
40
40
|
"https://api.wadus5.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus5",
|
|
41
|
-
"https://api.wadus6.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus6",
|
|
42
41
|
"https://api.wadus1.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus1",
|
|
43
42
|
"https://api.wadus2.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus2",
|
|
44
43
|
"https://api.wadus3.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus3",
|
|
45
44
|
"https://api.wadus4.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus4",
|
|
46
|
-
"https://api.wadus5.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus5",
|
|
47
|
-
"https://api.wadus6.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus6",
|
|
48
45
|
"https://ui.tinybird.co": "https://app.tinybird.co/gcp/europe-west3",
|
|
49
46
|
"https://ui.us-east.tinybird.co": "https://app.tinybird.co/gcp/us-east4",
|
|
50
47
|
"https://ui.us-east.aws.tinybird.co": "https://app.tinybird.co/aws/us-east-1",
|
|
@@ -62,13 +59,10 @@ LEGACY_HOSTS = {
|
|
|
62
59
|
"https://ui.wadus3.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus3",
|
|
63
60
|
"https://ui.wadus4.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus4",
|
|
64
61
|
"https://ui.wadus5.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus5",
|
|
65
|
-
"https://ui.wadus6.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus6",
|
|
66
62
|
"https://ui.wadus1.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus1",
|
|
67
63
|
"https://ui.wadus2.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus2",
|
|
68
64
|
"https://ui.wadus3.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus3",
|
|
69
65
|
"https://ui.wadus4.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus4",
|
|
70
|
-
"https://ui.wadus5.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus5",
|
|
71
|
-
"https://ui.wadus6.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus6",
|
|
72
66
|
}
|
|
73
67
|
|
|
74
68
|
|
|
@@ -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.dev303'
|
|
8
|
+
__revision__ = 'ff545f6'
|
|
@@ -6,7 +6,6 @@ import sys
|
|
|
6
6
|
import urllib.parse
|
|
7
7
|
import uuid
|
|
8
8
|
from functools import partial
|
|
9
|
-
from pathlib import Path
|
|
10
9
|
from typing import Any, Callable, Optional
|
|
11
10
|
|
|
12
11
|
import click
|
|
@@ -27,7 +26,6 @@ from tinybird.tb.modules.agent.file_agent import FileAgent
|
|
|
27
26
|
from tinybird.tb.modules.agent.memory import (
|
|
28
27
|
clear_history,
|
|
29
28
|
clear_messages,
|
|
30
|
-
get_last_messages_from_last_user_prompt,
|
|
31
29
|
save_messages,
|
|
32
30
|
)
|
|
33
31
|
from tinybird.tb.modules.agent.mock_agent import MockAgent
|
|
@@ -72,12 +70,12 @@ from tinybird.tb.modules.common import (
|
|
|
72
70
|
)
|
|
73
71
|
from tinybird.tb.modules.config import CLIConfig
|
|
74
72
|
from tinybird.tb.modules.deployment_common import create_deployment
|
|
75
|
-
from tinybird.tb.modules.exceptions import CLIBuildException, CLIDeploymentException
|
|
73
|
+
from tinybird.tb.modules.exceptions import CLIBuildException, CLIDeploymentException
|
|
76
74
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
77
75
|
from tinybird.tb.modules.llm import LLM
|
|
78
76
|
from tinybird.tb.modules.local_common import get_tinybird_local_client
|
|
79
77
|
from tinybird.tb.modules.login_common import login
|
|
80
|
-
from tinybird.tb.modules.mock_common import append_mock_data
|
|
78
|
+
from tinybird.tb.modules.mock_common import append_mock_data
|
|
81
79
|
from tinybird.tb.modules.project import Project
|
|
82
80
|
from tinybird.tb.modules.test_common import run_tests as run_tests_common
|
|
83
81
|
|
|
@@ -92,6 +90,7 @@ class TinybirdAgent:
|
|
|
92
90
|
project: Project,
|
|
93
91
|
dangerously_skip_permissions: bool,
|
|
94
92
|
prompt_mode: bool,
|
|
93
|
+
feature: Optional[str] = None,
|
|
95
94
|
):
|
|
96
95
|
self.token = token
|
|
97
96
|
self.user_token = user_token
|
|
@@ -101,14 +100,12 @@ class TinybirdAgent:
|
|
|
101
100
|
self.project = project
|
|
102
101
|
self.thinking_animation = ThinkingAnimation()
|
|
103
102
|
self.confirmed_plan_id: Optional[str] = None
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
else:
|
|
107
|
-
self.messages = []
|
|
103
|
+
self.feature = feature
|
|
104
|
+
self.messages: list[ModelMessage] = []
|
|
108
105
|
cli_config = CLIConfig.get_project_config()
|
|
109
106
|
regions = get_regions(cli_config)
|
|
110
107
|
self.agent = Agent(
|
|
111
|
-
model=create_model(user_token, host, workspace_id),
|
|
108
|
+
model=create_model(user_token, host, workspace_id, feature=feature),
|
|
112
109
|
deps_type=TinybirdAgentContext,
|
|
113
110
|
instructions=[agent_system_prompt],
|
|
114
111
|
tools=[
|
|
@@ -382,7 +379,6 @@ class TinybirdAgent:
|
|
|
382
379
|
build_project=partial(build_project, project=project, config=config),
|
|
383
380
|
deploy_project=partial(deploy_project, project=project, config=config),
|
|
384
381
|
deploy_check_project=partial(deploy_check_project, project=project, config=config),
|
|
385
|
-
mock_data=partial(mock_data, project=project, config=config),
|
|
386
382
|
append_data_local=partial(append_data_local, config=config),
|
|
387
383
|
append_data_cloud=partial(append_data_cloud, config=config),
|
|
388
384
|
analyze_fixture=partial(analyze_fixture, config=config),
|
|
@@ -511,7 +507,11 @@ class TinybirdAgent:
|
|
|
511
507
|
|
|
512
508
|
|
|
513
509
|
def run_agent(
|
|
514
|
-
config: dict[str, Any],
|
|
510
|
+
config: dict[str, Any],
|
|
511
|
+
project: Project,
|
|
512
|
+
dangerously_skip_permissions: bool,
|
|
513
|
+
prompt: Optional[str] = None,
|
|
514
|
+
feature: Optional[str] = None,
|
|
515
515
|
):
|
|
516
516
|
if not prompt:
|
|
517
517
|
latest_version = CheckPypi().get_latest_version()
|
|
@@ -526,7 +526,10 @@ def run_agent(
|
|
|
526
526
|
)
|
|
527
527
|
if yes:
|
|
528
528
|
update_cli()
|
|
529
|
-
|
|
529
|
+
|
|
530
|
+
if not prompt:
|
|
531
|
+
click.echo(FeedbackManager.highlight(message="» Initializing Tinybird Code..."))
|
|
532
|
+
|
|
530
533
|
token = config.get("token", "")
|
|
531
534
|
host = config.get("host", "")
|
|
532
535
|
user_token = config.get("user_token", "")
|
|
@@ -585,6 +588,7 @@ def run_agent(
|
|
|
585
588
|
project,
|
|
586
589
|
dangerously_skip_permissions,
|
|
587
590
|
prompt_mode,
|
|
591
|
+
feature,
|
|
588
592
|
)
|
|
589
593
|
|
|
590
594
|
# Print mode: run once with the provided prompt and exit
|
|
@@ -763,36 +767,6 @@ def append_data_cloud(config: dict[str, Any], datasource_name: str, path: str) -
|
|
|
763
767
|
append_mock_data(client, datasource_name, path)
|
|
764
768
|
|
|
765
769
|
|
|
766
|
-
def mock_data(
|
|
767
|
-
config: dict[str, Any],
|
|
768
|
-
project: Project,
|
|
769
|
-
datasource_name: str,
|
|
770
|
-
data_format: str,
|
|
771
|
-
rows: int,
|
|
772
|
-
context: Optional[str] = None,
|
|
773
|
-
) -> list[dict[str, Any]]:
|
|
774
|
-
client = get_tinybird_local_client(config, test=False, silent=False)
|
|
775
|
-
cli_config = CLIConfig.get_project_config()
|
|
776
|
-
datasource_path = project.get_resource_path(datasource_name, "datasource")
|
|
777
|
-
|
|
778
|
-
if not datasource_path:
|
|
779
|
-
raise CLIMockException(f"Datasource {datasource_name} not found")
|
|
780
|
-
|
|
781
|
-
datasource_content = Path(datasource_path).read_text()
|
|
782
|
-
return create_mock_data(
|
|
783
|
-
datasource_name,
|
|
784
|
-
datasource_content,
|
|
785
|
-
rows,
|
|
786
|
-
context or "",
|
|
787
|
-
cli_config,
|
|
788
|
-
config,
|
|
789
|
-
cli_config.get_user_token() or "",
|
|
790
|
-
client,
|
|
791
|
-
data_format,
|
|
792
|
-
project.folder,
|
|
793
|
-
)
|
|
794
|
-
|
|
795
|
-
|
|
796
770
|
def analyze_fixture(config: dict[str, Any], fixture_path: str, format: str = "json") -> dict[str, Any]:
|
|
797
771
|
local_client = get_tinybird_local_client(config, test=False, silent=True)
|
|
798
772
|
meta, _data = _analyze(fixture_path, local_client, format)
|
|
@@ -8,7 +8,7 @@ from pydantic_ai.retries import AsyncTenacityTransport, wait_retry_after
|
|
|
8
8
|
from tenacity import AsyncRetrying, retry_if_exception_type, stop_after_attempt, wait_exponential
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def create_retrying_client(token: str, workspace_id: str):
|
|
11
|
+
def create_retrying_client(token: str, workspace_id: str, feature: Optional[str] = None):
|
|
12
12
|
"""Create a client with smart retry handling for multiple error types."""
|
|
13
13
|
|
|
14
14
|
def should_retry_status(response):
|
|
@@ -29,7 +29,10 @@ def create_retrying_client(token: str, workspace_id: str):
|
|
|
29
29
|
),
|
|
30
30
|
validate_response=should_retry_status,
|
|
31
31
|
)
|
|
32
|
-
|
|
32
|
+
params = {"token": token, "workspace_id": workspace_id}
|
|
33
|
+
if feature:
|
|
34
|
+
params["feature"] = feature
|
|
35
|
+
return AsyncClient(transport=transport, params=params)
|
|
33
36
|
|
|
34
37
|
|
|
35
38
|
def create_model(
|
|
@@ -38,6 +41,7 @@ def create_model(
|
|
|
38
41
|
workspace_id: str,
|
|
39
42
|
model: AnthropicModelName = "claude-4-sonnet-20250514",
|
|
40
43
|
run_id: Optional[str] = None,
|
|
44
|
+
feature: Optional[str] = None,
|
|
41
45
|
):
|
|
42
46
|
default_headers = {}
|
|
43
47
|
if run_id:
|
|
@@ -24,7 +24,7 @@ def deploy(ctx: RunContext[TinybirdAgentContext], allow_destructive_operations:
|
|
|
24
24
|
FeedbackManager.warning(message="Destructive operations flag is enabled due to a file deleted recently")
|
|
25
25
|
)
|
|
26
26
|
|
|
27
|
-
click.echo()
|
|
27
|
+
click.echo("")
|
|
28
28
|
confirmation = show_confirmation(
|
|
29
29
|
title="Deploy the project?",
|
|
30
30
|
skip_confirmation=False,
|
{tinybird-0.0.1.dev301 → tinybird-0.0.1.dev303}/tinybird/tb/modules/agent/tools/execute_query.py
RENAMED
|
@@ -121,7 +121,7 @@ def execute_query(
|
|
|
121
121
|
bytes_read = humanfriendly.format_size(stats["bytes_read"])
|
|
122
122
|
|
|
123
123
|
click.echo(FeedbackManager.info_query_stats(seconds=seconds, rows=rows_read, bytes=bytes_read))
|
|
124
|
-
click.echo()
|
|
124
|
+
click.echo("")
|
|
125
125
|
|
|
126
126
|
if not result["data"]:
|
|
127
127
|
click.echo(FeedbackManager.info_no_rows())
|
|
@@ -44,7 +44,6 @@ class TinybirdAgentContext(BaseModel):
|
|
|
44
44
|
build_project_test: Callable[..., None]
|
|
45
45
|
deploy_project: Callable[..., None]
|
|
46
46
|
deploy_check_project: Callable[[], None]
|
|
47
|
-
mock_data: Callable[..., list[dict[str, Any]]]
|
|
48
47
|
append_data_local: Callable[..., None]
|
|
49
48
|
append_data_cloud: Callable[..., None]
|
|
50
49
|
analyze_fixture: Callable[..., dict[str, Any]]
|
|
@@ -488,7 +488,6 @@ def create_ctx_client(
|
|
|
488
488
|
"logout",
|
|
489
489
|
"update",
|
|
490
490
|
"upgrade",
|
|
491
|
-
"create",
|
|
492
491
|
"info",
|
|
493
492
|
"tag",
|
|
494
493
|
"push",
|
|
@@ -502,7 +501,7 @@ def create_ctx_client(
|
|
|
502
501
|
return None
|
|
503
502
|
|
|
504
503
|
commands_always_cloud = ["infra"]
|
|
505
|
-
commands_always_local = ["build", "dev"]
|
|
504
|
+
commands_always_local = ["build", "dev", "create"]
|
|
506
505
|
command_always_test = ["test"]
|
|
507
506
|
|
|
508
507
|
if (
|
|
@@ -3,25 +3,22 @@ import os
|
|
|
3
3
|
import re
|
|
4
4
|
import shutil
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Any, Dict, List, Optional
|
|
6
|
+
from typing import Any, Dict, List, Optional, Set
|
|
7
7
|
from urllib.parse import urlparse
|
|
8
8
|
|
|
9
9
|
import click
|
|
10
10
|
import requests
|
|
11
11
|
|
|
12
|
-
from tinybird.prompts import claude_rules_prompt,
|
|
13
|
-
from tinybird.tb.
|
|
12
|
+
from tinybird.prompts import claude_rules_prompt, rules_prompt
|
|
13
|
+
from tinybird.tb.modules.agent import run_agent
|
|
14
14
|
from tinybird.tb.modules.cicd import init_cicd
|
|
15
15
|
from tinybird.tb.modules.cli import cli
|
|
16
|
-
from tinybird.tb.modules.common import _generate_datafile
|
|
16
|
+
from tinybird.tb.modules.common import _generate_datafile
|
|
17
17
|
from tinybird.tb.modules.config import CLIConfig
|
|
18
18
|
from tinybird.tb.modules.datafile.fixture import persist_fixture
|
|
19
19
|
from tinybird.tb.modules.exceptions import CLICreateException
|
|
20
20
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
21
|
-
from tinybird.tb.modules.llm import LLM
|
|
22
|
-
from tinybird.tb.modules.llm_utils import extract_xml, parse_xml
|
|
23
21
|
from tinybird.tb.modules.local_common import get_tinybird_local_client
|
|
24
|
-
from tinybird.tb.modules.mock_common import create_mock_data
|
|
25
22
|
from tinybird.tb.modules.project import Project
|
|
26
23
|
|
|
27
24
|
|
|
@@ -67,13 +64,9 @@ def create(
|
|
|
67
64
|
folder_path.mkdir()
|
|
68
65
|
|
|
69
66
|
try:
|
|
70
|
-
tb_client = config.get_client(token=ctx_config.get("token"), host=ctx_config.get("host"))
|
|
71
|
-
user_token: str = ""
|
|
72
67
|
created_something = False
|
|
73
|
-
if prompt:
|
|
74
|
-
|
|
75
|
-
if not user_token:
|
|
76
|
-
raise Exception("This action requires authentication. Run 'tb login' first.")
|
|
68
|
+
if prompt and not ctx_config.get("user_token"):
|
|
69
|
+
raise Exception("This action requires authentication. Run 'tb login' first.")
|
|
77
70
|
|
|
78
71
|
if not validate_project_structure(project):
|
|
79
72
|
click.echo(FeedbackManager.highlight(message="\n» Creating new project structure..."))
|
|
@@ -99,28 +92,20 @@ def create(
|
|
|
99
92
|
|
|
100
93
|
prompt_result: List[Path] = []
|
|
101
94
|
if prompt:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if readme_path.exists():
|
|
106
|
-
click.echo(FeedbackManager.highlight(message="\n» Updating project description..."))
|
|
107
|
-
else:
|
|
108
|
-
click.echo(FeedbackManager.highlight(message="\n» Creating project description..."))
|
|
109
|
-
readme_path.touch()
|
|
110
|
-
llm = LLM(user_token=str(user_token), host=tb_client.host)
|
|
111
|
-
readme_user_prompt = prompt or ""
|
|
112
|
-
all_resources_xml = get_resources_xml(project)
|
|
113
|
-
readme_response = llm.ask(
|
|
114
|
-
system_prompt=readme_prompt(
|
|
115
|
-
readme_path.read_text(), tb_client.host, "$TB_ADMIN_TOKEN", all_resources_xml
|
|
116
|
-
),
|
|
117
|
-
prompt=readme_user_prompt,
|
|
118
|
-
feature="tb_create_readme",
|
|
95
|
+
prompt_instructions = (
|
|
96
|
+
"Create or update the Tinybird datasources, pipes, and connections required to satisfy the following request. "
|
|
97
|
+
"Do not generate mock data or append data; those steps will run later programmatically."
|
|
119
98
|
)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
99
|
+
prompt_result = create_resources_from_prompt(
|
|
100
|
+
ctx_config,
|
|
101
|
+
project,
|
|
102
|
+
prompt,
|
|
103
|
+
feature="tb_create",
|
|
104
|
+
instructions=prompt_instructions,
|
|
105
|
+
)
|
|
106
|
+
result.extend(prompt_result)
|
|
107
|
+
if prompt_result:
|
|
108
|
+
created_something = True
|
|
124
109
|
|
|
125
110
|
if data or prompt:
|
|
126
111
|
click.echo(FeedbackManager.success(message="✓ Resources created!\n"))
|
|
@@ -180,24 +165,30 @@ def create(
|
|
|
180
165
|
datasource_name = datasource_path.stem
|
|
181
166
|
datasource_content = datasource_path.read_text()
|
|
182
167
|
has_json_path = "`json:" in datasource_content
|
|
183
|
-
if has_json_path:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
168
|
+
if not has_json_path:
|
|
169
|
+
continue
|
|
170
|
+
|
|
171
|
+
fixture_path = Path(folder) / "fixtures" / f"{datasource_name}.ndjson"
|
|
172
|
+
fixture_existed = fixture_path.exists()
|
|
173
|
+
fixture_prompt = (
|
|
174
|
+
f"Generate {rows} rows of representative sample data for the Tinybird datasource defined in {datasource_path}. "
|
|
175
|
+
f"Store the data in ndjson format at fixtures/{datasource_name}.ndjson."
|
|
176
|
+
)
|
|
177
|
+
if prompt.strip():
|
|
178
|
+
fixture_prompt += f"\n\nOriginal project request:\n{prompt.strip()}"
|
|
179
|
+
|
|
180
|
+
run_agent(
|
|
181
|
+
ctx_config,
|
|
182
|
+
project,
|
|
183
|
+
True,
|
|
184
|
+
prompt=fixture_prompt,
|
|
185
|
+
feature="tb_mock",
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
if fixture_path.exists() and not fixture_existed:
|
|
189
|
+
click.echo(FeedbackManager.info_file_created(file=f"fixtures/{datasource_name}.ndjson"))
|
|
190
|
+
click.echo(FeedbackManager.success(message="✓ Done!"))
|
|
191
|
+
created_something = True
|
|
201
192
|
|
|
202
193
|
if not created_something and not len(result) > 0:
|
|
203
194
|
click.echo(FeedbackManager.warning(message="△ No resources created\n"))
|
|
@@ -291,86 +282,39 @@ def create_project_structure(folder: str):
|
|
|
291
282
|
|
|
292
283
|
|
|
293
284
|
def create_resources_from_prompt(
|
|
294
|
-
|
|
295
|
-
user_token: str,
|
|
296
|
-
prompt: str,
|
|
285
|
+
config: Dict[str, Any],
|
|
297
286
|
project: Project,
|
|
298
|
-
|
|
287
|
+
prompt: str,
|
|
288
|
+
feature: str = "tb_create",
|
|
289
|
+
instructions: Optional[str] = None,
|
|
299
290
|
) -> List[Path]:
|
|
300
|
-
|
|
301
|
-
datasource_paths = [Path(ds_file) for ds_file in project.get_datasource_files()]
|
|
302
|
-
pipes_paths = [Path(pipe_file) for pipe_file in project.get_pipe_files()]
|
|
303
|
-
connections_paths = [Path(conn_file) for conn_file in project.get_connection_files()]
|
|
304
|
-
resources_xml = "\n".join(
|
|
305
|
-
[
|
|
306
|
-
f"<resource><type>{resource_type}</type><name>{resource_name}</name><content>{resource_content}</content></resource>"
|
|
307
|
-
for resource_type, resource_name, resource_content in [
|
|
308
|
-
("datasource", ds.stem, ds.read_text()) for ds in datasource_paths
|
|
309
|
-
]
|
|
310
|
-
+ [
|
|
311
|
-
(
|
|
312
|
-
"pipe",
|
|
313
|
-
pipe.stem,
|
|
314
|
-
pipe.read_text(),
|
|
315
|
-
)
|
|
316
|
-
for pipe in pipes_paths
|
|
317
|
-
]
|
|
318
|
-
+ [
|
|
319
|
-
(
|
|
320
|
-
"connection",
|
|
321
|
-
conn.stem,
|
|
322
|
-
conn.read_text(),
|
|
323
|
-
)
|
|
324
|
-
for conn in connections_paths
|
|
325
|
-
]
|
|
326
|
-
]
|
|
327
|
-
)
|
|
328
|
-
llm = LLM(user_token=user_token, host=tb_client.host)
|
|
329
|
-
prompt_result = llm.ask(system_prompt=create_prompt(resources_xml), prompt=prompt, feature=feature)
|
|
330
|
-
prompt_result = extract_xml(prompt_result, "response")
|
|
331
|
-
resources = parse_xml(prompt_result, "resource")
|
|
332
|
-
datasources = []
|
|
333
|
-
pipes = []
|
|
334
|
-
connections = []
|
|
335
|
-
for resource_xml in resources:
|
|
336
|
-
resource_type = extract_xml(resource_xml, "type")
|
|
337
|
-
name = extract_xml(resource_xml, "name")
|
|
338
|
-
content = extract_xml(resource_xml, "content")
|
|
339
|
-
resource = {
|
|
340
|
-
"name": name,
|
|
341
|
-
"content": content,
|
|
342
|
-
}
|
|
343
|
-
if resource_type.lower() == "datasource":
|
|
344
|
-
datasources.append(resource)
|
|
345
|
-
elif resource_type.lower() == "pipe":
|
|
346
|
-
pipes.append(resource)
|
|
347
|
-
elif resource_type.lower() == "connection":
|
|
348
|
-
connections.append(resource)
|
|
349
|
-
|
|
350
|
-
for ds in datasources:
|
|
351
|
-
content = ds["content"].replace("```", "")
|
|
352
|
-
filename = f"{ds['name']}.datasource"
|
|
353
|
-
ds_file = generate_datafile(
|
|
354
|
-
content,
|
|
355
|
-
filename=filename,
|
|
356
|
-
data=None,
|
|
357
|
-
_format="ndjson",
|
|
358
|
-
force=True,
|
|
359
|
-
folder=project.folder,
|
|
360
|
-
)
|
|
361
|
-
result.append(ds_file)
|
|
362
|
-
for pipe in pipes:
|
|
363
|
-
content = pipe["content"].replace("```", "")
|
|
364
|
-
pipe_file = generate_pipe_file(pipe["name"], content, project.folder)
|
|
365
|
-
result.append(pipe_file)
|
|
291
|
+
"""Run the agent in prompt mode and report newly created project resources."""
|
|
366
292
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
293
|
+
agent_prompt = prompt.strip()
|
|
294
|
+
if instructions:
|
|
295
|
+
instructions = instructions.strip()
|
|
296
|
+
if agent_prompt:
|
|
297
|
+
agent_prompt = f"{instructions}\n\n{agent_prompt}"
|
|
298
|
+
else:
|
|
299
|
+
agent_prompt = instructions
|
|
372
300
|
|
|
373
|
-
|
|
301
|
+
if not agent_prompt:
|
|
302
|
+
return []
|
|
303
|
+
|
|
304
|
+
resources_before = _collect_project_resource_paths(project)
|
|
305
|
+
run_agent(config, project, True, prompt=agent_prompt, feature=feature)
|
|
306
|
+
resources_after = _collect_project_resource_paths(project)
|
|
307
|
+
|
|
308
|
+
created_resources = [Path(path) for path in sorted(resources_after - resources_before)]
|
|
309
|
+
return created_resources
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def _collect_project_resource_paths(project: Project) -> Set[Path]:
|
|
313
|
+
resources: Set[Path] = set()
|
|
314
|
+
resources.update(Path(path) for path in project.get_datasource_files())
|
|
315
|
+
resources.update(Path(path) for path in project.get_pipe_files())
|
|
316
|
+
resources.update(Path(path) for path in project.get_connection_files())
|
|
317
|
+
return resources
|
|
374
318
|
|
|
375
319
|
|
|
376
320
|
def init_git(folder: str):
|
|
@@ -513,28 +457,6 @@ def save_context(prompt: str, feedback: str):
|
|
|
513
457
|
context_file.write_text(f"- {prompt}\n{feedback}")
|
|
514
458
|
|
|
515
459
|
|
|
516
|
-
def get_resources_xml(project: Project) -> str:
|
|
517
|
-
datasource_paths = [Path(f) for f in project.get_datasource_files()]
|
|
518
|
-
pipes_paths = [Path(f) for f in project.get_pipe_files()]
|
|
519
|
-
resources_xml = "\n".join(
|
|
520
|
-
[
|
|
521
|
-
f"<resource><type>{resource_type}</type><name>{resource_name}</name><content>{resource_content}</content></resource>"
|
|
522
|
-
for resource_type, resource_name, resource_content in [
|
|
523
|
-
("datasource", ds.stem, ds.read_text()) for ds in datasource_paths
|
|
524
|
-
]
|
|
525
|
-
+ [
|
|
526
|
-
(
|
|
527
|
-
"pipe",
|
|
528
|
-
pipe.stem,
|
|
529
|
-
pipe.read_text(),
|
|
530
|
-
)
|
|
531
|
-
for pipe in pipes_paths
|
|
532
|
-
]
|
|
533
|
-
]
|
|
534
|
-
)
|
|
535
|
-
return resources_xml
|
|
536
|
-
|
|
537
|
-
|
|
538
460
|
def create_resources_from_data(
|
|
539
461
|
data: str,
|
|
540
462
|
project: Project,
|
|
@@ -768,13 +768,31 @@ def datasource_create(
|
|
|
768
768
|
|
|
769
769
|
if datasource_type == "prompt":
|
|
770
770
|
click.echo(FeedbackManager.gray(message="\n» Creating .datasource file..."))
|
|
771
|
-
|
|
772
|
-
if not user_token:
|
|
771
|
+
if not config.get("user_token"):
|
|
773
772
|
raise Exception("This action requires authentication. Run 'tb login' first.")
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
773
|
+
|
|
774
|
+
instructions = (
|
|
775
|
+
"Create or update a Tinybird datasource (.datasource file) for this project. "
|
|
776
|
+
"Do not generate mock data or append data; those steps will run later programmatically."
|
|
777
|
+
)
|
|
778
|
+
if name:
|
|
779
|
+
instructions += f" Name the datasource '{name}'."
|
|
780
|
+
|
|
781
|
+
created_resources = create_resources_from_prompt(
|
|
782
|
+
config,
|
|
783
|
+
project,
|
|
784
|
+
prompt,
|
|
785
|
+
feature="tb_datasource_create",
|
|
786
|
+
instructions=instructions,
|
|
787
|
+
)
|
|
788
|
+
if any(path.suffix == ".datasource" for path in created_resources):
|
|
789
|
+
click.echo(FeedbackManager.success(message="✓ .datasource created!"))
|
|
790
|
+
else:
|
|
791
|
+
click.echo(
|
|
792
|
+
FeedbackManager.gray(
|
|
793
|
+
message="△ No new datasource file detected. Existing resources may have been updated instead."
|
|
794
|
+
)
|
|
795
|
+
)
|
|
778
796
|
return
|
|
779
797
|
|
|
780
798
|
connection_required = datasource_type in ("kafka", "s3", "gcs")
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from tinybird.tb.modules.agent import run_agent
|
|
4
|
+
from tinybird.tb.modules.cli import cli
|
|
5
|
+
from tinybird.tb.modules.exceptions import CLIMockException
|
|
6
|
+
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
7
|
+
from tinybird.tb.modules.project import Project
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@cli.command()
|
|
11
|
+
@click.argument("datasource", type=str)
|
|
12
|
+
@click.option("--rows", type=int, default=10, help="Number of events to send")
|
|
13
|
+
@click.option(
|
|
14
|
+
"--prompt",
|
|
15
|
+
type=str,
|
|
16
|
+
default="",
|
|
17
|
+
help="Extra context to use for data generation",
|
|
18
|
+
)
|
|
19
|
+
@click.option(
|
|
20
|
+
"--format",
|
|
21
|
+
"format_",
|
|
22
|
+
type=click.Choice(["ndjson", "csv"], case_sensitive=False),
|
|
23
|
+
default="ndjson",
|
|
24
|
+
help="Format of the fixture to create",
|
|
25
|
+
)
|
|
26
|
+
@click.pass_context
|
|
27
|
+
def mock(ctx: click.Context, datasource: str, rows: int, prompt: str, format_: str) -> None:
|
|
28
|
+
"""Generate sample data for a data source."""
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
project: Project = ctx.ensure_object(dict)["project"]
|
|
32
|
+
ctx_config = ctx.ensure_object(dict)["config"]
|
|
33
|
+
prompt = f"""Generate mock data for the following datasource: {datasource} with {rows} rows and {format_} format. Extra context: {prompt}"""
|
|
34
|
+
env = ctx.ensure_object(dict)["env"]
|
|
35
|
+
if env == "cloud":
|
|
36
|
+
prompt += "Append the fixture data to the datasource in Tinybird Cloud."
|
|
37
|
+
|
|
38
|
+
run_agent(ctx_config, project, True, prompt=prompt, feature="tb_mock")
|
|
39
|
+
|
|
40
|
+
except Exception as e:
|
|
41
|
+
raise CLIMockException(FeedbackManager.error(message=str(e)))
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from tinybird.tb.client import TinyB
|
|
2
|
+
from tinybird.tb.modules.common import push_data
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def append_mock_data(
|
|
6
|
+
tb_client: TinyB,
|
|
7
|
+
datasource_name: str,
|
|
8
|
+
url: str,
|
|
9
|
+
):
|
|
10
|
+
push_data(
|
|
11
|
+
tb_client,
|
|
12
|
+
datasource_name,
|
|
13
|
+
url,
|
|
14
|
+
mode="append",
|
|
15
|
+
concurrency=1,
|
|
16
|
+
silent=True,
|
|
17
|
+
)
|