tinybird 0.0.1.dev147__tar.gz → 0.0.1.dev148__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.dev147 → tinybird-0.0.1.dev148}/PKG-INFO +1 -1
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/__cli__.py +2 -2
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/cli.py +2 -2
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/create.py +8 -9
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/deployment.py +111 -3
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/deprecations.py +32 -32
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/feedback_manager.py +10 -10
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird.egg-info/PKG-INFO +1 -1
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/setup.cfg +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/config.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/datafile.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/prompts.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/sql_template.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/cli.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/client.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/config.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/auth.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/build.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/common.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datasource.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/login.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/mock.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/open.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/project.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/shell.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/test.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/token.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird.egg-info/SOURCES.txt +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
|
|
|
4
4
|
__url__ = 'https://www.tinybird.co/docs/cli/introduction.html'
|
|
5
5
|
__author__ = 'Tinybird'
|
|
6
6
|
__author_email__ = 'support@tinybird.co'
|
|
7
|
-
__version__ = '0.0.1.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev148'
|
|
8
|
+
__revision__ = '7b2789f'
|
|
@@ -317,13 +317,13 @@ def __unpatch_click_output():
|
|
|
317
317
|
|
|
318
318
|
|
|
319
319
|
async def create_ctx_client(ctx: Context, config: Dict[str, Any], cloud: bool, staging: bool):
|
|
320
|
-
commands_without_ctx_client = ["auth", "check", "local", "login", "logout", "update", "upgrade"]
|
|
320
|
+
commands_without_ctx_client = ["auth", "check", "local", "login", "logout", "update", "upgrade", "create"]
|
|
321
321
|
command = ctx.invoked_subcommand
|
|
322
322
|
if command in commands_without_ctx_client:
|
|
323
323
|
return None
|
|
324
324
|
|
|
325
325
|
commands_always_cloud = ["pull", "infra"]
|
|
326
|
-
commands_always_local = ["build", "test", "dev"
|
|
326
|
+
commands_always_local = ["build", "test", "dev"]
|
|
327
327
|
if (cloud or command in commands_always_cloud) and command not in commands_always_local:
|
|
328
328
|
click.echo(
|
|
329
329
|
FeedbackManager.gray(message=f"Running against Tinybird Cloud: Workspace {config.get('name', 'default')}")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import re
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from typing import Optional, Tuple
|
|
4
|
+
from typing import Any, Dict, Optional, Tuple
|
|
5
5
|
|
|
6
6
|
import click
|
|
7
7
|
|
|
@@ -16,6 +16,7 @@ from tinybird.tb.modules.exceptions import CLICreateException
|
|
|
16
16
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
17
17
|
from tinybird.tb.modules.llm import LLM
|
|
18
18
|
from tinybird.tb.modules.llm_utils import extract_xml, parse_xml
|
|
19
|
+
from tinybird.tb.modules.local_common import get_tinybird_local_client
|
|
19
20
|
from tinybird.tb.modules.project import Project
|
|
20
21
|
|
|
21
22
|
|
|
@@ -24,13 +25,13 @@ from tinybird.tb.modules.project import Project
|
|
|
24
25
|
"--data",
|
|
25
26
|
type=click.Path(exists=True),
|
|
26
27
|
default=None,
|
|
27
|
-
help="Initial data to be used to create the project",
|
|
28
|
+
help="Initial data to be used to create the project. Tinybird Local and authentication are required.",
|
|
28
29
|
)
|
|
29
30
|
@click.option(
|
|
30
31
|
"--prompt",
|
|
31
32
|
type=str,
|
|
32
33
|
default=None,
|
|
33
|
-
help="Prompt to be used to create the project",
|
|
34
|
+
help="Prompt to be used to create the project. Tinybird Local and authentication are required.",
|
|
34
35
|
)
|
|
35
36
|
@click.option("--rows", type=int, default=10, help="Number of events to send")
|
|
36
37
|
@click.option("--folder", type=str, default=None, help="Folder to create the project in")
|
|
@@ -41,7 +42,6 @@ async def create(
|
|
|
41
42
|
ctx: click.Context, data: Optional[str], prompt: Optional[str], rows: int, folder: Optional[str], agent: str
|
|
42
43
|
) -> None:
|
|
43
44
|
"""Initialize a new project."""
|
|
44
|
-
local_client: TinyB = ctx.ensure_object(dict)["client"]
|
|
45
45
|
project: Project = ctx.ensure_object(dict)["project"]
|
|
46
46
|
config = CLIConfig.get_project_config()
|
|
47
47
|
ctx_config = ctx.ensure_object(dict)["config"]
|
|
@@ -83,9 +83,7 @@ async def create(
|
|
|
83
83
|
|
|
84
84
|
if data or (prompt and user_token):
|
|
85
85
|
click.echo(FeedbackManager.highlight(message="\n» Creating resources..."))
|
|
86
|
-
result, created_something = await create_resources(
|
|
87
|
-
local_client, tb_client, user_token, data, prompt, folder
|
|
88
|
-
)
|
|
86
|
+
result, created_something = await create_resources(tb_client, user_token, data, prompt, folder, ctx_config)
|
|
89
87
|
click.echo(FeedbackManager.success(message="✓ Done!\n"))
|
|
90
88
|
if prompt:
|
|
91
89
|
readme_path = Path(root_folder) / "README.md"
|
|
@@ -146,7 +144,7 @@ async def create(
|
|
|
146
144
|
response = llm.ask(system_prompt=mock_prompt(rows), prompt=prompt)
|
|
147
145
|
sql = extract_xml(response, "sql")
|
|
148
146
|
sql = sql.split("FORMAT")[0]
|
|
149
|
-
query_result = await
|
|
147
|
+
query_result = await tb_client.query(f"{sql} FORMAT JSON")
|
|
150
148
|
data = query_result.get("data", [])
|
|
151
149
|
if data:
|
|
152
150
|
persist_fixture(datasource_name, data, folder, format="ndjson")
|
|
@@ -202,17 +200,18 @@ def create_project_structure(folder: str):
|
|
|
202
200
|
|
|
203
201
|
|
|
204
202
|
async def create_resources(
|
|
205
|
-
local_client: TinyB,
|
|
206
203
|
tb_client: TinyB,
|
|
207
204
|
user_token: Optional[str],
|
|
208
205
|
data: Optional[str],
|
|
209
206
|
prompt: Optional[str],
|
|
210
207
|
folder: str,
|
|
208
|
+
config: Dict[str, Any],
|
|
211
209
|
) -> Tuple[str, bool]:
|
|
212
210
|
result = ""
|
|
213
211
|
created_any_resource = False
|
|
214
212
|
folder_path = Path(folder)
|
|
215
213
|
if data:
|
|
214
|
+
local_client = await get_tinybird_local_client(config)
|
|
216
215
|
path = folder_path / data
|
|
217
216
|
format = path.suffix.lstrip(".")
|
|
218
217
|
await _generate_datafile(str(path), local_client, format=format, force=True)
|
|
@@ -19,6 +19,82 @@ from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
|
19
19
|
from tinybird.tb.modules.project import Project
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
def download_github_contents(api_url: str, target_dir: Path) -> None:
|
|
23
|
+
"""
|
|
24
|
+
Recursively downloads contents from GitHub API URL to target directory.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
api_url: str - GitHub API URL to fetch contents from
|
|
28
|
+
target_dir: Path - Directory to save downloaded files to
|
|
29
|
+
"""
|
|
30
|
+
response = requests.get(api_url)
|
|
31
|
+
if response.status_code != 200:
|
|
32
|
+
click.echo(
|
|
33
|
+
FeedbackManager.error(message=f"Failed to fetch contents from GitHub: {response.json().get('message', '')}")
|
|
34
|
+
)
|
|
35
|
+
return
|
|
36
|
+
|
|
37
|
+
contents = response.json()
|
|
38
|
+
if not isinstance(contents, list):
|
|
39
|
+
click.echo(FeedbackManager.error(message="Invalid response from GitHub API"))
|
|
40
|
+
return
|
|
41
|
+
|
|
42
|
+
for item in contents:
|
|
43
|
+
item_path = target_dir / item["name"]
|
|
44
|
+
|
|
45
|
+
if item["type"] == "dir":
|
|
46
|
+
# Create directory and recursively download its contents
|
|
47
|
+
item_path.mkdir(parents=True, exist_ok=True)
|
|
48
|
+
download_github_contents(item["url"], item_path)
|
|
49
|
+
elif item["type"] == "file":
|
|
50
|
+
# Download file
|
|
51
|
+
file_response = requests.get(item["download_url"])
|
|
52
|
+
if file_response.status_code == 200:
|
|
53
|
+
item_path.write_bytes(file_response.content)
|
|
54
|
+
click.echo(FeedbackManager.info(message=f"Downloaded {item['path']}"))
|
|
55
|
+
else:
|
|
56
|
+
click.echo(FeedbackManager.warning(message=f"Failed to download {item['path']}"))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def download_github_template(url: str) -> Optional[Path]:
|
|
60
|
+
"""
|
|
61
|
+
Downloads a template from a GitHub URL and returns the path to the downloaded files.
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
url: str - GitHub URL in the format https://github.com/owner/repo/tree/branch/path
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
Optional[Path] - Path to the downloaded template or None if download fails
|
|
68
|
+
"""
|
|
69
|
+
# Parse GitHub URL components
|
|
70
|
+
# From: https://github.com/owner/repo/tree/branch/path
|
|
71
|
+
# To: api.github.com/repos/owner/repo/contents/path?ref=branch
|
|
72
|
+
parts = url.replace("https://github.com/", "").split("/")
|
|
73
|
+
if len(parts) < 5 or "tree" not in parts:
|
|
74
|
+
click.echo(
|
|
75
|
+
FeedbackManager.error(
|
|
76
|
+
message="Invalid GitHub URL format. Expected: https://github.com/owner/repo/tree/branch/path"
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
owner = parts[0]
|
|
82
|
+
repo = parts[1]
|
|
83
|
+
branch = parts[parts.index("tree") + 1]
|
|
84
|
+
path = "/".join(parts[parts.index("tree") + 2 :])
|
|
85
|
+
|
|
86
|
+
api_url = f"https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}"
|
|
87
|
+
|
|
88
|
+
# Create temporary directory for template
|
|
89
|
+
|
|
90
|
+
dir = Path(".")
|
|
91
|
+
|
|
92
|
+
# Recursively download all files
|
|
93
|
+
download_github_contents(api_url, dir)
|
|
94
|
+
|
|
95
|
+
return dir
|
|
96
|
+
|
|
97
|
+
|
|
22
98
|
# TODO(eclbg): This should eventually end up in client.py, but we're not using it here yet.
|
|
23
99
|
def api_fetch(url: str, headers: dict) -> dict:
|
|
24
100
|
r = requests.get(url, headers=headers)
|
|
@@ -215,14 +291,19 @@ def deployment_group() -> None:
|
|
|
215
291
|
default=False,
|
|
216
292
|
help="Allow removing datasources. Disabled by default.",
|
|
217
293
|
)
|
|
294
|
+
@click.option(
|
|
295
|
+
"--template",
|
|
296
|
+
default=None,
|
|
297
|
+
help="URL of the template to use for the deployment. Example: https://github.com/tinybirdco/web-analytics-starter-kit/tree/main/tinybird",
|
|
298
|
+
)
|
|
218
299
|
@click.pass_context
|
|
219
300
|
def deployment_create(
|
|
220
|
-
ctx: click.Context, wait: bool, auto: bool, check: bool, allow_destructive_operations: bool
|
|
301
|
+
ctx: click.Context, wait: bool, auto: bool, check: bool, allow_destructive_operations: bool, template: Optional[str]
|
|
221
302
|
) -> None:
|
|
222
303
|
"""
|
|
223
304
|
Validate and deploy the project server side.
|
|
224
305
|
"""
|
|
225
|
-
|
|
306
|
+
create_deployment_cmd(ctx, wait, auto, check, allow_destructive_operations, template)
|
|
226
307
|
|
|
227
308
|
|
|
228
309
|
@deployment_group.command(name="ls")
|
|
@@ -330,11 +411,38 @@ def deployment_discard(ctx: click.Context, wait: bool) -> None:
|
|
|
330
411
|
default=False,
|
|
331
412
|
help="Allow removing datasources. Disabled by default.",
|
|
332
413
|
)
|
|
414
|
+
@click.option(
|
|
415
|
+
"--template",
|
|
416
|
+
default=None,
|
|
417
|
+
help="URL of the template to use for the deployment. Example: https://github.com/tinybirdco/web-analytics-starter-kit/tree/main/tinybird",
|
|
418
|
+
)
|
|
333
419
|
@click.pass_context
|
|
334
|
-
def deploy(
|
|
420
|
+
def deploy(
|
|
421
|
+
ctx: click.Context, wait: bool, auto: bool, check: bool, allow_destructive_operations: bool, template: Optional[str]
|
|
422
|
+
) -> None:
|
|
335
423
|
"""
|
|
336
424
|
Deploy the project.
|
|
337
425
|
"""
|
|
426
|
+
create_deployment_cmd(ctx, wait, auto, check, allow_destructive_operations, template)
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
def create_deployment_cmd(
|
|
430
|
+
ctx: click.Context,
|
|
431
|
+
wait: bool,
|
|
432
|
+
auto: bool,
|
|
433
|
+
check: Optional[bool] = None,
|
|
434
|
+
allow_destructive_operations: Optional[bool] = None,
|
|
435
|
+
template: Optional[str] = None,
|
|
436
|
+
) -> None:
|
|
437
|
+
if template:
|
|
438
|
+
click.echo(FeedbackManager.info(message="» Downloading template..."))
|
|
439
|
+
try:
|
|
440
|
+
download_github_template(template)
|
|
441
|
+
except Exception as e:
|
|
442
|
+
click.echo(FeedbackManager.error(message=f"Error downloading template: {str(e)}"))
|
|
443
|
+
sys_exit("deployment_error", f"Failed to download template {template}")
|
|
444
|
+
click.echo(FeedbackManager.success(message="Template downloaded successfully"))
|
|
445
|
+
|
|
338
446
|
create_deployment(ctx, wait, auto, check, allow_destructive_operations)
|
|
339
447
|
|
|
340
448
|
|
|
@@ -15,10 +15,14 @@ def branch(args) -> None:
|
|
|
15
15
|
"""
|
|
16
16
|
`tb branch` is deprecated. You should rely on your version control system to manage branches.
|
|
17
17
|
"""
|
|
18
|
-
click.echo(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
click.echo(
|
|
19
|
+
FeedbackManager.warning(
|
|
20
|
+
message="This command is deprecated. You should rely on your version control system to manage branches."
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
click.echo(
|
|
24
|
+
"You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward"
|
|
25
|
+
)
|
|
22
26
|
|
|
23
27
|
|
|
24
28
|
@cli.command(
|
|
@@ -32,10 +36,10 @@ def check(args) -> None:
|
|
|
32
36
|
"""
|
|
33
37
|
`tb check` is deprecated.
|
|
34
38
|
"""
|
|
35
|
-
click.echo(FeedbackManager.warning(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
click.echo(FeedbackManager.warning(message="This command is deprecated."))
|
|
40
|
+
click.echo(
|
|
41
|
+
"You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward"
|
|
42
|
+
)
|
|
39
43
|
|
|
40
44
|
|
|
41
45
|
@cli.command(
|
|
@@ -49,10 +53,10 @@ def diff(args) -> None:
|
|
|
49
53
|
"""
|
|
50
54
|
`tb diff` is deprecated.
|
|
51
55
|
"""
|
|
52
|
-
click.echo(FeedbackManager.warning(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
click.echo(FeedbackManager.warning(message="This command is deprecated."))
|
|
57
|
+
click.echo(
|
|
58
|
+
"You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward"
|
|
59
|
+
)
|
|
56
60
|
|
|
57
61
|
|
|
58
62
|
@cli.command(
|
|
@@ -66,10 +70,10 @@ def fmt(args) -> None:
|
|
|
66
70
|
"""
|
|
67
71
|
`tb fmt` is deprecated.
|
|
68
72
|
"""
|
|
69
|
-
click.echo(FeedbackManager.warning(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
click.echo(FeedbackManager.warning(message="This command is deprecated."))
|
|
74
|
+
click.echo(
|
|
75
|
+
"You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward"
|
|
76
|
+
)
|
|
73
77
|
|
|
74
78
|
|
|
75
79
|
@cli.command(
|
|
@@ -83,11 +87,10 @@ def init(args) -> None:
|
|
|
83
87
|
"""
|
|
84
88
|
`tb init` is deprecated. Use `tb create` instead.
|
|
85
89
|
"""
|
|
86
|
-
click.echo(FeedbackManager.warning(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
click.echo(FeedbackManager.warning(message="This command is deprecated. Use `tb create` instead."))
|
|
91
|
+
click.echo(
|
|
92
|
+
"You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward"
|
|
93
|
+
)
|
|
91
94
|
|
|
92
95
|
|
|
93
96
|
@cli.command(
|
|
@@ -101,11 +104,10 @@ def push(args) -> None:
|
|
|
101
104
|
"""
|
|
102
105
|
`tb push` is deprecated. Use `tb deploy` instead.
|
|
103
106
|
"""
|
|
104
|
-
click.echo(FeedbackManager.warning(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
click.echo(FeedbackManager.warning(message="This command is deprecated. Use `tb deploy` instead."))
|
|
108
|
+
click.echo(
|
|
109
|
+
"You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward"
|
|
110
|
+
)
|
|
109
111
|
|
|
110
112
|
|
|
111
113
|
@cli.command(
|
|
@@ -119,9 +121,7 @@ def tag(args) -> None:
|
|
|
119
121
|
"""
|
|
120
122
|
`tb tag` is deprecated
|
|
121
123
|
"""
|
|
122
|
-
click.echo(FeedbackManager.warning(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
click.echo(FeedbackManager.warning(message="This command is deprecated."))
|
|
125
|
+
click.echo(
|
|
126
|
+
"You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward"
|
|
127
|
+
)
|
|
@@ -508,7 +508,7 @@ Ready? """
|
|
|
508
508
|
STEP 1: AWS AUTHENTICATION
|
|
509
509
|
──────────────────────────────────────────────────────────────
|
|
510
510
|
|
|
511
|
-
Please log into your
|
|
511
|
+
Please log into your AWS Console. We'll guide you through creating the necessary permissions: https://console.aws.amazon.com/
|
|
512
512
|
|
|
513
513
|
You'll be creating a single IAM Policy and Roles (you will need one per environment, Local and Cloud) to access your S3 data. Using IAM Roles improves security by providing temporary credentials and following least privilege principles.""")
|
|
514
514
|
|
|
@@ -518,7 +518,7 @@ You'll be creating a single IAM Policy and Roles (you will need one per environm
|
|
|
518
518
|
STEP 2: CREATE IAM POLICY
|
|
519
519
|
──────────────────────────────────────────────────────────────
|
|
520
520
|
|
|
521
|
-
1. Go to
|
|
521
|
+
1. Go to AWS IAM > Create Policy: https://console.aws.amazon.com/iamv2/home?region={aws_region}#/policies/create
|
|
522
522
|
2. Select the JSON tab
|
|
523
523
|
3. Paste the following policy (already copied to clipboard):
|
|
524
524
|
|
|
@@ -536,7 +536,7 @@ STEP 2: CREATE IAM POLICY
|
|
|
536
536
|
STEP 2: CREATE IAM POLICY
|
|
537
537
|
──────────────────────────────────────────────────────────────
|
|
538
538
|
|
|
539
|
-
1. Go to
|
|
539
|
+
1. Go to AWS IAM > Create Policy: https://console.aws.amazon.com/iamv2/home?region={aws_region}#/policies/create
|
|
540
540
|
2. Select the JSON tab
|
|
541
541
|
3. Copy and paste the following policy (replace <bucket> with your bucket name):
|
|
542
542
|
|
|
@@ -553,7 +553,7 @@ STEP 2: CREATE IAM POLICY
|
|
|
553
553
|
STEP {step}: CREATE IAM ROLE FOR {environment} ENVIRONMENT
|
|
554
554
|
──────────────────────────────────────────────────────────────
|
|
555
555
|
|
|
556
|
-
1. Go to
|
|
556
|
+
1. Go to AWS IAM > Create Role: https://console.aws.amazon.com/iamv2/home?region={aws_region}#/roles/create
|
|
557
557
|
2. Choose "Custom trust policy" and paste the following (already copied to clipboard):
|
|
558
558
|
|
|
559
559
|
{trust_policy}
|
|
@@ -576,7 +576,7 @@ Please enter the ARN of the role you just created"""
|
|
|
576
576
|
STEP {step}: CREATE IAM ROLE FOR {environment} ENVIRONMENT
|
|
577
577
|
──────────────────────────────────────────────────────────────
|
|
578
578
|
|
|
579
|
-
1. Go to
|
|
579
|
+
1. Go to AWS IAM > Create Role: https://console.aws.amazon.com/iamv2/home?region={aws_region}#/roles/create
|
|
580
580
|
2. Choose "Custom trust policy" and paste the following:
|
|
581
581
|
|
|
582
582
|
{trust_policy}
|
|
@@ -594,7 +594,7 @@ Please enter the ARN of the role you just created"""
|
|
|
594
594
|
|
|
595
595
|
• File created at: {connection_path}
|
|
596
596
|
• You can now use this connection in your Data Sources with: IMPORT_CONNECTION_NAME '{connection_name}'
|
|
597
|
-
•
|
|
597
|
+
• Learn more about our S3 Connector: https://www.tinybird.co/docs/forward/get-data-in/connectors/s3
|
|
598
598
|
""")
|
|
599
599
|
|
|
600
600
|
# S3 IAM Role Connection Messages
|
|
@@ -608,7 +608,7 @@ Please enter the ARN of the role you just created"""
|
|
|
608
608
|
STEP 1: GCP AUTHENTICATION
|
|
609
609
|
──────────────────────────────────────────────────────────────
|
|
610
610
|
|
|
611
|
-
Please log into your
|
|
611
|
+
Please log into your GCP Console. We'll guide you through creating the necessary permissions: https://console.cloud.google.com/
|
|
612
612
|
|
|
613
613
|
You'll be creating a Google Service Account and you will grant it access to you GCS data. Using Google Service Accounts is the Google recommended solution for this use case.""")
|
|
614
614
|
|
|
@@ -618,10 +618,10 @@ You'll be creating a Google Service Account and you will grant it access to you
|
|
|
618
618
|
STEP 2: CREATE GCP SERVICE ACCOUNT
|
|
619
619
|
──────────────────────────────────────────────────────────────
|
|
620
620
|
|
|
621
|
-
1. Go to
|
|
621
|
+
1. Go to IAM & Admin > Service Accounts > + Create Service Account: https://console.cloud.google.com/iam-admin/serviceaccounts/create
|
|
622
622
|
2. Provide a service account name. Name the service account something meaningful (e.g., TinybirdGCS-{environment}-svc-account)
|
|
623
623
|
3. Click "Create and continue"
|
|
624
|
-
4. Click the "Select a role" drop down menu and select "Storage Object Viewer" (You can add IAM condition to provide access to selected buckets. More info in
|
|
624
|
+
4. Click the "Select a role" drop down menu and select "Storage Object Viewer" (You can add IAM condition to provide access to selected buckets. More info in IAM Conditions: https://www.tinybird.co/docs/forward/get-data-in/connectors/gcs)
|
|
625
625
|
5. Click "Done"
|
|
626
626
|
"""
|
|
627
627
|
)
|
|
@@ -644,7 +644,7 @@ STEP 3: ADD KEY TO SERVICE ACCOUNT
|
|
|
644
644
|
|
|
645
645
|
• File created at: {connection_path}
|
|
646
646
|
• You can now use this connection in your Data Sources with: IMPORT_CONNECTION_NAME '{connection_name}'
|
|
647
|
-
•
|
|
647
|
+
• Learn more about our GCS Connector: https://www.tinybird.co/docs/forward/get-data-in/connectors/gcs
|
|
648
648
|
""")
|
|
649
649
|
|
|
650
650
|
prompt_init_git_release_pull = prompt_message(
|
|
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.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/build_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/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.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/format_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/format_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/parse_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb/modules/datafile/pipe_checker.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/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.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/tinyunit/tinyunit.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev147 → tinybird-0.0.1.dev148}/tinybird/tb_cli_modules/workspace_members.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|