tinybird 0.0.1.dev53__py3-none-any.whl → 0.0.1.dev55__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 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.dev53'
8
- __revision__ = '883fa46'
7
+ __version__ = '0.0.1.dev55'
8
+ __revision__ = 'cc01364'
@@ -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, project)
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, project: Project):
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(FeedbackManager.gray(message=f"Running against {config.get('name') or 'cloud'}"))
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 local\n"))
413
+ click.echo(FeedbackManager.gray(message="Running against Tinybird Local\n"))
412
414
  return await get_tinybird_local_client(config, build=build)
@@ -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
- ctx: click.Context, pipe_name_or_id: str, wait: bool, mode: str, yes: bool, param: Optional[Tuple[str]]
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
- if yes or click.confirm(FeedbackManager.warning_confirm_copy_pipe(pipe=pipe_name_or_id)):
97
- click.echo(FeedbackManager.info_copy_job_running(pipe=pipe_name_or_id))
98
- client: TinyB = ctx.ensure_object(dict)["client"]
99
-
100
- try:
101
- response = await client.pipe_run_copy(pipe_name_or_id, params, mode)
102
-
103
- job_id = response["job"]["job_id"]
104
- job_url = response["job"]["job_url"]
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)
@@ -91,6 +91,7 @@ def start_server(auth_callback):
91
91
  @cli.command()
92
92
  @click.option(
93
93
  "--host",
94
+ default="https://api.europe-west2.gcp.tinybird.co",
94
95
  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
96
  )
96
97
  @click.option(
@@ -107,10 +108,9 @@ async def login(host: str, auth_host: str, workspace: str):
107
108
  """Authenticate using the browser."""
108
109
  auth_event = threading.Event()
109
110
  auth_code: list[str] = [] # Using a list to store the code, as it's mutable
110
- host = host or "https://api.wadus2.gcp.tinybird.co"
111
111
 
112
112
  def auth_callback(code):
113
- auth_code[0] = code
113
+ auth_code.append(code)
114
114
  auth_event.set()
115
115
 
116
116
  click.echo(FeedbackManager.highlight(message="» Opening browser for authentication..."))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird
3
- Version: 0.0.1.dev53
3
+ Version: 0.0.1.dev55
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -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=yRBGGckfEd47ez8Wv86X_i5w2NuzrJLnctH0B-A-3Po,251
18
+ tinybird/tb/__cli__.py,sha256=_iEgnzR92s7X0xpjQzmE_05CXYvgYyj6isW3jyvfmSU,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=hom-69SKIWSyc-reh424G-eLGYokx7XBLM8Aaa1yS3c,16178
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=wxyxZg8BPiWDgbW5HXJKYQp7_EumBXmAilo3McbCQOo,5916
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=Ezb_7ZK6ym967GNPzuSUH3K6ukAMWXaHb1gFXNet2pA,11859
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=qk7_Xq7X6sR1N858eWhmBZeoMUtZh0y4GtIAsmCqpKY,5740
39
+ tinybird/tb/modules/login.py,sha256=QcSLsIZSSRa60DoeNIaAr2-iyPFupM4NY2MDCyJzyMc,5743
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.dev53.dist-info/METADATA,sha256=XJMz84MQxJCPD0mv_L9ZSpAkb6oHI5i3XnFy-jgSGBw,2482
78
- tinybird-0.0.1.dev53.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
79
- tinybird-0.0.1.dev53.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
80
- tinybird-0.0.1.dev53.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
81
- tinybird-0.0.1.dev53.dist-info/RECORD,,
77
+ tinybird-0.0.1.dev55.dist-info/METADATA,sha256=IaWUHnXuHx0d0JibFfF3pR0cujBTUix1uCTRA8FW6sg,2482
78
+ tinybird-0.0.1.dev55.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
79
+ tinybird-0.0.1.dev55.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
80
+ tinybird-0.0.1.dev55.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
81
+ tinybird-0.0.1.dev55.dist-info/RECORD,,