tinybird 0.0.1.dev137__py3-none-any.whl → 0.0.1.dev138__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.dev137'
8
- __revision__ = '753bb28'
7
+ __version__ = '0.0.1.dev138'
8
+ __revision__ = '7227da7'
@@ -193,6 +193,11 @@ def append_fixture(
193
193
  datasource_name: str,
194
194
  url: str,
195
195
  ):
196
+ # Append fixtures only if the datasource is empty
197
+ data = asyncio.run(tb_client._req(f"/v0/datasources/{datasource_name}"))
198
+ if data.get("statistics", {}).get("row_count", 0) > 0:
199
+ return
200
+
196
201
  asyncio.run(
197
202
  push_data(
198
203
  tb_client,
@@ -63,7 +63,6 @@ VERSION = f"{__cli__.__version__} (rev {__cli__.__revision__})"
63
63
  @click.option("--host", help="Use custom host, defaults to TB_HOST envvar, then to https://api.tinybird.co")
64
64
  @click.option("--show-tokens", is_flag=True, default=False, help="Enable the output of tokens.")
65
65
  @click.option("--cloud/--local", is_flag=True, default=False, help="Run against cloud or local.")
66
- @click.option("--build", is_flag=True, default=False, help="Run against build mode.")
67
66
  @click.option("--staging", is_flag=True, default=False, help="Run against a staging deployment.")
68
67
  @click.version_option(version=VERSION)
69
68
  @click.pass_context
@@ -76,14 +75,13 @@ async def cli(
76
75
  host: str,
77
76
  show_tokens: bool,
78
77
  cloud: bool,
79
- build: bool,
80
78
  staging: bool,
81
79
  ) -> None:
82
80
  """
83
81
  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.
84
82
  """
85
83
  # We need to unpatch for our tests not to break
86
- if show_tokens or not cloud or ctx.invoked_subcommand == "build" or build:
84
+ if show_tokens or not cloud or ctx.invoked_subcommand == "build":
87
85
  __unpatch_click_output()
88
86
  else:
89
87
  __patch_click_output()
@@ -139,13 +137,13 @@ async def cli(
139
137
  if "--help" in sys.argv or "-h" in sys.argv:
140
138
  return
141
139
 
142
- client = await create_ctx_client(ctx, config, cloud, build, staging)
140
+ client = await create_ctx_client(ctx, config, cloud, staging)
143
141
 
144
142
  if client:
145
143
  ctx.ensure_object(dict)["client"] = client
146
144
 
147
145
  ctx.ensure_object(dict)["project"] = project
148
- ctx.ensure_object(dict)["env"] = get_target_env(cloud, build)
146
+ ctx.ensure_object(dict)["env"] = get_target_env(cloud)
149
147
 
150
148
 
151
149
  @cli.command(hidden=True)
@@ -295,35 +293,28 @@ def __unpatch_click_output():
295
293
  click.secho = __old_click_secho
296
294
 
297
295
 
298
- async def create_ctx_client(ctx: Context, config: Dict[str, Any], cloud: bool, build: bool, staging: bool):
296
+ async def create_ctx_client(ctx: Context, config: Dict[str, Any], cloud: bool, staging: bool):
299
297
  commands_without_ctx_client = ["auth", "check", "local", "login", "logout", "update", "upgrade"]
300
298
  command = ctx.invoked_subcommand
301
299
  if command in commands_without_ctx_client:
302
300
  return None
303
301
 
304
302
  commands_always_cloud = ["pull", "infra"]
305
- commands_always_build = ["build", "test", "dev", "create"]
306
- commands_always_local: List[str] = []
307
- if (
308
- (cloud or command in commands_always_cloud)
309
- and command not in commands_always_local
310
- and command not in commands_always_build
311
- ):
303
+ commands_always_local = ["build", "test", "dev", "create"]
304
+ if (cloud or command in commands_always_cloud) and command not in commands_always_local:
312
305
  click.echo(
313
306
  FeedbackManager.gray(message=f"Running against Tinybird Cloud: Workspace {config.get('name', 'default')}")
314
307
  )
315
308
  return _get_tb_client(config.get("token", None), config["host"], staging=staging)
316
- build = command in commands_always_build or build
317
- if not build and command not in commands_always_local and command not in commands_always_build:
309
+ local = command in commands_always_local
310
+ if not local and command not in commands_always_local and command:
318
311
  click.echo(FeedbackManager.gray(message="Running against Tinybird Local"))
319
- return await get_tinybird_local_client(config, build=build, staging=staging)
312
+ return await get_tinybird_local_client(config, staging=staging)
320
313
 
321
314
 
322
- def get_target_env(cloud: bool, build: bool) -> str:
315
+ def get_target_env(cloud: bool) -> str:
323
316
  if cloud:
324
317
  return "cloud"
325
- if build:
326
- return "build"
327
318
  return "local"
328
319
 
329
320
 
@@ -16,14 +16,14 @@ TB_LOCAL_PORT = int(os.getenv("TB_LOCAL_PORT", 7181))
16
16
  TB_LOCAL_HOST = f"http://localhost:{TB_LOCAL_PORT}"
17
17
 
18
18
 
19
- async def get_tinybird_local_client(config_obj: Dict[str, Any], build: bool = False, staging: bool = False) -> TinyB:
19
+ async def get_tinybird_local_client(config_obj: Dict[str, Any], staging: bool = False) -> TinyB:
20
20
  """Get a Tinybird client connected to the local environment."""
21
21
 
22
- config = await get_tinybird_local_config(config_obj, build=build)
22
+ config = await get_tinybird_local_config(config_obj)
23
23
  return config.get_client(host=TB_LOCAL_HOST, staging=staging)
24
24
 
25
25
 
26
- async def get_tinybird_local_config(config_obj: Dict[str, Any], build: bool = False) -> CLIConfig:
26
+ async def get_tinybird_local_config(config_obj: Dict[str, Any]) -> CLIConfig:
27
27
  """Craft a client config with a workspace name based on the path of the project files
28
28
 
29
29
  It uses the tokens from tinybird local
@@ -45,7 +45,7 @@ async def get_tinybird_local_config(config_obj: Dict[str, Any], build: bool = Fa
45
45
  # Create a new workspace if path is provided. This is used to isolate the build in a different workspace.
46
46
  if path:
47
47
  user_client = config.get_client(host=TB_LOCAL_HOST, token=user_token)
48
- ws_name = get_build_workspace_name(path) if build else config.get("name") or config_obj.get("name")
48
+ ws_name = config.get("name") or config_obj.get("name") or get_build_workspace_name(path)
49
49
  if not ws_name:
50
50
  raise AuthNoTokenException()
51
51
 
@@ -198,7 +198,7 @@ class Shell:
198
198
  self.history = self.get_history()
199
199
  self.project = project
200
200
  self.tb_client = tb_client
201
- self.env = "cloud" if playground else "build"
201
+ self.env = "cloud" if playground else "local"
202
202
  self.prompt_message = "\ntb » "
203
203
  self.session: PromptSession = PromptSession(
204
204
  completer=DynamicCompleter(project),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev137
3
+ Version: 0.0.1.dev138
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -12,14 +12,14 @@ 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=EBpq5LaRd17x5Ks0YpwQ_fjDohINCdUD6PuDTqzPCsA,252
15
+ tinybird/tb/__cli__.py,sha256=M_bmCKHvq5S9ITtwM-5LU6_JIOq2Qxrq0mjHt4NyntM,252
16
16
  tinybird/tb/cli.py,sha256=Xw5EhwCQu6Xx55DzoJsZJODdi7tkA391mii-xgGnpEU,1066
17
17
  tinybird/tb/client.py,sha256=aaPKq5C77e72kR7IMv9WrvnvNki8mKMOTi9EsCp0eUc,55962
18
18
  tinybird/tb/config.py,sha256=HLMHbJg6BjeGZ2KiJA-BCCVnk8w959xsSaDEEePakZg,3981
19
19
  tinybird/tb/modules/auth.py,sha256=_OeYnmTH83lnqCgQEdS6K0bx1KBUeRmZk2M7JnRmWpk,9037
20
- tinybird/tb/modules/build.py,sha256=ohHiYwygJtldWsina-2QpvIt-g2hIqOkm5BEnh4JhdA,17187
20
+ tinybird/tb/modules/build.py,sha256=5SX59ssq0KaRrgzk21KmYUnB6xOdQ_O59n7rxFBQQ1Y,17393
21
21
  tinybird/tb/modules/cicd.py,sha256=Ug7LijuHDIqKR6rm8OLZispWp75Zv6TyonAme8K9jaI,7114
22
- tinybird/tb/modules/cli.py,sha256=Y_5hu9xwyTIZw4bQoe0MYLnRIzmR7hUjql_oZBxd4Qg,13407
22
+ tinybird/tb/modules/cli.py,sha256=qz12sIfTYbFVIADJGyb1HXrHP4S7KudVSv7YKP0pPzw,13052
23
23
  tinybird/tb/modules/common.py,sha256=jThkqkIJ_blXXUZ2-3HdjG1dpLKOCE_TjXA0jSesIx0,85712
24
24
  tinybird/tb/modules/config.py,sha256=ziqW_t_mRVvWOd85VoB4vKyvgMkEfpXDf9H4v38p2xc,11422
25
25
  tinybird/tb/modules/connection.py,sha256=bFolBbKjGMEs9CS_S74KLy-x-IlrhU0HNEmAeMywU00,9373
@@ -35,7 +35,7 @@ tinybird/tb/modules/job.py,sha256=n4dSSBgnA8NqD7srGahf2xRj6wxkmX9Vl0J-QJ_a2w0,29
35
35
  tinybird/tb/modules/llm.py,sha256=KfsCYmKeW1VQz0iDZhGKCRkQv_Y3kTHh6JuxvofOguE,1076
36
36
  tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
37
37
  tinybird/tb/modules/local.py,sha256=-oXIeVXjzdfxVPQaXw68YyQOb48EFQZeUys8_U0xePs,11300
38
- tinybird/tb/modules/local_common.py,sha256=lyJ8vIFsDcVGYbfoCEBNgkwROsF5YJovxME1CRykEj8,3321
38
+ tinybird/tb/modules/local_common.py,sha256=Fr3U4_xqtH4AzHPo-y75dOrXlE-kC7DeC55oKeC-PMo,3255
39
39
  tinybird/tb/modules/login.py,sha256=8oybH3rwTqNrHx0gN2zG-9MGSYsKwLuD2hKZsKJtrQA,7152
40
40
  tinybird/tb/modules/logout.py,sha256=ULooy1cDBD02-r7voZmhV7udA0ML5tVuflJyShrh56Y,1022
41
41
  tinybird/tb/modules/materialization.py,sha256=QJX5kCPhhm6IXBO1JsalVfbQdypCe_eOUDZ_WHJZWS8,5478
@@ -45,7 +45,7 @@ tinybird/tb/modules/pipe.py,sha256=AQKEDagO6e3psPVjJkS_MDbn8aK-apAiLp26k7jgAV0,2
45
45
  tinybird/tb/modules/project.py,sha256=RdVOzJiuFPqkCzPhzGetbgcFeiMEn9IMviFCG58XKgI,3142
46
46
  tinybird/tb/modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
47
47
  tinybird/tb/modules/secret.py,sha256=WsqzxxLh9W_jkuHL2JofMXdIJy0lT5WEI-7bQSIDgAc,2921
48
- tinybird/tb/modules/shell.py,sha256=cvT0EKpnSRHfuo3avykBRMsCwLBqmzSR7sNUdbQ6lXA,14116
48
+ tinybird/tb/modules/shell.py,sha256=Zd_4Ak_5tKVX-cw6B4ag36xZeEGHeh-jZpAsIXkoMoE,14116
49
49
  tinybird/tb/modules/table.py,sha256=4XrtjM-N0zfNtxVkbvLDQQazno1EPXnxTyo7llivfXk,11035
50
50
  tinybird/tb/modules/tag.py,sha256=anPmMUBc-TbFovlpFi8GPkKA18y7Y0GczMsMms5TZsU,3502
51
51
  tinybird/tb/modules/telemetry.py,sha256=IHHks8-jnrkyQIY_Y6ZmU8hdVHMGSS0pkSUOgCPcYY8,11346
@@ -78,8 +78,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
78
78
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
79
79
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
80
80
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
81
- tinybird-0.0.1.dev137.dist-info/METADATA,sha256=RM3cD0Kpj8AT48Q5evBIZKWjUgPxR6QOL3dSukKlU3k,1612
82
- tinybird-0.0.1.dev137.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
83
- tinybird-0.0.1.dev137.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
84
- tinybird-0.0.1.dev137.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
85
- tinybird-0.0.1.dev137.dist-info/RECORD,,
81
+ tinybird-0.0.1.dev138.dist-info/METADATA,sha256=UVhEU13bfT_6dqzdaLcZFG4iJmlzS0V7pS-fzfFM0ZE,1612
82
+ tinybird-0.0.1.dev138.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
83
+ tinybird-0.0.1.dev138.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
84
+ tinybird-0.0.1.dev138.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
85
+ tinybird-0.0.1.dev138.dist-info/RECORD,,