tinybird-cli 3.9.1.dev4__py3-none-any.whl → 3.9.1.dev6__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.
tinybird/__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__ = '3.9.1.dev4'
8
- __revision__ = '6fbd338'
7
+ __version__ = '3.9.1.dev6'
8
+ __revision__ = '00f0cad'
tinybird/client.py CHANGED
@@ -588,6 +588,9 @@ class TinyB(object):
588
588
  params = {**params} if params else {}
589
589
  return await self._req(f"/v0/pipes/{pipe_name_or_id}/sink?{urlencode(params)}", method="POST")
590
590
 
591
+ async def pipe_unlink_materialized(self, pipe_name: str, node_id: str):
592
+ return await self._req(f"/v0/pipes/{pipe_name}/nodes/{node_id}/materialization", method="DELETE")
593
+
591
594
  async def query(self, sql: str, pipeline: Optional[str] = None):
592
595
  params = {}
593
596
  if pipeline:
tinybird/datafile.py CHANGED
@@ -2943,20 +2943,18 @@ async def new_ds(
2943
2943
  for tk in ds["tokens"]:
2944
2944
  token_name = tk["token_name"]
2945
2945
  t = await client.get_token_by_name(token_name)
2946
- if t:
2947
- break
2948
- if not t:
2949
- token_name = tk["token_name"]
2950
- click.echo(FeedbackManager.info_create_not_found_token(token=token_name))
2951
- # DS == token_origin.Origins.DATASOURCE
2952
- await client.create_token(token_name, f"DATASOURCES:{tk['permissions']}:{ds_name}", "DS", ds_name)
2953
- else:
2954
- click.echo(FeedbackManager.info_create_found_token(token=token_name))
2955
- scopes = [f"DATASOURCES:{tk['permissions']}:{ds_name}"]
2956
- for x in t["scopes"]:
2957
- sc = x["type"] if "resource" not in x else f"{x['type']}:{x['resource']}"
2958
- scopes.append(sc)
2959
- await client.alter_tokens(token_name, scopes)
2946
+ if not t:
2947
+ token_name = tk["token_name"]
2948
+ click.echo(FeedbackManager.info_create_not_found_token(token=token_name))
2949
+ # DS == token_origin.Origins.DATASOURCE
2950
+ await client.create_token(token_name, f"DATASOURCES:{tk['permissions']}:{ds_name}", "DS", ds_name)
2951
+ else:
2952
+ click.echo(FeedbackManager.info_create_found_token(token=token_name))
2953
+ scopes = [f"DATASOURCES:{tk['permissions']}:{ds_name}"]
2954
+ for x in t["scopes"]:
2955
+ sc = x["type"] if "resource" not in x else f"{x['type']}:{x['resource']}"
2956
+ scopes.append(sc)
2957
+ await client.alter_tokens(token_name, scopes)
2960
2958
 
2961
2959
  try:
2962
2960
  existing_ds = await client.get_datasource(ds_name)
@@ -643,6 +643,9 @@ Ready? """
643
643
  info_materialized_datasource_used = info_message(
644
644
  "** Materialized pipe '{pipe}' using the Data Source '{datasource}'"
645
645
  )
646
+ info_materialized_unlinking_pipe = info_message("** Unlinking materialized pipe {pipe}")
647
+ info_materialized_unlinking_pipe_not_found = info_message("** {pipe} not found")
648
+ info_materialized_dry_unlinking_pipe = info_message("** [DRY RUN] Unlinking materialized pipe {pipe}")
646
649
  info_copy_datasource_created = info_message("** Copy pipe '{pipe}' created the Data Source '{datasource}'")
647
650
  info_copy_datasource_used = info_message("** Copy pipe '{pipe}' using the Data Source '{datasource}'")
648
651
  info_no_pipes_stats = info_message("** No pipe stats")
@@ -9,6 +9,7 @@ import click
9
9
  from click import Context
10
10
 
11
11
  from tinybird.client import CanNotBeDeletedException, DoesNotExistException, TinyB
12
+ from tinybird.datafile import PipeTypes
12
13
  from tinybird.feedback_manager import FeedbackManager
13
14
  from tinybird.tb_cli_modules.cli import cli
14
15
  from tinybird.tb_cli_modules.common import (
@@ -137,8 +138,27 @@ async def clear_workspace(ctx: Context, yes: bool, dry_run: bool) -> None:
137
138
  echo_safe_humanfriendly_tables_format_smart_table(table, column_names=columns)
138
139
 
139
140
  if yes or click.confirm(FeedbackManager.warning_confirm_clear_workspace()):
140
- pipes = await client.pipes(dependencies=False, node_attrs="name", attrs="name")
141
+ pipes = await client.pipes(dependencies=False, node_attrs="id,name,materialized", attrs="name,type")
141
142
  pipe_names = [pipe["name"] for pipe in pipes]
143
+
144
+ for pipe in pipes:
145
+ if pipe["type"] == PipeTypes.MATERIALIZED:
146
+ if not dry_run:
147
+ node_id = None
148
+ for node in pipe["nodes"]:
149
+ if "materialized" in node and node["materialized"] is not None:
150
+ node_id = node["id"]
151
+ break
152
+
153
+ if node_id:
154
+ click.echo(FeedbackManager.info_materialized_unlinking_pipe(pipe=pipe["name"]))
155
+ try:
156
+ await client.pipe_unlink_materialized(pipe["name"], node_id)
157
+ except DoesNotExistException:
158
+ click.echo(FeedbackManager.info_materialized_unlinking_pipe_not_found(pipe=pipe["name"]))
159
+ else:
160
+ click.echo(FeedbackManager.info_materialized_dry_unlinking_pipe(pipe=pipe["name"]))
161
+
142
162
  for pipe_name in pipe_names:
143
163
  if not dry_run:
144
164
  click.echo(FeedbackManager.info_removing_pipe(pipe=pipe_name))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 3.9.1.dev4
3
+ Version: 3.9.1.dev6
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -51,6 +51,15 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
51
51
  Changelog
52
52
  ----------
53
53
 
54
+ 3.9.1.dev6
55
+ ************
56
+
57
+ - `Added` Support for unlink materialized pipes doing `tb workspace clear`
58
+
59
+ 3.9.1.dev5
60
+ ************
61
+
62
+ - `Added` support for adding multiple tokens when pushing a `.datasource` file
54
63
 
55
64
  3.9.1.dev4
56
65
  ************
@@ -1,12 +1,12 @@
1
- tinybird/__cli__.py,sha256=k79JQ_iAFXk9PG8us7DVlIqfa3URwgmNhI2vSZnCm1E,254
1
+ tinybird/__cli__.py,sha256=LXmvo9x6RuYnS_w6BxDGTReR5KQ7unvj8xHQMuvb9FY,254
2
2
  tinybird/check_pypi.py,sha256=_4NkharLyR_ELrAdit-ftqIWvOf7jZNPt3i76frlo9g,975
3
- tinybird/client.py,sha256=bwcjq8RQDZvrrcKdkp0B72w2_AGMEo1rSUBvtF1udes,46735
3
+ tinybird/client.py,sha256=S7nKDUoq7AnAunZuikqrs9yjC3j_rseWeyGVwXHCiTI,46918
4
4
  tinybird/config.py,sha256=E0jDwbFD1zhdijNhtF8fg6mqIyKbZ8xpNPP_3n2PFpE,2003
5
5
  tinybird/connectors.py,sha256=lkpVSUmSuViEZBa4QjTK7YmPHUop0a5UFoTrSmlVq6k,15244
6
6
  tinybird/context.py,sha256=-abzcFxtsoPtUHbtsgdIaUZSUtS1At8_3gepjlO-GLQ,845
7
- tinybird/datafile.py,sha256=L_WeRYoy11HFERcS8VCkJDFmCXWZh1RFrmdeQKpDmdE,212510
7
+ tinybird/datafile.py,sha256=druOmDFld2aciEstr5T5rHBYER3j0_Dbf5y1BfSkEXU,212518
8
8
  tinybird/datatypes.py,sha256=adYOQBTyfeBGVINIlaRex_81gTQQuqF2M9VTQpzq1H0,7060
9
- tinybird/feedback_manager.py,sha256=MDgfmdoouQ7HfF-JX20796fDJv5y_sIAGqBsnqBcfaQ,59638
9
+ tinybird/feedback_manager.py,sha256=orxhazvFGANh9_ZipccBXdWsqDEPDXzAlfJxkwKoWLQ,59923
10
10
  tinybird/git_settings.py,sha256=vu8sWb3TAXeM8Tqy27aR0el8MnPm7kqQzTRV76xB0ro,4707
11
11
  tinybird/sql.py,sha256=hUnpfmkRkdyZV2ylIYflzxnwyv5Es7fLEv6cBc39OJA,41589
12
12
  tinybird/sql_template.py,sha256=zyayaz7jiXnPsY-dyiyW0HVXVSH6zkMVOo9ARceUei8,81435
@@ -32,12 +32,12 @@ tinybird/tb_cli_modules/regions.py,sha256=tRwy7uWbTqhhhO9JpIu0fkF1n-KRQAtGy8otPQ
32
32
  tinybird/tb_cli_modules/telemetry.py,sha256=YgHU-osP034xN9LZC4iaakkdfKJCWqPYDGPZFrrZfPI,10490
33
33
  tinybird/tb_cli_modules/test.py,sha256=NzFWa3EqPrpNvwBggUQYI9d0LqWcCKpSpkD22cvqhOQ,4223
34
34
  tinybird/tb_cli_modules/token.py,sha256=ZGUUX8x6Qk9214L4wSmFw5FsP5ht_iuIrKDBkpaT8Bc,4383
35
- tinybird/tb_cli_modules/workspace.py,sha256=NDHINzW3SBo8FcWH8Bx-DCeUXQ8YUJX6FW8cGmESnLc,10081
35
+ tinybird/tb_cli_modules/workspace.py,sha256=DTIQ1-H5Kazz1CtRwqMeYAtyQ_BQtaLXfcHnI9Ujj-c,11064
36
36
  tinybird/tb_cli_modules/workspace_members.py,sha256=3HzY43218fb35ZM81mtkwDQe7gAAf1zEFY6kIEhGvgE,8268
37
37
  tinybird/tb_cli_modules/tinyunit/tinyunit.py,sha256=0dYYmZMMJVubxSPls2e_a-fqtUYvgLfu2B0xwLfkbHw,11667
38
38
  tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py,sha256=j92za8QbXrv4eIPjKBZPn9ghR-nYQ2wZZ88MeXyMWXE,1868
39
- tinybird_cli-3.9.1.dev4.dist-info/METADATA,sha256=3XoKqNMbNI93Q1R4hds2gHLVXlWYzSqwfjZ75GLn08s,70269
40
- tinybird_cli-3.9.1.dev4.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
41
- tinybird_cli-3.9.1.dev4.dist-info/entry_points.txt,sha256=PKPKuPmA4IfJYnCFHHUiw-aAWZuBomFvwCklv1OyCjE,43
42
- tinybird_cli-3.9.1.dev4.dist-info/top_level.txt,sha256=pgw6AzERHBcW3YTi2PW4arjxLkulk2msOz_SomfOEuc,45
43
- tinybird_cli-3.9.1.dev4.dist-info/RECORD,,
39
+ tinybird_cli-3.9.1.dev6.dist-info/METADATA,sha256=Ok40ZUaKmOj2xqLZ3Ai4R4jvA4i6d5mCCNhnK81-9FM,70474
40
+ tinybird_cli-3.9.1.dev6.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
41
+ tinybird_cli-3.9.1.dev6.dist-info/entry_points.txt,sha256=PKPKuPmA4IfJYnCFHHUiw-aAWZuBomFvwCklv1OyCjE,43
42
+ tinybird_cli-3.9.1.dev6.dist-info/top_level.txt,sha256=pgw6AzERHBcW3YTi2PW4arjxLkulk2msOz_SomfOEuc,45
43
+ tinybird_cli-3.9.1.dev6.dist-info/RECORD,,