tinybird 0.0.1.dev54__py3-none-any.whl → 0.0.1.dev56__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/modules/cli.py +6 -4
- tinybird/tb/modules/copy.py +24 -29
- tinybird/tb/modules/deployment.py +4 -0
- tinybird/tb/modules/login.py +20 -13
- {tinybird-0.0.1.dev54.dist-info → tinybird-0.0.1.dev56.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev54.dist-info → tinybird-0.0.1.dev56.dist-info}/RECORD +10 -10
- {tinybird-0.0.1.dev54.dist-info → tinybird-0.0.1.dev56.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev54.dist-info → tinybird-0.0.1.dev56.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev54.dist-info → tinybird-0.0.1.dev56.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.dev56'
|
|
8
|
+
__revision__ = 'e22d9a3'
|
tinybird/tb/modules/cli.py
CHANGED
|
@@ -123,7 +123,7 @@ async def cli(
|
|
|
123
123
|
|
|
124
124
|
logging.debug("debug enabled")
|
|
125
125
|
|
|
126
|
-
client = await create_ctx_client(ctx, config, cloud, build
|
|
126
|
+
client = await create_ctx_client(ctx, config, cloud, build)
|
|
127
127
|
|
|
128
128
|
if client:
|
|
129
129
|
ctx.ensure_object(dict)["client"] = client
|
|
@@ -390,7 +390,7 @@ def __unpatch_click_output():
|
|
|
390
390
|
click.secho = __old_click_secho
|
|
391
391
|
|
|
392
392
|
|
|
393
|
-
async def create_ctx_client(ctx: Context, config: Dict[str, Any], cloud: bool, build: bool
|
|
393
|
+
async def create_ctx_client(ctx: Context, config: Dict[str, Any], cloud: bool, build: bool):
|
|
394
394
|
commands_without_ctx_client = ["auth", "check", "login", "local", "upgrade"]
|
|
395
395
|
command = ctx.invoked_subcommand
|
|
396
396
|
if command in commands_without_ctx_client:
|
|
@@ -404,9 +404,11 @@ async def create_ctx_client(ctx: Context, config: Dict[str, Any], cloud: bool, b
|
|
|
404
404
|
and command not in commands_always_build
|
|
405
405
|
and command not in commands_always_local
|
|
406
406
|
):
|
|
407
|
-
click.echo(
|
|
407
|
+
click.echo(
|
|
408
|
+
FeedbackManager.gray(message=f"Running against Tinybird Cloud: Workspace {config.get('name', 'default')}")
|
|
409
|
+
)
|
|
408
410
|
return _get_tb_client(config.get("token", None), config["host"])
|
|
409
411
|
build = command in commands_always_build or build
|
|
410
412
|
if not build and command not in commands_always_local and command not in commands_always_build:
|
|
411
|
-
click.echo(FeedbackManager.gray(message="Running against Tinybird
|
|
413
|
+
click.echo(FeedbackManager.gray(message="Running against Tinybird Local\n"))
|
|
412
414
|
return await get_tinybird_local_client(config, build=build)
|
tinybird/tb/modules/copy.py
CHANGED
|
@@ -75,7 +75,6 @@ async def copy_ls(ctx: Context, match: str, format_: str):
|
|
|
75
75
|
@click.option(
|
|
76
76
|
"--mode", type=click.Choice(["append", "replace"], case_sensitive=True), default=None, help="Copy strategy"
|
|
77
77
|
)
|
|
78
|
-
@click.option("--yes", is_flag=True, default=False, help="Do not ask for confirmation")
|
|
79
78
|
@click.option(
|
|
80
79
|
"--param",
|
|
81
80
|
nargs=1,
|
|
@@ -86,37 +85,33 @@ async def copy_ls(ctx: Context, match: str, format_: str):
|
|
|
86
85
|
)
|
|
87
86
|
@click.pass_context
|
|
88
87
|
@coro
|
|
89
|
-
async def copy_run(
|
|
90
|
-
|
|
91
|
-
):
|
|
92
|
-
"""Run an on-demand copy job"""
|
|
88
|
+
async def copy_run(ctx: click.Context, pipe_name_or_id: str, wait: bool, mode: str, param: Optional[Tuple[str]]):
|
|
89
|
+
"""Run an on-demand copy pipe"""
|
|
93
90
|
|
|
94
91
|
params = dict(key_value.split("=") for key_value in param) if param else {}
|
|
92
|
+
click.echo(FeedbackManager.highlight(message=f"\n» Running on-demand copy '{pipe_name_or_id}'"))
|
|
93
|
+
client: TinyB = ctx.ensure_object(dict)["client"]
|
|
94
|
+
|
|
95
|
+
try:
|
|
96
|
+
response = await client.pipe_run_copy(pipe_name_or_id, params, mode)
|
|
97
|
+
|
|
98
|
+
job_id = response["job"]["job_id"]
|
|
99
|
+
job_url = response["job"]["job_url"]
|
|
100
|
+
target_datasource_id = response["tags"]["copy_target_datasource"]
|
|
101
|
+
target_datasource = await client.get_datasource(target_datasource_id)
|
|
102
|
+
target_datasource_name = target_datasource["name"]
|
|
103
|
+
click.echo(FeedbackManager.gray(message="Job URL: ") + FeedbackManager.info(message=f"{job_url}"))
|
|
104
|
+
click.echo(FeedbackManager.success(message=f"✓ Copy to '{target_datasource_name}' job created"))
|
|
95
105
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
target_datasource_id = response["tags"]["copy_target_datasource"]
|
|
106
|
-
target_datasource = await client.get_datasource(target_datasource_id)
|
|
107
|
-
target_datasource_name = target_datasource["name"]
|
|
108
|
-
click.echo(
|
|
109
|
-
FeedbackManager.success_copy_job_created(target_datasource=target_datasource_name, job_url=job_url)
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
if wait:
|
|
113
|
-
await wait_job(client, job_id, job_url, "** Copying data")
|
|
114
|
-
click.echo(FeedbackManager.success_data_copied_to_ds(target_datasource=target_datasource_name))
|
|
115
|
-
|
|
116
|
-
except AuthNoTokenException:
|
|
117
|
-
raise
|
|
118
|
-
except Exception as e:
|
|
119
|
-
raise CLIPipeException(FeedbackManager.error_creating_copy_job(error=e))
|
|
106
|
+
if wait:
|
|
107
|
+
click.echo("\n")
|
|
108
|
+
await wait_job(client, job_id, job_url, FeedbackManager.highlight(message="» Copying data"))
|
|
109
|
+
click.echo(FeedbackManager.success(message=f"✓ Data copied to '{target_datasource_name}'"))
|
|
110
|
+
|
|
111
|
+
except AuthNoTokenException:
|
|
112
|
+
raise
|
|
113
|
+
except Exception as e:
|
|
114
|
+
raise CLIPipeException(FeedbackManager.error_creating_copy_job(error=e))
|
|
120
115
|
|
|
121
116
|
|
|
122
117
|
@copy.command(name="resume", short_help="Resume a paused copy pipe")
|
|
@@ -15,6 +15,8 @@ from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
|
15
15
|
from tinybird.tb.modules.project import Project
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
# TODO(eclbg): This logic should be in the server, and there should be a dedicated endpoint for promoting a deployment
|
|
19
|
+
# potato
|
|
18
20
|
def promote_deployment(host: Optional[str], headers: dict, wait: bool) -> None:
|
|
19
21
|
TINYBIRD_API_URL = f"{host}/v1/deployments"
|
|
20
22
|
r = requests.get(TINYBIRD_API_URL, headers=headers)
|
|
@@ -72,6 +74,8 @@ def promote_deployment(host: Optional[str], headers: dict, wait: bool) -> None:
|
|
|
72
74
|
click.echo(FeedbackManager.success(message="Deployment promoted successfully"))
|
|
73
75
|
|
|
74
76
|
|
|
77
|
+
# TODO(eclbg): This logic should be in the server, and there should be a dedicated endpoint for rolling back a
|
|
78
|
+
# deployment
|
|
75
79
|
def rollback_deployment(host: Optional[str], headers: dict, wait: bool) -> None:
|
|
76
80
|
TINYBIRD_API_URL = f"{host}/v1/deployments"
|
|
77
81
|
r = requests.get(TINYBIRD_API_URL, headers=headers)
|
tinybird/tb/modules/login.py
CHANGED
|
@@ -21,11 +21,12 @@ class AuthHandler(http.server.SimpleHTTPRequestHandler):
|
|
|
21
21
|
self.send_response(200)
|
|
22
22
|
self.send_header("Content-type", "text/html")
|
|
23
23
|
self.end_headers()
|
|
24
|
-
self.wfile.write(
|
|
24
|
+
self.wfile.write(
|
|
25
|
+
"""
|
|
25
26
|
<html>
|
|
26
27
|
<head>
|
|
27
28
|
<style>
|
|
28
|
-
body {
|
|
29
|
+
body {{
|
|
29
30
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
30
31
|
background: #f5f5f5;
|
|
31
32
|
display: flex;
|
|
@@ -33,7 +34,7 @@ class AuthHandler(http.server.SimpleHTTPRequestHandler):
|
|
|
33
34
|
justify-content: center;
|
|
34
35
|
height: 100vh;
|
|
35
36
|
margin: 0;
|
|
36
|
-
}
|
|
37
|
+
}}
|
|
37
38
|
</style>
|
|
38
39
|
</head>
|
|
39
40
|
<body>
|
|
@@ -41,14 +42,16 @@ class AuthHandler(http.server.SimpleHTTPRequestHandler):
|
|
|
41
42
|
const searchParams = new URLSearchParams(window.location.search);
|
|
42
43
|
const code = searchParams.get('code');
|
|
43
44
|
const workspace = searchParams.get('workspace');
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const host = "{auth_host}";
|
|
46
|
+
fetch('/?code=' + code, {{method: 'POST'}})
|
|
47
|
+
.then(() => {{
|
|
48
|
+
window.location.href = host + "/cli-login?workspace=" + workspace;
|
|
49
|
+
}});
|
|
48
50
|
</script>
|
|
49
51
|
</body>
|
|
50
52
|
</html>
|
|
51
|
-
""")
|
|
53
|
+
""".format(auth_host=self.server.auth_host).encode()
|
|
54
|
+
)
|
|
52
55
|
|
|
53
56
|
def do_POST(self):
|
|
54
57
|
parsed_path = urllib.parse.urlparse(self.path)
|
|
@@ -75,13 +78,14 @@ AUTH_SERVER_PORT = 49160
|
|
|
75
78
|
class AuthServer(socketserver.TCPServer):
|
|
76
79
|
allow_reuse_address = True
|
|
77
80
|
|
|
78
|
-
def __init__(self, server_address, RequestHandlerClass, auth_callback):
|
|
81
|
+
def __init__(self, server_address, RequestHandlerClass, auth_callback, auth_host):
|
|
79
82
|
self.auth_callback = auth_callback
|
|
83
|
+
self.auth_host = auth_host
|
|
80
84
|
super().__init__(server_address, RequestHandlerClass)
|
|
81
85
|
|
|
82
86
|
|
|
83
|
-
def start_server(auth_callback):
|
|
84
|
-
with AuthServer(("", AUTH_SERVER_PORT), AuthHandler, auth_callback) as httpd:
|
|
87
|
+
def start_server(auth_callback, auth_host):
|
|
88
|
+
with AuthServer(("", AUTH_SERVER_PORT), AuthHandler, auth_callback, auth_host) as httpd:
|
|
85
89
|
httpd.timeout = 30
|
|
86
90
|
start_time = time.time()
|
|
87
91
|
while time.time() - start_time < 60: # Run for a maximum of 60 seconds
|
|
@@ -91,6 +95,7 @@ def start_server(auth_callback):
|
|
|
91
95
|
@cli.command()
|
|
92
96
|
@click.option(
|
|
93
97
|
"--host",
|
|
98
|
+
default="https://api.europe-west2.gcp.tinybird.co",
|
|
94
99
|
help="Set custom host if it's different than https://api.tinybird.co. See https://www.tinybird.co/docs/api-reference/overview#regions-and-endpoints for the available list of regions.",
|
|
95
100
|
)
|
|
96
101
|
@click.option(
|
|
@@ -107,7 +112,9 @@ async def login(host: str, auth_host: str, workspace: str):
|
|
|
107
112
|
"""Authenticate using the browser."""
|
|
108
113
|
auth_event = threading.Event()
|
|
109
114
|
auth_code: list[str] = [] # Using a list to store the code, as it's mutable
|
|
110
|
-
|
|
115
|
+
|
|
116
|
+
if auth_host == "https://cloud.tinybird.co" and "wadus" in host:
|
|
117
|
+
auth_host = "https://cloud-wadus.tinybird.co"
|
|
111
118
|
|
|
112
119
|
def auth_callback(code):
|
|
113
120
|
auth_code.append(code)
|
|
@@ -116,7 +123,7 @@ async def login(host: str, auth_host: str, workspace: str):
|
|
|
116
123
|
click.echo(FeedbackManager.highlight(message="» Opening browser for authentication..."))
|
|
117
124
|
|
|
118
125
|
# Start the local server in a separate thread
|
|
119
|
-
server_thread = threading.Thread(target=start_server, args=(auth_callback,))
|
|
126
|
+
server_thread = threading.Thread(target=start_server, args=(auth_callback, auth_host))
|
|
120
127
|
server_thread.daemon = True
|
|
121
128
|
server_thread.start()
|
|
122
129
|
|
|
@@ -15,18 +15,18 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
|
|
|
15
15
|
tinybird/tornado_template.py,sha256=FL85SMPq2dH4JqKovmSbaolGdEzwOO91NqOzqXo2Qr0,41863
|
|
16
16
|
tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
|
|
17
17
|
tinybird/ch_utils/engine.py,sha256=OXkBhlzGjZotjD0vaT-rFIbSGV4tpiHxE8qO_ip0SyQ,40454
|
|
18
|
-
tinybird/tb/__cli__.py,sha256=
|
|
18
|
+
tinybird/tb/__cli__.py,sha256=5GEuAS2TJj6qPLbuuMWnjJTIDITptpmJkpS2ZJxSBlM,251
|
|
19
19
|
tinybird/tb/cli.py,sha256=FD1pfbzu9YHJHEG6Vtn_EwPLTYhwqw-I6AxXeTaRHU8,926
|
|
20
20
|
tinybird/tb/modules/auth.py,sha256=EzRWFmwRkXNhUmRaruEVFLdkbUg8xMSix0cAWl5D4Jg,9029
|
|
21
21
|
tinybird/tb/modules/build.py,sha256=bGx4sON9g90zVBVCd16La-1yV1nWZ_AY-2RZ77sco0s,8361
|
|
22
22
|
tinybird/tb/modules/cicd.py,sha256=xxXwy-QekJcG14kkJeGNl7LkHduhZXfvBZE8WrU6-t4,5351
|
|
23
|
-
tinybird/tb/modules/cli.py,sha256=
|
|
23
|
+
tinybird/tb/modules/cli.py,sha256=lCRp71IOfmDIv4fTKeswYEe1ZzpDAX202a5zxBCg-zQ,16199
|
|
24
24
|
tinybird/tb/modules/common.py,sha256=TWcGJUgzJCQvzI1oMKbNdx-KTRmMGvB25BawHpsaV8Q,70610
|
|
25
25
|
tinybird/tb/modules/config.py,sha256=mie3oMVTf5YOUFEiLs88P16U4LkJafJjSpjwyAkFHog,10979
|
|
26
|
-
tinybird/tb/modules/copy.py,sha256=
|
|
26
|
+
tinybird/tb/modules/copy.py,sha256=Aq6wh_wjRiyLQtEOKF9pKLPgJhSvbGTFWIw_LJB0t0U,5801
|
|
27
27
|
tinybird/tb/modules/create.py,sha256=_eAMjntZ85uub1HqHoDekWC7ks79FQ2Zbc_6grjhT_g,14472
|
|
28
28
|
tinybird/tb/modules/datasource.py,sha256=TQ4wSag3CCw34d54FEXPJFGLQNYyNqv2nQbU6QT9uAE,14725
|
|
29
|
-
tinybird/tb/modules/deployment.py,sha256=
|
|
29
|
+
tinybird/tb/modules/deployment.py,sha256=LtAvjNuoUZFEB8gi3DKYGwPCAjiIh-OskDONW6lZdRI,12111
|
|
30
30
|
tinybird/tb/modules/endpoint.py,sha256=9arqN1JQCMb0Nd3-EJ7lukOYkGHHCpQmiiZpp5FqPhc,9432
|
|
31
31
|
tinybird/tb/modules/exceptions.py,sha256=4A2sSjCEqKUMqpP3WI00zouCWW4uLaghXXLZBSw04mY,3363
|
|
32
32
|
tinybird/tb/modules/feedback_manager.py,sha256=mrw5tdYycfvg6WLXlM0KIjfJardm_aNpnJkUg2vH0cA,68463
|
|
@@ -36,7 +36,7 @@ tinybird/tb/modules/llm.py,sha256=AC0VSphTOM2t-v1_3NLvNN_FIbgMo4dTyMqIv5nniPo,83
|
|
|
36
36
|
tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
|
|
37
37
|
tinybird/tb/modules/local.py,sha256=_PIa-1M-72bv9rhLwqaNthJM1ZhvcjWXFChZAfEPXRs,5658
|
|
38
38
|
tinybird/tb/modules/local_common.py,sha256=W1fEnB1vBQ4YC5U1PdA0w0g3cTV78bQ5R-lRxdDj5-Y,2868
|
|
39
|
-
tinybird/tb/modules/login.py,sha256=
|
|
39
|
+
tinybird/tb/modules/login.py,sha256=_Wg2diSxyj9BCpQ_61UMAiS6YeVkOb2fnbgt5Skrveg,6047
|
|
40
40
|
tinybird/tb/modules/materialization.py,sha256=HQKRTH6lkcYiDQJihbFqF_in58ezXG4ggZ_7Ywp_nUM,5738
|
|
41
41
|
tinybird/tb/modules/mock.py,sha256=PzFtZL-6bZAZ3EiCC2nYJo058I4m50fD7FcBHISn3cI,5235
|
|
42
42
|
tinybird/tb/modules/pipe.py,sha256=pH2KwgH6Xbvl3kT8vMelpKvT6bcyB4EKFDvGfOsxXbg,2418
|
|
@@ -74,8 +74,8 @@ tinybird/tb_cli_modules/config.py,sha256=6u6B5QCdiQLbJkCkwtnKGs9H3nP-KXXhC75mF7B
|
|
|
74
74
|
tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
|
|
75
75
|
tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
|
|
76
76
|
tinybird/tb_cli_modules/telemetry.py,sha256=iEGnMuCuNhvF6ln__j6X9MSTwL_0Hm-GgFHHHvhfknk,10466
|
|
77
|
-
tinybird-0.0.1.
|
|
78
|
-
tinybird-0.0.1.
|
|
79
|
-
tinybird-0.0.1.
|
|
80
|
-
tinybird-0.0.1.
|
|
81
|
-
tinybird-0.0.1.
|
|
77
|
+
tinybird-0.0.1.dev56.dist-info/METADATA,sha256=BEIuDVbGT-rIUDOER7B99FXf_bjAgiL74CkedcbagLI,2482
|
|
78
|
+
tinybird-0.0.1.dev56.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
79
|
+
tinybird-0.0.1.dev56.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
80
|
+
tinybird-0.0.1.dev56.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
81
|
+
tinybird-0.0.1.dev56.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|