tinybird 0.0.1.dev175__tar.gz → 0.0.1.dev176__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.dev175 → tinybird-0.0.1.dev176}/PKG-INFO +2 -2
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/prompts.py +2 -2
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/__cli__.py +2 -2
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/create.py +162 -142
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird.egg-info/PKG-INFO +2 -2
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird.egg-info/requires.txt +1 -1
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/setup.cfg +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/config.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/datafile.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/sql_template.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/cli.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/client.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/config.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/build.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/cli.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/common.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datasource.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/deployment.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/deprecations.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/dev_server.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/info.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/login.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/mock.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/open.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/project.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/shell.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/test.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/token.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird.egg-info/SOURCES.txt +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: tinybird
|
|
3
|
-
Version: 0.0.1.
|
|
3
|
+
Version: 0.0.1.dev176
|
|
4
4
|
Summary: Tinybird Command Line Tool
|
|
5
5
|
Home-page: https://www.tinybird.co/docs/forward/commands
|
|
6
6
|
Author: Tinybird
|
|
@@ -14,7 +14,7 @@ Requires-Dist: click<8.2,>=8.1.6
|
|
|
14
14
|
Requires-Dist: clickhouse-toolset==0.34.dev0
|
|
15
15
|
Requires-Dist: colorama==0.4.6
|
|
16
16
|
Requires-Dist: cryptography~=41.0.0
|
|
17
|
-
Requires-Dist: croniter==1.3.
|
|
17
|
+
Requires-Dist: croniter==1.3.15
|
|
18
18
|
Requires-Dist: docker==7.1.0
|
|
19
19
|
Requires-Dist: GitPython~=3.1.32
|
|
20
20
|
Requires-Dist: humanfriendly~=8.2
|
|
@@ -461,8 +461,7 @@ Use the following feedback to regenerate the response:
|
|
|
461
461
|
"""
|
|
462
462
|
|
|
463
463
|
return f"""
|
|
464
|
-
Given the schema for a Tinybird datasource, return a
|
|
465
|
-
|
|
464
|
+
Given the schema for a Tinybird datasource, return a valid clickhouse sql query to generate some random data that matches that schema.
|
|
466
465
|
Response format MUST be just a valid clickhouse sql query.
|
|
467
466
|
|
|
468
467
|
<example>
|
|
@@ -722,6 +721,7 @@ datasource_instructions = """
|
|
|
722
721
|
- Use MergeTree engine by default.
|
|
723
722
|
- Use AggregatingMergeTree engine when the datasource is the target of a materialized pipe.
|
|
724
723
|
- Use always json paths to define the schema. Example: `user_id` String `json:$.user_id`,
|
|
724
|
+
- Array columns are supported with a special syntax. Example: `items` Array(String) `json:$.items[:]`
|
|
725
725
|
- If the datasource is using an S3 or GCS connection, they need to set IMPORT_CONNECTION_NAME, IMPORT_BUCKET_URI and IMPORT_SCHEDULE (GCS @on-demand only, S3 supports @auto too)
|
|
726
726
|
</datasource_file_instructions>
|
|
727
727
|
"""
|
|
@@ -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.dev176'
|
|
8
|
+
__revision__ = '09be7b9'
|
|
@@ -2,7 +2,7 @@ import glob
|
|
|
2
2
|
import os
|
|
3
3
|
import re
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
from typing import Any, Dict,
|
|
5
|
+
from typing import Any, Dict, List, Optional
|
|
6
6
|
|
|
7
7
|
import click
|
|
8
8
|
|
|
@@ -69,7 +69,7 @@ async def create(
|
|
|
69
69
|
|
|
70
70
|
try:
|
|
71
71
|
tb_client = config.get_client(token=ctx_config.get("token"), host=ctx_config.get("host"))
|
|
72
|
-
user_token:
|
|
72
|
+
user_token: str = ""
|
|
73
73
|
created_something = False
|
|
74
74
|
if prompt:
|
|
75
75
|
user_token = ctx_config.get("user_token")
|
|
@@ -81,32 +81,40 @@ async def create(
|
|
|
81
81
|
create_project_structure(folder)
|
|
82
82
|
click.echo(FeedbackManager.success(message="✓ Scaffolding completed!\n"))
|
|
83
83
|
created_something = True
|
|
84
|
-
result =
|
|
85
|
-
|
|
86
|
-
if data or (prompt and user_token):
|
|
84
|
+
result: List[Path] = []
|
|
85
|
+
if data or prompt:
|
|
87
86
|
click.echo(FeedbackManager.highlight(message="\n» Creating resources..."))
|
|
88
|
-
|
|
87
|
+
|
|
88
|
+
data_result: List[Path] = []
|
|
89
|
+
if data:
|
|
90
|
+
data_result = await create_resources_from_data(data, project, ctx_config)
|
|
91
|
+
result.extend(data_result)
|
|
92
|
+
|
|
93
|
+
prompt_result: List[Path] = []
|
|
94
|
+
if prompt:
|
|
95
|
+
prompt_result = await create_resources_from_prompt(tb_client, user_token, prompt, project)
|
|
96
|
+
result.extend(prompt_result)
|
|
97
|
+
readme_path = Path(root_folder) / "README.md"
|
|
98
|
+
if readme_path.exists():
|
|
99
|
+
click.echo(FeedbackManager.highlight(message="\n» Updating README.md..."))
|
|
100
|
+
else:
|
|
101
|
+
click.echo(FeedbackManager.highlight(message="\n» Creating README.md..."))
|
|
102
|
+
readme_path.touch()
|
|
103
|
+
llm = LLM(user_token=str(user_token), host=tb_client.host)
|
|
104
|
+
readme_user_prompt = prompt or ""
|
|
105
|
+
all_resources_xml = get_resources_xml(project)
|
|
106
|
+
readme_response = llm.ask(
|
|
107
|
+
system_prompt=readme_prompt(
|
|
108
|
+
readme_path.read_text(), tb_client.host, "$TB_ADMIN_TOKEN", all_resources_xml
|
|
109
|
+
),
|
|
110
|
+
prompt=readme_user_prompt,
|
|
111
|
+
)
|
|
112
|
+
readme_result = extract_xml(readme_response, "readme")
|
|
113
|
+
readme_path.write_text(readme_result)
|
|
114
|
+
created_something = True
|
|
115
|
+
|
|
116
|
+
if data or prompt:
|
|
89
117
|
click.echo(FeedbackManager.success(message="✓ Done!\n"))
|
|
90
|
-
if prompt:
|
|
91
|
-
readme_path = Path(root_folder) / "README.md"
|
|
92
|
-
if readme_path.exists():
|
|
93
|
-
click.echo(FeedbackManager.highlight(message="\n» Updating README.md..."))
|
|
94
|
-
else:
|
|
95
|
-
click.echo(FeedbackManager.highlight(message="\n» Creating README.md..."))
|
|
96
|
-
readme_path.touch()
|
|
97
|
-
llm = LLM(user_token=str(user_token), host=tb_client.host)
|
|
98
|
-
readme_user_prompt = prompt or ""
|
|
99
|
-
all_resources_xml = get_resources_xml(project)
|
|
100
|
-
readme_response = llm.ask(
|
|
101
|
-
system_prompt=readme_prompt(
|
|
102
|
-
readme_path.read_text(), tb_client.host, "$TB_ADMIN_TOKEN", all_resources_xml
|
|
103
|
-
),
|
|
104
|
-
prompt=readme_user_prompt,
|
|
105
|
-
)
|
|
106
|
-
readme_result = extract_xml(readme_response, "readme")
|
|
107
|
-
readme_path.write_text(readme_result)
|
|
108
|
-
click.echo(FeedbackManager.success(message="✓ Done!\n"))
|
|
109
|
-
created_something = True
|
|
110
118
|
|
|
111
119
|
if not already_has_cicd(root_folder):
|
|
112
120
|
click.echo(FeedbackManager.highlight(message="\n» Creating CI/CD files for GitHub and GitLab..."))
|
|
@@ -125,17 +133,18 @@ async def create(
|
|
|
125
133
|
click.echo(FeedbackManager.highlight(message="\n» Generating fixtures..."))
|
|
126
134
|
|
|
127
135
|
if data:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
for ds_path in [ds for ds in data_result if ds.suffix == ".datasource"]:
|
|
137
|
+
data_path = Path(data)
|
|
138
|
+
data_content = data_path.read_text()
|
|
139
|
+
ds_name = ds_path.stem
|
|
140
|
+
data_format = data_path.suffix.lstrip(".")
|
|
141
|
+
datasource_path = Path(folder) / "datasources" / f"{ds_name}.datasource"
|
|
142
|
+
click.echo(FeedbackManager.info(message=f"✓ /fixtures/{ds_name}"))
|
|
143
|
+
persist_fixture(ds_name, data_content, folder, format=data_format)
|
|
144
|
+
created_something = True
|
|
145
|
+
elif prompt and prompt_result:
|
|
146
|
+
ds_results = [path for path in prompt_result if path.suffix == ".datasource"]
|
|
147
|
+
for datasource_path in ds_results:
|
|
139
148
|
datasource_name = datasource_path.stem
|
|
140
149
|
datasource_content = datasource_path.read_text()
|
|
141
150
|
has_json_path = "`json:" in datasource_content
|
|
@@ -157,7 +166,7 @@ async def create(
|
|
|
157
166
|
click.echo(FeedbackManager.info(message=f"✓ /fixtures/{datasource_name}"))
|
|
158
167
|
created_something = True
|
|
159
168
|
|
|
160
|
-
if not created_something:
|
|
169
|
+
if not created_something and not len(result) > 0:
|
|
161
170
|
click.echo(FeedbackManager.warning(message="△ No resources created\n"))
|
|
162
171
|
except Exception as e:
|
|
163
172
|
raise CLICreateException(FeedbackManager.error(message=str(e)))
|
|
@@ -178,10 +187,19 @@ def validate_project_structure(folder: str) -> bool:
|
|
|
178
187
|
return len(datasources) > 0 or len(pipes) > 0
|
|
179
188
|
|
|
180
189
|
|
|
181
|
-
def should_generate_fixtures(result:
|
|
190
|
+
def should_generate_fixtures(result: List[Path]) -> List[Path]:
|
|
182
191
|
if not result:
|
|
183
|
-
return
|
|
184
|
-
return
|
|
192
|
+
return []
|
|
193
|
+
return [
|
|
194
|
+
path
|
|
195
|
+
for path in result
|
|
196
|
+
if path.suffix == ".datasource"
|
|
197
|
+
# we only want to generate fixtures for MergeTree or Null engines
|
|
198
|
+
and (
|
|
199
|
+
re.search(r'ENGINE\s+(?:"MergeTree"|MergeTree|"Null"|Null)', path.read_text())
|
|
200
|
+
or not re.search(r"ENGINE\s+", path.read_text())
|
|
201
|
+
)
|
|
202
|
+
]
|
|
185
203
|
|
|
186
204
|
|
|
187
205
|
def already_has_cicd(folder: str) -> bool:
|
|
@@ -205,113 +223,86 @@ def create_project_structure(folder: str):
|
|
|
205
223
|
click.echo(FeedbackManager.info_path_created(path=x))
|
|
206
224
|
|
|
207
225
|
|
|
208
|
-
async def
|
|
226
|
+
async def create_resources_from_prompt(
|
|
209
227
|
tb_client: TinyB,
|
|
210
|
-
user_token:
|
|
211
|
-
|
|
212
|
-
prompt: Optional[str],
|
|
228
|
+
user_token: str,
|
|
229
|
+
prompt: str,
|
|
213
230
|
project: Project,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
""",
|
|
233
|
-
project.folder,
|
|
234
|
-
)
|
|
235
|
-
result = (
|
|
236
|
-
f"<response><resource><type>datasource</type><name>{name}</name><content></content></resource></response>"
|
|
237
|
-
)
|
|
238
|
-
created_any_resource = True
|
|
239
|
-
|
|
240
|
-
elif prompt and user_token:
|
|
241
|
-
datasource_paths = [Path(ds_file) for ds_file in project.get_datasource_files()]
|
|
242
|
-
pipes_paths = [Path(pipe_file) for pipe_file in project.get_pipe_files()]
|
|
243
|
-
connections_paths = [Path(conn_file) for conn_file in project.get_connection_files()]
|
|
244
|
-
resources_xml = "\n".join(
|
|
245
|
-
[
|
|
246
|
-
f"<resource><type>{resource_type}</type><name>{resource_name}</name><content>{resource_content}</content></resource>"
|
|
247
|
-
for resource_type, resource_name, resource_content in [
|
|
248
|
-
("datasource", ds.stem, ds.read_text()) for ds in datasource_paths
|
|
249
|
-
]
|
|
250
|
-
+ [
|
|
251
|
-
(
|
|
252
|
-
"pipe",
|
|
253
|
-
pipe.stem,
|
|
254
|
-
pipe.read_text(),
|
|
255
|
-
)
|
|
256
|
-
for pipe in pipes_paths
|
|
257
|
-
]
|
|
258
|
-
+ [
|
|
259
|
-
(
|
|
260
|
-
"connection",
|
|
261
|
-
conn.stem,
|
|
262
|
-
conn.read_text(),
|
|
263
|
-
)
|
|
264
|
-
for conn in connections_paths
|
|
265
|
-
]
|
|
231
|
+
) -> List[Path]:
|
|
232
|
+
result: List[Path] = []
|
|
233
|
+
datasource_paths = [Path(ds_file) for ds_file in project.get_datasource_files()]
|
|
234
|
+
pipes_paths = [Path(pipe_file) for pipe_file in project.get_pipe_files()]
|
|
235
|
+
connections_paths = [Path(conn_file) for conn_file in project.get_connection_files()]
|
|
236
|
+
resources_xml = "\n".join(
|
|
237
|
+
[
|
|
238
|
+
f"<resource><type>{resource_type}</type><name>{resource_name}</name><content>{resource_content}</content></resource>"
|
|
239
|
+
for resource_type, resource_name, resource_content in [
|
|
240
|
+
("datasource", ds.stem, ds.read_text()) for ds in datasource_paths
|
|
241
|
+
]
|
|
242
|
+
+ [
|
|
243
|
+
(
|
|
244
|
+
"pipe",
|
|
245
|
+
pipe.stem,
|
|
246
|
+
pipe.read_text(),
|
|
247
|
+
)
|
|
248
|
+
for pipe in pipes_paths
|
|
266
249
|
]
|
|
250
|
+
+ [
|
|
251
|
+
(
|
|
252
|
+
"connection",
|
|
253
|
+
conn.stem,
|
|
254
|
+
conn.read_text(),
|
|
255
|
+
)
|
|
256
|
+
for conn in connections_paths
|
|
257
|
+
]
|
|
258
|
+
]
|
|
259
|
+
)
|
|
260
|
+
llm = LLM(user_token=user_token, host=tb_client.host)
|
|
261
|
+
prompt_result = llm.ask(system_prompt=create_prompt(resources_xml), prompt=prompt)
|
|
262
|
+
prompt_result = extract_xml(prompt_result, "response")
|
|
263
|
+
resources = parse_xml(prompt_result, "resource")
|
|
264
|
+
datasources = []
|
|
265
|
+
pipes = []
|
|
266
|
+
connections = []
|
|
267
|
+
for resource_xml in resources:
|
|
268
|
+
resource_type = extract_xml(resource_xml, "type")
|
|
269
|
+
name = extract_xml(resource_xml, "name")
|
|
270
|
+
content = extract_xml(resource_xml, "content")
|
|
271
|
+
resource = {
|
|
272
|
+
"name": name,
|
|
273
|
+
"content": content,
|
|
274
|
+
}
|
|
275
|
+
if resource_type.lower() == "datasource":
|
|
276
|
+
datasources.append(resource)
|
|
277
|
+
elif resource_type.lower() == "pipe":
|
|
278
|
+
pipes.append(resource)
|
|
279
|
+
elif resource_type.lower() == "connection":
|
|
280
|
+
connections.append(resource)
|
|
281
|
+
|
|
282
|
+
for ds in datasources:
|
|
283
|
+
content = ds["content"].replace("```", "")
|
|
284
|
+
filename = f"{ds['name']}.datasource"
|
|
285
|
+
ds_file = generate_datafile(
|
|
286
|
+
content,
|
|
287
|
+
filename=filename,
|
|
288
|
+
data=None,
|
|
289
|
+
_format="ndjson",
|
|
290
|
+
force=True,
|
|
291
|
+
folder=project.folder,
|
|
267
292
|
)
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
pipes = []
|
|
274
|
-
connections = []
|
|
275
|
-
for resource_xml in resources:
|
|
276
|
-
resource_type = extract_xml(resource_xml, "type")
|
|
277
|
-
name = extract_xml(resource_xml, "name")
|
|
278
|
-
content = extract_xml(resource_xml, "content")
|
|
279
|
-
resource = {
|
|
280
|
-
"name": name,
|
|
281
|
-
"content": content,
|
|
282
|
-
}
|
|
283
|
-
if resource_type.lower() == "datasource":
|
|
284
|
-
datasources.append(resource)
|
|
285
|
-
elif resource_type.lower() == "pipe":
|
|
286
|
-
pipes.append(resource)
|
|
287
|
-
elif resource_type.lower() == "connection":
|
|
288
|
-
connections.append(resource)
|
|
289
|
-
|
|
290
|
-
for ds in datasources:
|
|
291
|
-
content = ds["content"].replace("```", "")
|
|
292
|
-
filename = f"{ds['name']}.datasource"
|
|
293
|
-
generate_datafile(
|
|
294
|
-
content,
|
|
295
|
-
filename=filename,
|
|
296
|
-
data=None,
|
|
297
|
-
_format="ndjson",
|
|
298
|
-
force=True,
|
|
299
|
-
folder=project.folder,
|
|
300
|
-
)
|
|
301
|
-
created_any_resource = True
|
|
293
|
+
result.append(ds_file)
|
|
294
|
+
for pipe in pipes:
|
|
295
|
+
content = pipe["content"].replace("```", "")
|
|
296
|
+
pipe_file = generate_pipe_file(pipe["name"], content, project.folder)
|
|
297
|
+
result.append(pipe_file)
|
|
302
298
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
299
|
+
for conn in connections:
|
|
300
|
+
content = conn["content"].replace("```", "")
|
|
301
|
+
filename = f"{conn['name']}.connection"
|
|
302
|
+
conn_file = generate_connection_file(conn["name"], content, project.folder)
|
|
303
|
+
result.append(conn_file)
|
|
307
304
|
|
|
308
|
-
|
|
309
|
-
content = conn["content"].replace("```", "")
|
|
310
|
-
filename = f"{conn['name']}.connection"
|
|
311
|
-
generate_connection_file(conn["name"], content, project.folder)
|
|
312
|
-
created_any_resource = True
|
|
313
|
-
|
|
314
|
-
return result, created_any_resource
|
|
305
|
+
return result
|
|
315
306
|
|
|
316
307
|
|
|
317
308
|
def init_git(folder: str):
|
|
@@ -454,3 +445,32 @@ def get_resources_xml(project: Project) -> str:
|
|
|
454
445
|
]
|
|
455
446
|
)
|
|
456
447
|
return resources_xml
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
async def create_resources_from_data(
|
|
451
|
+
data: str,
|
|
452
|
+
project: Project,
|
|
453
|
+
config: Dict[str, Any],
|
|
454
|
+
) -> List[Path]:
|
|
455
|
+
folder_path = project.path
|
|
456
|
+
local_client = await get_tinybird_local_client(config)
|
|
457
|
+
path = folder_path / data
|
|
458
|
+
result: List[Path] = []
|
|
459
|
+
format = path.suffix.lstrip(".")
|
|
460
|
+
ds_file = await _generate_datafile(str(path), local_client, format=format, force=True)
|
|
461
|
+
result.append(ds_file)
|
|
462
|
+
name = ds_file.stem
|
|
463
|
+
no_pipes = len(project.get_pipe_files()) == 0
|
|
464
|
+
if no_pipes:
|
|
465
|
+
pipe_file = generate_pipe_file(
|
|
466
|
+
f"{name}_endpoint",
|
|
467
|
+
f"""
|
|
468
|
+
NODE endpoint
|
|
469
|
+
SQL >
|
|
470
|
+
SELECT * from {name}
|
|
471
|
+
TYPE ENDPOINT
|
|
472
|
+
""",
|
|
473
|
+
project.folder,
|
|
474
|
+
)
|
|
475
|
+
result.append(pipe_file)
|
|
476
|
+
return result
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: tinybird
|
|
3
|
-
Version: 0.0.1.
|
|
3
|
+
Version: 0.0.1.dev176
|
|
4
4
|
Summary: Tinybird Command Line Tool
|
|
5
5
|
Home-page: https://www.tinybird.co/docs/forward/commands
|
|
6
6
|
Author: Tinybird
|
|
@@ -14,7 +14,7 @@ Requires-Dist: click<8.2,>=8.1.6
|
|
|
14
14
|
Requires-Dist: clickhouse-toolset==0.34.dev0
|
|
15
15
|
Requires-Dist: colorama==0.4.6
|
|
16
16
|
Requires-Dist: cryptography~=41.0.0
|
|
17
|
-
Requires-Dist: croniter==1.3.
|
|
17
|
+
Requires-Dist: croniter==1.3.15
|
|
18
18
|
Requires-Dist: docker==7.1.0
|
|
19
19
|
Requires-Dist: GitPython~=3.1.32
|
|
20
20
|
Requires-Dist: humanfriendly~=8.2
|
|
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.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/build_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/build_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/format_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/format_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb/modules/datafile/parse_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/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
|
{tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/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.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/tinyunit/tinyunit.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev175 → tinybird-0.0.1.dev176}/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
|