tinybird 0.0.1.dev143__py3-none-any.whl → 0.0.1.dev145__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tinybird might be problematic. Click here for more details.
- tinybird/tb/__cli__.py +2 -2
- tinybird/tb/cli.py +0 -1
- tinybird/tb/config.py +1 -1
- tinybird/tb/modules/common.py +9 -28
- tinybird/tb/modules/deprecations.py +111 -4
- tinybird/tb/modules/local.py +19 -1
- tinybird/tb/modules/login.py +38 -7
- {tinybird-0.0.1.dev143.dist-info → tinybird-0.0.1.dev145.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev143.dist-info → tinybird-0.0.1.dev145.dist-info}/RECORD +12 -13
- tinybird/tb/modules/tag.py +0 -100
- {tinybird-0.0.1.dev143.dist-info → tinybird-0.0.1.dev145.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev143.dist-info → tinybird-0.0.1.dev145.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev143.dist-info → tinybird-0.0.1.dev145.dist-info}/top_level.txt +0 -0
tinybird/tb/__cli__.py
CHANGED
|
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
|
|
|
4
4
|
__url__ = 'https://www.tinybird.co/docs/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.dev145'
|
|
8
|
+
__revision__ = 'cb153c4'
|
tinybird/tb/cli.py
CHANGED
|
@@ -25,7 +25,6 @@ import tinybird.tb.modules.mock
|
|
|
25
25
|
import tinybird.tb.modules.open
|
|
26
26
|
import tinybird.tb.modules.pipe
|
|
27
27
|
import tinybird.tb.modules.secret
|
|
28
|
-
import tinybird.tb.modules.tag
|
|
29
28
|
import tinybird.tb.modules.test
|
|
30
29
|
import tinybird.tb.modules.token
|
|
31
30
|
import tinybird.tb.modules.workspace
|
tinybird/tb/config.py
CHANGED
|
@@ -14,11 +14,11 @@ try:
|
|
|
14
14
|
except Exception:
|
|
15
15
|
__revision__ = ""
|
|
16
16
|
|
|
17
|
-
DEFAULT_API_HOST = "https://api.tinybird.co"
|
|
18
17
|
DEFAULT_LOCALHOST = "http://localhost:8001"
|
|
19
18
|
CURRENT_VERSION = f"{__cli__.__version__}"
|
|
20
19
|
VERSION = f"{__cli__.__version__} (rev {__revision__})"
|
|
21
20
|
DEFAULT_UI_HOST = "https://cloud.tinybird.co"
|
|
21
|
+
DEFAULT_API_HOST = "https://api.europe-west2.gcp.tinybird.co"
|
|
22
22
|
SUPPORTED_CONNECTORS = ["bigquery", "snowflake"]
|
|
23
23
|
PROJECT_PATHS = ["datasources", "datasources/fixtures", "endpoints", "pipes", "tests", "scripts", "deploy"]
|
|
24
24
|
DEPRECATED_PROJECT_PATHS = ["endpoints"]
|
tinybird/tb/modules/common.py
CHANGED
|
@@ -499,16 +499,17 @@ def ask_for_region_interactively(regions):
|
|
|
499
499
|
region_index = -1
|
|
500
500
|
|
|
501
501
|
while region_index == -1:
|
|
502
|
-
click.echo(FeedbackManager.info_available_regions())
|
|
503
502
|
for index, region in enumerate(regions):
|
|
504
503
|
provider = f" ({region.get('provider')})" if region.get("provider") else ""
|
|
505
|
-
click.echo(
|
|
506
|
-
|
|
504
|
+
click.echo(
|
|
505
|
+
f" [{index + 1}] {region['name'].lower()}{provider} ({region['host'].replace('app.tinybird.co', 'cloud.tinybird.co')}) "
|
|
506
|
+
)
|
|
507
|
+
click.echo(" [0] Cancel")
|
|
507
508
|
|
|
508
509
|
region_index = click.prompt("\nUse region", default=1)
|
|
509
510
|
|
|
510
511
|
if region_index == 0:
|
|
511
|
-
click.echo(FeedbackManager.
|
|
512
|
+
click.echo(FeedbackManager.warning(message="Region selection cancelled by user"))
|
|
512
513
|
return None
|
|
513
514
|
|
|
514
515
|
try:
|
|
@@ -1390,33 +1391,13 @@ async def get_host_from_region(
|
|
|
1390
1391
|
|
|
1391
1392
|
async def get_regions(config: CLIConfig) -> List[Region]:
|
|
1392
1393
|
regions: List[Region] = []
|
|
1393
|
-
|
|
1394
1394
|
try:
|
|
1395
1395
|
response = await config.get_client().regions()
|
|
1396
1396
|
regions = response.get("regions", [])
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
if "tokens" not in config:
|
|
1402
|
-
return regions
|
|
1403
|
-
|
|
1404
|
-
for key in config["tokens"]:
|
|
1405
|
-
region = next((region for region in regions if key == region["api_host"] or key == region["host"]), None)
|
|
1406
|
-
if region:
|
|
1407
|
-
region["default_password"] = config["tokens"][key]
|
|
1408
|
-
region["provider"] = region["provider"] or ""
|
|
1409
|
-
else:
|
|
1410
|
-
regions.append(
|
|
1411
|
-
{
|
|
1412
|
-
"api_host": format_host(key, subdomain="api"),
|
|
1413
|
-
"host": get_display_cloud_host(key),
|
|
1414
|
-
"name": key,
|
|
1415
|
-
"default_password": config["tokens"][key],
|
|
1416
|
-
"provider": "",
|
|
1417
|
-
}
|
|
1418
|
-
)
|
|
1419
|
-
|
|
1397
|
+
first_default_region = next((region for region in regions if region["api_host"] == DEFAULT_API_HOST), None)
|
|
1398
|
+
if first_default_region:
|
|
1399
|
+
regions.remove(first_default_region)
|
|
1400
|
+
regions.insert(0, first_default_region)
|
|
1420
1401
|
except Exception:
|
|
1421
1402
|
pass
|
|
1422
1403
|
|
|
@@ -1,6 +1,93 @@
|
|
|
1
1
|
import click
|
|
2
2
|
|
|
3
3
|
from tinybird.tb.modules.cli import cli
|
|
4
|
+
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@cli.command(
|
|
8
|
+
name="branch",
|
|
9
|
+
context_settings=dict(
|
|
10
|
+
ignore_unknown_options=True,
|
|
11
|
+
),
|
|
12
|
+
)
|
|
13
|
+
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
14
|
+
def branch(args) -> None:
|
|
15
|
+
"""
|
|
16
|
+
`tb branch` is deprecated. You should rely on your version control system to manage branches.
|
|
17
|
+
"""
|
|
18
|
+
click.echo(FeedbackManager.warning(
|
|
19
|
+
message="This command is deprecated. You should rely on your version control system to manage branches."
|
|
20
|
+
))
|
|
21
|
+
click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@cli.command(
|
|
25
|
+
name="check",
|
|
26
|
+
context_settings=dict(
|
|
27
|
+
ignore_unknown_options=True,
|
|
28
|
+
),
|
|
29
|
+
)
|
|
30
|
+
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
31
|
+
def check(args) -> None:
|
|
32
|
+
"""
|
|
33
|
+
`tb check` is deprecated.
|
|
34
|
+
"""
|
|
35
|
+
click.echo(FeedbackManager.warning(
|
|
36
|
+
message="This command is deprecated."
|
|
37
|
+
))
|
|
38
|
+
click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@cli.command(
|
|
42
|
+
name="diff",
|
|
43
|
+
context_settings=dict(
|
|
44
|
+
ignore_unknown_options=True,
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
48
|
+
def diff(args) -> None:
|
|
49
|
+
"""
|
|
50
|
+
`tb diff` is deprecated.
|
|
51
|
+
"""
|
|
52
|
+
click.echo(FeedbackManager.warning(
|
|
53
|
+
message="This command is deprecated."
|
|
54
|
+
))
|
|
55
|
+
click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@cli.command(
|
|
59
|
+
name="fmt",
|
|
60
|
+
context_settings=dict(
|
|
61
|
+
ignore_unknown_options=True,
|
|
62
|
+
),
|
|
63
|
+
)
|
|
64
|
+
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
65
|
+
def fmt(args) -> None:
|
|
66
|
+
"""
|
|
67
|
+
`tb fmt` is deprecated.
|
|
68
|
+
"""
|
|
69
|
+
click.echo(FeedbackManager.warning(
|
|
70
|
+
message="This command is deprecated."
|
|
71
|
+
))
|
|
72
|
+
click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@cli.command(
|
|
76
|
+
name="init",
|
|
77
|
+
context_settings=dict(
|
|
78
|
+
ignore_unknown_options=True,
|
|
79
|
+
),
|
|
80
|
+
)
|
|
81
|
+
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
82
|
+
def init(args) -> None:
|
|
83
|
+
"""
|
|
84
|
+
`tb init` is deprecated. Use `tb create` instead.
|
|
85
|
+
"""
|
|
86
|
+
click.echo(FeedbackManager.warning(
|
|
87
|
+
message="This command is deprecated. Use `tb create` instead."
|
|
88
|
+
))
|
|
89
|
+
click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
|
|
90
|
+
|
|
4
91
|
|
|
5
92
|
|
|
6
93
|
@cli.command(
|
|
@@ -14,7 +101,27 @@ def push(args) -> None:
|
|
|
14
101
|
"""
|
|
15
102
|
`tb push` is deprecated. Use `tb deploy` instead.
|
|
16
103
|
"""
|
|
17
|
-
click.echo(
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
)
|
|
104
|
+
click.echo(FeedbackManager.warning(
|
|
105
|
+
message="This command is deprecated. Use `tb deploy` instead."
|
|
106
|
+
))
|
|
107
|
+
click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@cli.command(
|
|
112
|
+
name="tag",
|
|
113
|
+
context_settings=dict(
|
|
114
|
+
ignore_unknown_options=True,
|
|
115
|
+
),
|
|
116
|
+
)
|
|
117
|
+
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
|
|
118
|
+
def tag(args) -> None:
|
|
119
|
+
"""
|
|
120
|
+
`tb tag` is deprecated
|
|
121
|
+
"""
|
|
122
|
+
click.echo(FeedbackManager.warning(
|
|
123
|
+
message="This command is deprecated."
|
|
124
|
+
))
|
|
125
|
+
click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
|
|
126
|
+
|
|
127
|
+
|
tinybird/tb/modules/local.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
1
3
|
import re
|
|
2
4
|
import subprocess
|
|
3
5
|
import time
|
|
@@ -125,13 +127,29 @@ def get_existing_container_with_matching_env(
|
|
|
125
127
|
def get_docker_client() -> DockerClient:
|
|
126
128
|
"""Check if Docker is installed and running."""
|
|
127
129
|
try:
|
|
130
|
+
docker_host = os.getenv("DOCKER_HOST")
|
|
131
|
+
if not docker_host:
|
|
132
|
+
# Try to get docker host from docker context
|
|
133
|
+
try:
|
|
134
|
+
output = subprocess.check_output(["docker", "context", "inspect"], text=True)
|
|
135
|
+
context = json.loads(output)
|
|
136
|
+
if context and len(context) > 0:
|
|
137
|
+
docker_host = context[0].get("Endpoints", {}).get("docker", {}).get("Host")
|
|
138
|
+
if docker_host:
|
|
139
|
+
os.environ["DOCKER_HOST"] = docker_host
|
|
140
|
+
except Exception:
|
|
141
|
+
pass
|
|
128
142
|
client = docker.from_env() # type: ignore
|
|
129
143
|
client.ping()
|
|
130
144
|
return client
|
|
131
145
|
except Exception:
|
|
132
146
|
raise CLILocalException(
|
|
133
147
|
FeedbackManager.error(
|
|
134
|
-
message=
|
|
148
|
+
message=(
|
|
149
|
+
f"No container runtime is running. Make sure a Docker-compatible runtime is installed and running. "
|
|
150
|
+
f"Trying to connect to Docker-compatible runtime at {docker_host}\n\n"
|
|
151
|
+
"If you're using a custom location, please provide it using the DOCKER_HOST environment variable."
|
|
152
|
+
)
|
|
135
153
|
)
|
|
136
154
|
)
|
|
137
155
|
|
tinybird/tb/modules/login.py
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import http.server
|
|
2
2
|
import os
|
|
3
3
|
import socketserver
|
|
4
|
+
import sys
|
|
4
5
|
import threading
|
|
5
6
|
import time
|
|
6
7
|
import urllib.parse
|
|
7
8
|
import webbrowser
|
|
8
|
-
from typing import Any, Dict
|
|
9
|
+
from typing import Any, Dict, Optional
|
|
9
10
|
from urllib.parse import urlencode
|
|
10
11
|
|
|
11
12
|
import click
|
|
12
13
|
import requests
|
|
13
14
|
|
|
15
|
+
from tinybird.tb.config import DEFAULT_API_HOST
|
|
14
16
|
from tinybird.tb.modules.cli import CLIConfig, cli
|
|
15
|
-
from tinybird.tb.modules.common import coro
|
|
17
|
+
from tinybird.tb.modules.common import ask_for_region_interactively, coro, get_regions
|
|
16
18
|
from tinybird.tb.modules.exceptions import CLILoginException
|
|
17
19
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
18
20
|
|
|
21
|
+
SERVER_MAX_WAIT_TIME = 180
|
|
22
|
+
|
|
19
23
|
|
|
20
24
|
class AuthHandler(http.server.SimpleHTTPRequestHandler):
|
|
21
25
|
def do_GET(self):
|
|
@@ -93,14 +97,15 @@ def start_server(auth_callback, auth_host):
|
|
|
93
97
|
with AuthServer(("", AUTH_SERVER_PORT), AuthHandler, auth_callback, auth_host) as httpd:
|
|
94
98
|
httpd.timeout = 30
|
|
95
99
|
start_time = time.time()
|
|
96
|
-
while time.time() - start_time <
|
|
100
|
+
while time.time() - start_time < SERVER_MAX_WAIT_TIME: # Run for a maximum of 180 seconds
|
|
97
101
|
httpd.handle_request()
|
|
98
102
|
|
|
99
103
|
|
|
100
104
|
@cli.command()
|
|
101
105
|
@click.option(
|
|
102
106
|
"--host",
|
|
103
|
-
|
|
107
|
+
type=str,
|
|
108
|
+
default=None,
|
|
104
109
|
help="Set custom host if it's different than https://api.europe-west2.gcp.tinybird.co. See https://www.tinybird.co/docs/api-reference/overview#regions-and-endpoints for the available list of regions.",
|
|
105
110
|
)
|
|
106
111
|
@click.option(
|
|
@@ -112,10 +117,37 @@ def start_server(auth_callback, auth_host):
|
|
|
112
117
|
"--workspace",
|
|
113
118
|
help="Set the workspace to authenticate to. If unset, the default workspace will be used.",
|
|
114
119
|
)
|
|
120
|
+
@click.option(
|
|
121
|
+
"-i",
|
|
122
|
+
"--interactive",
|
|
123
|
+
is_flag=True,
|
|
124
|
+
default=False,
|
|
125
|
+
help="Show available regions and select where to authenticate to",
|
|
126
|
+
)
|
|
115
127
|
@coro
|
|
116
|
-
async def login(host: str, auth_host: str, workspace: str):
|
|
128
|
+
async def login(host: Optional[str], auth_host: str, workspace: str, interactive: bool):
|
|
117
129
|
"""Authenticate using the browser."""
|
|
118
130
|
try:
|
|
131
|
+
cli_config = CLIConfig.get_project_config()
|
|
132
|
+
if not host and cli_config.get_token():
|
|
133
|
+
host = cli_config.get_host(use_defaults_if_needed=False)
|
|
134
|
+
if not host or interactive:
|
|
135
|
+
if interactive:
|
|
136
|
+
click.echo(FeedbackManager.highlight(message="» Select one region from the list below:"))
|
|
137
|
+
else:
|
|
138
|
+
click.echo(FeedbackManager.highlight(message="» No region detected, select one from the list below:"))
|
|
139
|
+
|
|
140
|
+
regions = await get_regions(cli_config)
|
|
141
|
+
selected_region = ask_for_region_interactively(regions)
|
|
142
|
+
|
|
143
|
+
# If the user cancels the selection, we'll exit
|
|
144
|
+
if not selected_region:
|
|
145
|
+
sys.exit(1)
|
|
146
|
+
host = selected_region.get("api_host")
|
|
147
|
+
|
|
148
|
+
if not host:
|
|
149
|
+
host = DEFAULT_API_HOST
|
|
150
|
+
|
|
119
151
|
host = host.rstrip("/")
|
|
120
152
|
auth_host = auth_host.rstrip("/")
|
|
121
153
|
|
|
@@ -147,7 +179,7 @@ async def login(host: str, auth_host: str, workspace: str):
|
|
|
147
179
|
webbrowser.open(auth_url)
|
|
148
180
|
|
|
149
181
|
# Wait for the authentication to complete or timeout
|
|
150
|
-
if auth_event.wait(timeout=
|
|
182
|
+
if auth_event.wait(timeout=SERVER_MAX_WAIT_TIME): # Wait for up to 180 seconds
|
|
151
183
|
params = {}
|
|
152
184
|
params["code"] = auth_code[0]
|
|
153
185
|
response = requests.get( # noqa: ASYNC210
|
|
@@ -155,7 +187,6 @@ async def login(host: str, auth_host: str, workspace: str):
|
|
|
155
187
|
)
|
|
156
188
|
|
|
157
189
|
data = response.json()
|
|
158
|
-
cli_config = CLIConfig.get_project_config()
|
|
159
190
|
cli_config.set_token(data.get("workspace_token", ""))
|
|
160
191
|
cli_config.set_token_for_host(data.get("workspace_token", ""), host)
|
|
161
192
|
cli_config.set_user_token(data.get("user_token", ""))
|
|
@@ -12,23 +12,23 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
|
|
|
12
12
|
tinybird/tornado_template.py,sha256=jjNVDMnkYFWXflmT8KU_Ssbo5vR8KQq3EJMk5vYgXRw,41959
|
|
13
13
|
tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
|
|
14
14
|
tinybird/ch_utils/engine.py,sha256=BZuPM7MFS7vaEKK5tOMR2bwSAgJudPrJt27uVEwZmTY,40512
|
|
15
|
-
tinybird/tb/__cli__.py,sha256=
|
|
15
|
+
tinybird/tb/__cli__.py,sha256=yqxot7FrTzrhmcQuDsEZa2EE0ElLIrnj1a2S9FpMrhM,252
|
|
16
16
|
tinybird/tb/check_pypi.py,sha256=rW4QmDRbtgKdUUwJCnBkVjmTjZSZGN-XgZhx7vMkC0w,1009
|
|
17
|
-
tinybird/tb/cli.py,sha256=
|
|
17
|
+
tinybird/tb/cli.py,sha256=uPV6pvi4aYVfaiGs0DQO-eoi1g9dHlrgvhutkXkdJko,1075
|
|
18
18
|
tinybird/tb/client.py,sha256=aaPKq5C77e72kR7IMv9WrvnvNki8mKMOTi9EsCp0eUc,55962
|
|
19
|
-
tinybird/tb/config.py,sha256=
|
|
19
|
+
tinybird/tb/config.py,sha256=jT9xndpeCY_g0HdB5qE2EquC0TFRRnkPnQFWZWd04jo,3998
|
|
20
20
|
tinybird/tb/modules/auth.py,sha256=_OeYnmTH83lnqCgQEdS6K0bx1KBUeRmZk2M7JnRmWpk,9037
|
|
21
21
|
tinybird/tb/modules/build.py,sha256=5SX59ssq0KaRrgzk21KmYUnB6xOdQ_O59n7rxFBQQ1Y,17393
|
|
22
22
|
tinybird/tb/modules/cicd.py,sha256=Ug7LijuHDIqKR6rm8OLZispWp75Zv6TyonAme8K9jaI,7114
|
|
23
23
|
tinybird/tb/modules/cli.py,sha256=V8fC0GLt5HWtOTk6TOZM5xUAY9PoH05kyJxE6Zu4MT4,14075
|
|
24
|
-
tinybird/tb/modules/common.py,sha256=
|
|
24
|
+
tinybird/tb/modules/common.py,sha256=WzF_zRtAl3FKqbzK6yi_IjeeGIjQNu6SKnP-PX-o3Kk,85196
|
|
25
25
|
tinybird/tb/modules/config.py,sha256=ziqW_t_mRVvWOd85VoB4vKyvgMkEfpXDf9H4v38p2xc,11422
|
|
26
26
|
tinybird/tb/modules/connection.py,sha256=7oOR7x4PhBcm1ETFFCH2YJ_3oeGXjAbmx1cnZX9_L70,9014
|
|
27
27
|
tinybird/tb/modules/copy.py,sha256=2Mm4FWKehOG7CoOhiF1m9UZJgJn0W1_cMolqju8ONYg,5805
|
|
28
28
|
tinybird/tb/modules/create.py,sha256=VMX8b5ukgQm0VDUbBX91TsIsxqQid2UXRwlKekQp3M4,16792
|
|
29
29
|
tinybird/tb/modules/datasource.py,sha256=V314rkpdVxVMjsp5qcSCTqDlmp4Vu--qM07BoWh-aqs,17783
|
|
30
30
|
tinybird/tb/modules/deployment.py,sha256=M3NPFQXIEsDh9-J-pzPLuHF9k4SIZVvgUnHp05KOf-E,20448
|
|
31
|
-
tinybird/tb/modules/deprecations.py,sha256=
|
|
31
|
+
tinybird/tb/modules/deprecations.py,sha256=vDf9RgCM8FoSGrFMJLMdNhfvmtMw5t30W-fsOJq3FzI,3607
|
|
32
32
|
tinybird/tb/modules/endpoint.py,sha256=XySDt3pk66vxOZ0egUfz4bY8bEk3BjOXkv-L0OIJ3sc,12083
|
|
33
33
|
tinybird/tb/modules/exceptions.py,sha256=5jK91w1LPmtqIUfDpHe_Op5OxGz8-p1BPgtLREMIni0,5217
|
|
34
34
|
tinybird/tb/modules/feedback_manager.py,sha256=Ncenxx48-vWJjDLPuuIPOOT_1oaAVjuMLHIfbez7v0U,77652
|
|
@@ -36,9 +36,9 @@ tinybird/tb/modules/infra.py,sha256=fve30Gj3mG9zbquGxS2e4ipcOYOxviWQCpNFfEzJN_Q,
|
|
|
36
36
|
tinybird/tb/modules/job.py,sha256=n4dSSBgnA8NqD7srGahf2xRj6wxkmX9Vl0J-QJ_a2w0,2966
|
|
37
37
|
tinybird/tb/modules/llm.py,sha256=KfsCYmKeW1VQz0iDZhGKCRkQv_Y3kTHh6JuxvofOguE,1076
|
|
38
38
|
tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
|
|
39
|
-
tinybird/tb/modules/local.py,sha256
|
|
39
|
+
tinybird/tb/modules/local.py,sha256=kxdF8NXZYYwtUwlFHxHKq_PA9CpMrG-rXOg_i_hlvnY,12158
|
|
40
40
|
tinybird/tb/modules/local_common.py,sha256=Fr3U4_xqtH4AzHPo-y75dOrXlE-kC7DeC55oKeC-PMo,3255
|
|
41
|
-
tinybird/tb/modules/login.py,sha256=
|
|
41
|
+
tinybird/tb/modules/login.py,sha256=fmXPSdvJnKPv03chptGuu3_Fm6LhP6kUsUKhrmT8rJc,8269
|
|
42
42
|
tinybird/tb/modules/logout.py,sha256=ULooy1cDBD02-r7voZmhV7udA0ML5tVuflJyShrh56Y,1022
|
|
43
43
|
tinybird/tb/modules/materialization.py,sha256=QJX5kCPhhm6IXBO1JsalVfbQdypCe_eOUDZ_WHJZWS8,5478
|
|
44
44
|
tinybird/tb/modules/mock.py,sha256=tyhs6izqVGmDzMHdW5yHiprNPjeJDa2I-cLwrLRDC_U,4816
|
|
@@ -49,7 +49,6 @@ tinybird/tb/modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGM
|
|
|
49
49
|
tinybird/tb/modules/secret.py,sha256=WsqzxxLh9W_jkuHL2JofMXdIJy0lT5WEI-7bQSIDgAc,2921
|
|
50
50
|
tinybird/tb/modules/shell.py,sha256=Zd_4Ak_5tKVX-cw6B4ag36xZeEGHeh-jZpAsIXkoMoE,14116
|
|
51
51
|
tinybird/tb/modules/table.py,sha256=4XrtjM-N0zfNtxVkbvLDQQazno1EPXnxTyo7llivfXk,11035
|
|
52
|
-
tinybird/tb/modules/tag.py,sha256=anPmMUBc-TbFovlpFi8GPkKA18y7Y0GczMsMms5TZsU,3502
|
|
53
52
|
tinybird/tb/modules/telemetry.py,sha256=IHHks8-jnrkyQIY_Y6ZmU8hdVHMGSS0pkSUOgCPcYY8,11346
|
|
54
53
|
tinybird/tb/modules/test.py,sha256=WmPoZBSHBORiM66xp54KxfY3s0YwjFMN_ZTT8xObFO4,12377
|
|
55
54
|
tinybird/tb/modules/token.py,sha256=2fmKwu10_M0pqs6YmJVeILR9ZQB0ejRAET86agASbKM,13488
|
|
@@ -80,8 +79,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
|
|
|
80
79
|
tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
|
|
81
80
|
tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
|
|
82
81
|
tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
|
|
83
|
-
tinybird-0.0.1.
|
|
84
|
-
tinybird-0.0.1.
|
|
85
|
-
tinybird-0.0.1.
|
|
86
|
-
tinybird-0.0.1.
|
|
87
|
-
tinybird-0.0.1.
|
|
82
|
+
tinybird-0.0.1.dev145.dist-info/METADATA,sha256=TtePTe-OGJeC189E2LQDlYSI6jr6zBZ8ktwol-RVH6E,1612
|
|
83
|
+
tinybird-0.0.1.dev145.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
84
|
+
tinybird-0.0.1.dev145.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
85
|
+
tinybird-0.0.1.dev145.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
86
|
+
tinybird-0.0.1.dev145.dist-info/RECORD,,
|
tinybird/tb/modules/tag.py
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
|
-
import click
|
|
4
|
-
from click import Context
|
|
5
|
-
|
|
6
|
-
from tinybird.tb.modules.cli import cli
|
|
7
|
-
from tinybird.tb.modules.common import coro, echo_safe_humanfriendly_tables_format_smart_table
|
|
8
|
-
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@cli.group(hidden=True)
|
|
12
|
-
@click.pass_context
|
|
13
|
-
def tag(ctx: Context) -> None:
|
|
14
|
-
"""Tag commands"""
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@tag.command(name="ls")
|
|
18
|
-
@click.argument("tag_name", required=False)
|
|
19
|
-
@click.pass_context
|
|
20
|
-
@coro
|
|
21
|
-
async def tag_ls(ctx: Context, tag_name: Optional[str]) -> None:
|
|
22
|
-
"""List all the tags of the current Workspace or the resources associated to a specific tag."""
|
|
23
|
-
|
|
24
|
-
client = ctx.ensure_object(dict)["client"]
|
|
25
|
-
response = await client.get_all_tags()
|
|
26
|
-
|
|
27
|
-
if tag_name:
|
|
28
|
-
the_tag = [tag for tag in response["tags"] if tag["name"] == tag_name]
|
|
29
|
-
|
|
30
|
-
columns = ["name", "id", "type"]
|
|
31
|
-
table = []
|
|
32
|
-
|
|
33
|
-
if len(the_tag) > 0:
|
|
34
|
-
for resource in the_tag[0]["resources"]:
|
|
35
|
-
table.append([resource["name"], resource["id"], resource["type"]])
|
|
36
|
-
|
|
37
|
-
click.echo(FeedbackManager.info_tag_resources(tag_name=tag_name))
|
|
38
|
-
echo_safe_humanfriendly_tables_format_smart_table(table, column_names=columns)
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
columns = ["tag", "resources"]
|
|
42
|
-
table = []
|
|
43
|
-
|
|
44
|
-
for tag in response["tags"]:
|
|
45
|
-
unique_resources = []
|
|
46
|
-
for resource in tag["resources"]:
|
|
47
|
-
if resource.get("name", "") not in unique_resources:
|
|
48
|
-
unique_resources.append(resource) # Reducing by name in case there are duplicates.
|
|
49
|
-
table.append([tag["name"], len(unique_resources)])
|
|
50
|
-
|
|
51
|
-
click.echo(FeedbackManager.info_tag_list())
|
|
52
|
-
echo_safe_humanfriendly_tables_format_smart_table(table, column_names=columns)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@tag.command(name="create")
|
|
56
|
-
@click.argument("tag_name")
|
|
57
|
-
@click.pass_context
|
|
58
|
-
@coro
|
|
59
|
-
async def tag_create(ctx: Context, tag_name: str) -> None:
|
|
60
|
-
"""Create a tag in the current Workspace."""
|
|
61
|
-
|
|
62
|
-
client = ctx.ensure_object(dict)["client"]
|
|
63
|
-
await client.create_tag(name=tag_name)
|
|
64
|
-
|
|
65
|
-
click.echo(FeedbackManager.success_tag_created(tag_name=tag_name))
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
@tag.command(name="rm")
|
|
69
|
-
@click.argument("tag_name")
|
|
70
|
-
@click.option("--yes", is_flag=True, default=False, help="Do not ask for confirmation to delete the tag.")
|
|
71
|
-
@click.pass_context
|
|
72
|
-
@coro
|
|
73
|
-
async def tag_rm(ctx: Context, tag_name: str, yes: bool) -> None:
|
|
74
|
-
"""Remove a tag from the current Workspace."""
|
|
75
|
-
|
|
76
|
-
client = ctx.ensure_object(dict)["client"]
|
|
77
|
-
remove_tag = True
|
|
78
|
-
|
|
79
|
-
if not yes:
|
|
80
|
-
all_tags = await client.get_all_tags()
|
|
81
|
-
the_tag = [tag for tag in all_tags["tags"] if tag["name"] == tag_name]
|
|
82
|
-
if len(the_tag) > 0:
|
|
83
|
-
unique_resources = []
|
|
84
|
-
for resource in the_tag[0]["resources"]:
|
|
85
|
-
if resource.get("name", "") not in unique_resources:
|
|
86
|
-
unique_resources.append(resource) # Reducing by name in case there are duplicates.
|
|
87
|
-
|
|
88
|
-
if len(unique_resources) > 0:
|
|
89
|
-
remove_tag = click.confirm(
|
|
90
|
-
FeedbackManager.warning_tag_remove(tag_name=tag_name, resources_len=len(unique_resources))
|
|
91
|
-
)
|
|
92
|
-
else:
|
|
93
|
-
remove_tag = click.confirm(FeedbackManager.warning_tag_remove_no_resources(tag_name=tag_name))
|
|
94
|
-
else:
|
|
95
|
-
remove_tag = False
|
|
96
|
-
click.echo(FeedbackManager.error_tag_not_found(tag_name=tag_name))
|
|
97
|
-
|
|
98
|
-
if remove_tag:
|
|
99
|
-
await client.delete_tag(tag_name)
|
|
100
|
-
click.echo(FeedbackManager.success_tag_removed(tag_name=tag_name))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|