tinybird 0.0.1.dev171__py3-none-any.whl → 0.0.1.dev173__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/forward/commands'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '0.0.1.dev171'
8
- __revision__ = 'a5eb91f'
7
+ __version__ = '0.0.1.dev173'
8
+ __revision__ = '8bd5be6'
@@ -74,6 +74,7 @@ VERSION = f"{__cli__.__version__} (rev {__cli__.__revision__})"
74
74
  @click.option(
75
75
  "--output", type=click.Choice(["json", "human"], case_sensitive=False), default="human", help="Output format"
76
76
  )
77
+ @click.option("--max-depth", type=int, default=2, help="Maximum depth of the project files.")
77
78
  @click.version_option(version=VERSION)
78
79
  @click.pass_context
79
80
  @coro
@@ -88,6 +89,7 @@ async def cli(
88
89
  cloud: bool,
89
90
  staging: bool,
90
91
  output: str,
92
+ max_depth: int,
91
93
  ) -> None:
92
94
  """
93
95
  Use `OBFUSCATE_REGEX_PATTERN` and `OBFUSCATE_PATTERN_SEPARATOR` environment variables to define a regex pattern and a separator (in case of a single string with multiple regex) to obfuscate secrets in the CLI output.
@@ -148,7 +150,7 @@ async def cli(
148
150
  config = await get_config(host, token, user_token=user_token, config_file=config_temp._path)
149
151
  client = _get_tb_client(config.get("token", None), config["host"])
150
152
  folder = os.path.join(config_temp._path.replace(".tinyb", ""), config.get("cwd", os.getcwd()))
151
- project = Project(folder=folder, workspace_name=config.get("name", ""))
153
+ project = Project(folder=folder, workspace_name=config.get("name", ""), max_depth=max_depth)
152
154
  config["path"] = str(project.path)
153
155
  # If they have passed a token or host as parameter and it's different that record in .tinyb, refresh the workspace id
154
156
  if token or host:
@@ -360,7 +360,15 @@ def deployment_ls(ctx: click.Context, include_deleted: bool) -> None:
360
360
  url += "?include_deleted=true"
361
361
 
362
362
  result = api_fetch(url, HEADERS)
363
- status_map = {"data_ready": "Staging", "failed": "Failed", "deleted": "Deleted"}
363
+ status_map = {
364
+ "calculating": "Creating - Calculating steps",
365
+ "creating_schema": "Creating - Creating schemas",
366
+ "schema_ready": "Creating - Migrating data",
367
+ "data_ready": "Staging",
368
+ "deleting": "Deleting",
369
+ "deleted": "Deleted",
370
+ "failed": "Failed",
371
+ }
364
372
  columns = ["ID", "Status", "Created at"]
365
373
  table = []
366
374
  for deployment in result.get("deployments", []):
@@ -370,7 +378,7 @@ def deployment_ls(ctx: click.Context, include_deleted: bool) -> None:
370
378
  table.append(
371
379
  [
372
380
  deployment.get("id"),
373
- "Live" if deployment.get("live") else status_map.get(deployment.get("status", "In progress")),
381
+ "Live" if deployment.get("live") else status_map.get(deployment.get("status"), "In progress"),
374
382
  datetime.fromisoformat(deployment.get("created_at")).strftime("%Y-%m-%d %H:%M:%S"),
375
383
  ]
376
384
  )
@@ -11,9 +11,10 @@ from tinybird.tb.modules.datafile.parse_pipe import parse_pipe
11
11
  class Project:
12
12
  extensions = ("datasource", "pipe", "connection")
13
13
 
14
- def __init__(self, folder: str, workspace_name: str):
14
+ def __init__(self, folder: str, workspace_name: str, max_depth: int = 2):
15
15
  self.folder = folder
16
16
  self.workspace_name = workspace_name
17
+ self.max_depth = max_depth
17
18
 
18
19
  @property
19
20
  def path(self) -> Path:
@@ -23,10 +24,16 @@ class Project:
23
24
  def vendor_path(self) -> str:
24
25
  return f"{self.path}/vendor"
25
26
 
27
+ def get_files(self, extension: str) -> List[str]:
28
+ project_files: List[str] = []
29
+ for level in range(self.max_depth):
30
+ project_files.extend(glob.glob(f"{self.path}{'/*' * level}/*.{extension}", recursive=True))
31
+ return project_files
32
+
26
33
  def get_project_files(self) -> List[str]:
27
34
  project_files: List[str] = []
28
35
  for extension in self.extensions:
29
- for project_file in glob.glob(f"{self.path}/**/*.{extension}", recursive=True):
36
+ for project_file in self.get_files(extension):
30
37
  if self.vendor_path in project_file:
31
38
  continue
32
39
  project_files.append(project_file)
@@ -51,13 +58,13 @@ class Project:
51
58
  return sorted([Path(f).stem for f in self.get_connection_files()])
52
59
 
53
60
  def get_datasource_files(self) -> List[str]:
54
- return glob.glob(f"{self.path}/**/*.datasource", recursive=True)
61
+ return self.get_files("datasource")
55
62
 
56
63
  def get_pipe_files(self) -> List[str]:
57
- return glob.glob(f"{self.path}/**/*.pipe", recursive=True)
64
+ return self.get_files("pipe")
58
65
 
59
66
  def get_connection_files(self) -> List[str]:
60
- return glob.glob(f"{self.path}/**/*.connection", recursive=True)
67
+ return self.get_files("connection")
61
68
 
62
69
  def get_pipe_datafile(self, filename: str) -> Optional[Datafile]:
63
70
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev171
3
+ Version: 0.0.1.dev173
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -12,21 +12,21 @@ 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=X4tE9OrfaUy6kO9cqVEzyI9cDcmOF3IAssRRzsTsfEQ,40781
15
- tinybird/tb/__cli__.py,sha256=hKG-5atm5V0pGi635mfMITsiz00-mtLOQQlbU2c3LwA,247
15
+ tinybird/tb/__cli__.py,sha256=SrFvAorASXALWf_bfYHBUAINND0hsASCiFTXRXjKQbU,247
16
16
  tinybird/tb/check_pypi.py,sha256=rW4QmDRbtgKdUUwJCnBkVjmTjZSZGN-XgZhx7vMkC0w,1009
17
17
  tinybird/tb/cli.py,sha256=u3eGOhX0MHkuT6tiwaZ0_3twqLmqKXDAOxF7yV_Nn9Q,1075
18
18
  tinybird/tb/client.py,sha256=CSBl_JRuioPyY0H8Ac96dJ9wQXDXfrvK2lwqlOxKGoY,55715
19
19
  tinybird/tb/config.py,sha256=jT9xndpeCY_g0HdB5qE2EquC0TFRRnkPnQFWZWd04jo,3998
20
20
  tinybird/tb/modules/build.py,sha256=zakH5812Lop-XHjGmDRdOPeofPtoeyb_2un_T6e50xw,19177
21
21
  tinybird/tb/modules/cicd.py,sha256=MnShTTJzKBYeajswF2jg7p7ZzupaeCgSriAN05MeEdg,7330
22
- tinybird/tb/modules/cli.py,sha256=3gDO1smcH1e2qEvbFCGbo4oNdgubDr3hC3fsKlB4ylY,15373
22
+ tinybird/tb/modules/cli.py,sha256=cAogyZWCYIPhjgbTlhqj2omq-1OLLhiT105_i42M9mM,15508
23
23
  tinybird/tb/modules/common.py,sha256=lu1Z3VYImwocaHvqOW2FzBJP6F3Ev7RuXsItkCZ6jpo,83237
24
24
  tinybird/tb/modules/config.py,sha256=ziqW_t_mRVvWOd85VoB4vKyvgMkEfpXDf9H4v38p2xc,11422
25
25
  tinybird/tb/modules/connection.py,sha256=7oOR7x4PhBcm1ETFFCH2YJ_3oeGXjAbmx1cnZX9_L70,9014
26
26
  tinybird/tb/modules/copy.py,sha256=2Mm4FWKehOG7CoOhiF1m9UZJgJn0W1_cMolqju8ONYg,5805
27
27
  tinybird/tb/modules/create.py,sha256=_s_vdb9pjq1ORajE_gFMxSGVuns1imNgiD5H8KuI2gQ,17231
28
28
  tinybird/tb/modules/datasource.py,sha256=V314rkpdVxVMjsp5qcSCTqDlmp4Vu--qM07BoWh-aqs,17783
29
- tinybird/tb/modules/deployment.py,sha256=z2xK8EwKbx_a-rIOxIo3o_IQibcBASOaFfeWWosQFhs,26841
29
+ tinybird/tb/modules/deployment.py,sha256=j-6zGvlAlr__ERRJg98-jEtwpR3ZbUJQeRJIj5YS94I,27070
30
30
  tinybird/tb/modules/deprecations.py,sha256=rrszC1f_JJeJ8mUxGoCxckQTJFBCR8wREf4XXXN-PRc,4507
31
31
  tinybird/tb/modules/dev_server.py,sha256=57FCKuWpErwYUYgHspYDkLWEm9F4pbvVOtMrFXX1fVU,10129
32
32
  tinybird/tb/modules/endpoint.py,sha256=XySDt3pk66vxOZ0egUfz4bY8bEk3BjOXkv-L0OIJ3sc,12083
@@ -45,7 +45,7 @@ tinybird/tb/modules/materialization.py,sha256=QJX5kCPhhm6IXBO1JsalVfbQdypCe_eOUD
45
45
  tinybird/tb/modules/mock.py,sha256=IyHweMUM6bUH8IhyiX2tTMpdVpTFUeAJ41lZ5P42-HQ,5303
46
46
  tinybird/tb/modules/open.py,sha256=OuctINN77oexpSjth9uoIZPCelKO4Li-yyVxeSnk1io,1371
47
47
  tinybird/tb/modules/pipe.py,sha256=AQKEDagO6e3psPVjJkS_MDbn8aK-apAiLp26k7jgAV0,2432
48
- tinybird/tb/modules/project.py,sha256=yENgJAqRx_eH_n7qalPMWWMZpjEWhAf0CMfGM6ChQrM,3220
48
+ tinybird/tb/modules/project.py,sha256=_UWO79zhh2H0UA9F0wpKXYaylFPdjhGNmNAjIOSBvT8,3425
49
49
  tinybird/tb/modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
50
50
  tinybird/tb/modules/secret.py,sha256=WsqzxxLh9W_jkuHL2JofMXdIJy0lT5WEI-7bQSIDgAc,2921
51
51
  tinybird/tb/modules/shell.py,sha256=Zd_4Ak_5tKVX-cw6B4ag36xZeEGHeh-jZpAsIXkoMoE,14116
@@ -80,8 +80,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
80
80
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
81
81
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
82
82
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
83
- tinybird-0.0.1.dev171.dist-info/METADATA,sha256=DZAvrAPILrw9XpHmGv6LUrVlhFvm7Qy_57YsHR2sA_U,1607
84
- tinybird-0.0.1.dev171.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
- tinybird-0.0.1.dev171.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
- tinybird-0.0.1.dev171.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
- tinybird-0.0.1.dev171.dist-info/RECORD,,
83
+ tinybird-0.0.1.dev173.dist-info/METADATA,sha256=1_iiQus7JvB3NxLygHs4ZBhHpfcgqz0xnAsuSEiJhLA,1607
84
+ tinybird-0.0.1.dev173.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
+ tinybird-0.0.1.dev173.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
+ tinybird-0.0.1.dev173.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
+ tinybird-0.0.1.dev173.dist-info/RECORD,,