tinybird-cli 5.8.2.dev1__tar.gz → 5.8.2.dev3__tar.gz

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.
Files changed (48) hide show
  1. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/PKG-INFO +14 -3
  2. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/__cli__.py +2 -2
  3. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/config.py +9 -1
  4. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/datafile.py +26 -10
  5. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/sql_template.py +3 -3
  6. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/auth.py +7 -8
  7. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/cli.py +3 -8
  8. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird_cli.egg-info/PKG-INFO +14 -3
  9. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/setup.cfg +0 -0
  10. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/ch_utils/constants.py +0 -0
  11. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/ch_utils/engine.py +0 -0
  12. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/check_pypi.py +0 -0
  13. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/client.py +0 -0
  14. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/connectors.py +0 -0
  15. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/context.py +0 -0
  16. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/datatypes.py +0 -0
  17. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/feedback_manager.py +0 -0
  18. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/git_settings.py +0 -0
  19. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/sql.py +0 -0
  20. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/sql_template_fmt.py +0 -0
  21. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/sql_toolset.py +0 -0
  22. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/syncasync.py +0 -0
  23. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli.py +0 -0
  24. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/branch.py +0 -0
  25. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/cicd.py +0 -0
  26. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/common.py +0 -0
  27. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/config.py +0 -0
  28. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/connection.py +0 -0
  29. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/datasource.py +0 -0
  30. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/exceptions.py +0 -0
  31. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/fmt.py +0 -0
  32. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/job.py +0 -0
  33. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/pipe.py +0 -0
  34. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/regions.py +0 -0
  35. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/tag.py +0 -0
  36. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/telemetry.py +0 -0
  37. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/test.py +0 -0
  38. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  39. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  40. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/token.py +0 -0
  41. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/workspace.py +0 -0
  42. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  43. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird/tornado_template.py +0 -0
  44. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird_cli.egg-info/SOURCES.txt +0 -0
  45. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird_cli.egg-info/dependency_links.txt +0 -0
  46. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird_cli.egg-info/entry_points.txt +0 -0
  47. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird_cli.egg-info/requires.txt +0 -0
  48. {tinybird-cli-5.8.2.dev1 → tinybird-cli-5.8.2.dev3}/tinybird_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 5.8.2.dev1
3
+ Version: 5.8.2.dev3
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -18,15 +18,26 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
18
18
  Changelog
19
19
  ----------
20
20
 
21
+ 5.8.2.dev3
22
+ ***********
23
+
24
+ - `Changed` `tb auth info` and `tb auth ls` now show the region API host properly.
25
+
26
+
27
+ 5.8.2.dev2
28
+ ***********
29
+
30
+ - `Changed` `tb pull` has a new `--fmt` flag to apply the same formatting as `tb fmt` when pulling a datafile.
31
+
21
32
  5.8.2.dev1
22
33
  ***********
23
34
 
24
- - `Removed` missleading output message when `tb auth --token` with TB_TOKEN env var also defined
35
+ - `Removed` misleading output message when `tb auth --token` with TB_TOKEN env var also defined.
25
36
 
26
37
  5.8.1
27
38
  ***********
28
39
 
29
- - `Improved` error message of `tb push` when pushing .datasource files
40
+ - `Improved` error message of `tb push` when pushing .datasource files.
30
41
 
31
42
  5.8.0
32
43
  **********
@@ -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__ = '5.8.2.dev1'
8
- __revision__ = '7f32dbe'
7
+ __version__ = '5.8.2.dev3'
8
+ __revision__ = '8d7d798'
@@ -35,6 +35,10 @@ LEGACY_HOSTS = {
35
35
  "https://api.wadus4.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus4",
36
36
  "https://api.wadus5.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus5",
37
37
  "https://api.wadus6.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus6",
38
+ "https://api.wadus1.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus1",
39
+ "https://api.wadus2.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus2",
40
+ "https://api.wadus3.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus3",
41
+ "https://api.wadus4.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus4",
38
42
  "https://ui.tinybird.co": "https://app.tinybird.co/gcp/europe-west3",
39
43
  "https://ui.us-east.tinybird.co": "https://app.tinybird.co/gcp/us-east4",
40
44
  "https://ui.us-east.aws.tinybird.co": "https://app.tinybird.co/aws/us-east-1",
@@ -48,9 +52,13 @@ LEGACY_HOSTS = {
48
52
  "https://inditex-rt-pro.tinybird.co": "https://app.inditex.tinybird.co/gcp/inditex-rt-pro",
49
53
  "https://inditex-pro.tinybird.co": "https://app.inditex.tinybird.co/gcp/inditex-pro",
50
54
  "https://ui.split.tinybird.co": "https://app.tinybird.co/aws/split-us-east",
51
- "https://ui.split.us-west-2.aws.tinybird.co": "https://app.tinybird.co/aws/aws/split-us-west-2",
55
+ "https://ui.split.us-west-2.aws.tinybird.co": "https://app.tinybird.co/aws/split-us-west-2",
52
56
  "https://ui.split.azure.tinybird.co": "https://app.tinybird.co/azure/split-us-east",
53
57
  "https://ui.split-westeurope.azure.tinybird.co": "https://app.tinybird.co/azure/split-westeurope",
58
+ "https://api.split.tinybird.co": "https://app.tinybird.co/aws/split-us-east",
59
+ "https://api.split.us-west-2.aws.tinybird.co": "https://app.tinybird.co/aws/split-us-west-2",
60
+ "https://api.split.azure.tinybird.co": "https://app.tinybird.co/azure/split-us-east",
61
+ "https://api.split-westeurope.azure.tinybird.co": "https://app.tinybird.co/azure/split-westeurope",
54
62
  "https://ui.wadus1.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus1",
55
63
  "https://ui.wadus2.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus2",
56
64
  "https://ui.wadus3.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus3",
@@ -4788,11 +4788,12 @@ async def format_datasource(
4788
4788
  datafile: Optional[Datafile] = None,
4789
4789
  for_deploy_diff: bool = False,
4790
4790
  skip_eval: bool = False,
4791
+ content: Optional[str] = None,
4791
4792
  ) -> str:
4792
4793
  if datafile:
4793
4794
  doc = datafile
4794
4795
  else:
4795
- doc = parse_datasource(filename, replace_includes=replace_includes, skip_eval=skip_eval)
4796
+ doc = parse_datasource(filename, replace_includes=replace_includes, skip_eval=skip_eval, content=content)
4796
4797
 
4797
4798
  file_parts: List[str] = []
4798
4799
  if for_diff:
@@ -5031,17 +5032,18 @@ async def format_node(
5031
5032
 
5032
5033
  async def format_pipe(
5033
5034
  filename: str,
5034
- line_length: Optional[int],
5035
+ line_length: Optional[int] = DEFAULT_FMT_LINE_LENGTH,
5035
5036
  unroll_includes: bool = False,
5036
5037
  replace_includes: bool = False,
5037
5038
  datafile: Optional[Datafile] = None,
5038
5039
  for_deploy_diff: bool = False,
5039
5040
  skip_eval: bool = False,
5041
+ content: Optional[str] = None,
5040
5042
  ) -> str:
5041
5043
  if datafile:
5042
5044
  doc = datafile
5043
5045
  else:
5044
- doc = parse_pipe(filename, replace_includes=replace_includes, skip_eval=skip_eval)
5046
+ doc = parse_pipe(filename, replace_includes=replace_includes, skip_eval=skip_eval, content=content)
5045
5047
 
5046
5048
  file_parts: List[str] = []
5047
5049
  format_sources(file_parts, doc)
@@ -5123,6 +5125,7 @@ async def folder_pull(
5123
5125
  force: bool,
5124
5126
  verbose: bool = True,
5125
5127
  progress_bar: bool = False,
5128
+ fmt: bool = False,
5126
5129
  ): # noqa: C901
5127
5130
  pattern = re.compile(match) if match else None
5128
5131
 
@@ -5157,6 +5160,7 @@ async def folder_pull(
5157
5160
  extension: str,
5158
5161
  get_resource_function: str,
5159
5162
  progress_bar: bool = False,
5163
+ fmt: bool = False,
5160
5164
  ):
5161
5165
  async def write_resource(k: Dict[str, Any]):
5162
5166
  name = f"{k['name']}.{extension}"
@@ -5167,6 +5171,13 @@ async def folder_pull(
5167
5171
  return
5168
5172
 
5169
5173
  resource = await getattr(client, get_resource_function)(k["original_name"])
5174
+ resource_to_write = resource
5175
+
5176
+ if fmt:
5177
+ if extension == "datasource":
5178
+ resource_to_write = await format_datasource(name, content=resource)
5179
+ elif extension == "pipe":
5180
+ resource_to_write = await format_pipe(name, content=resource)
5170
5181
 
5171
5182
  dest_folder = folder
5172
5183
  if "." in k["name"] and extension != "token":
@@ -5189,14 +5200,17 @@ async def folder_pull(
5189
5200
  # versions are a client only thing so
5190
5201
  # datafiles from the server do not contains information about versions
5191
5202
  if k["version"] >= 0:
5192
- resource = f"VERSION {k['version']}\n" + resource
5193
- if resource:
5194
- matches = re.findall(r"([^\s\.]*__v\d+)", resource)
5203
+ if fmt:
5204
+ resource_to_write = "\n" + resource_to_write # fmt strips the first line
5205
+
5206
+ resource_to_write = f"VERSION {k['version']}\n" + resource_to_write
5207
+ if resource_to_write:
5208
+ matches = re.findall(r"([^\s\.]*__v\d+)", resource_to_write)
5195
5209
  for match in set(matches):
5196
5210
  m = match.split("__v")[0]
5197
5211
  if m in resources or m in resource_names:
5198
- resource = resource.replace(match, m)
5199
- fd.write(resource)
5212
+ resource_to_write = resource_to_write.replace(match, m)
5213
+ fd.write(resource_to_write)
5200
5214
  else:
5201
5215
  if verbose:
5202
5216
  click.echo(FeedbackManager.info_skip_already_exists())
@@ -5224,8 +5238,10 @@ async def folder_pull(
5224
5238
 
5225
5239
  resources = list(datasources_versions.keys()) + list(pipes_versions.keys())
5226
5240
 
5227
- await write_files(datasources_versions, resources, "datasource", "datasource_file", progress_bar=progress_bar)
5228
- await write_files(pipes_versions, resources, "pipe", "pipe_file", progress_bar=progress_bar)
5241
+ await write_files(
5242
+ datasources_versions, resources, "datasource", "datasource_file", progress_bar=progress_bar, fmt=fmt
5243
+ )
5244
+ await write_files(pipes_versions, resources, "pipe", "pipe_file", progress_bar=progress_bar, fmt=fmt)
5229
5245
 
5230
5246
  return
5231
5247
 
@@ -1459,11 +1459,11 @@ def generate(self, **kwargs) -> Tuple[str, TemplateExecutionResults]:
1459
1459
  pass
1460
1460
 
1461
1461
  if line:
1462
- raise ValueError(f"Syntax error: {message.strip()} line {line[0]}")
1462
+ raise SQLTemplateException(f"{message.strip()} line {line[0]}")
1463
1463
  else:
1464
- raise ValueError(f"Syntax error: {message.strip()}")
1464
+ raise SQLTemplateException(f"{message.strip()}")
1465
1465
  except Exception as e:
1466
- if isinstance(e, ValueError):
1466
+ if isinstance(e, SQLTemplateException):
1467
1467
  raise e
1468
1468
  else:
1469
1469
  logging.exception(f"Error on unbound local error: {e}")
@@ -167,18 +167,17 @@ async def auth_info() -> None:
167
167
  token_origin = ORIGINS.get(config.get_value_origin("token"), "")
168
168
  token = f"{config.get_token()} ({token_origin})"
169
169
 
170
- host_origin = ORIGINS.get(config.get_value_origin("host"), "")
171
- host_name = get_display_host(config.get_host() or "")
172
- host = f"{host_name} ({host_origin})"
170
+ host = config.get("host") or ""
171
+ ui_host = get_display_host(host)
173
172
 
174
173
  if config.get_user_token():
175
174
  user_token_origin = ORIGINS.get(config.get_value_origin("user_token"), "")
176
175
  user_token = f"{config.get_user_token()} ({user_token_origin})"
177
- columns = ["user", "user_token", "token", "host", "workspace_name", "workspace_id"]
178
- table.append([user_email, user_token, token, host, config["name"], config["id"]])
176
+ columns = ["user", "user_token", "token", "host", "ui", "workspace_name", "workspace_id"]
177
+ table.append([user_email, user_token, token, host, ui_host, config["name"], config["id"]])
179
178
  else:
180
- columns = ["user", "token", "host", "workspace_name", "workspace_id"]
181
- table.append([user_email, token, host, config["name"], config["id"]])
179
+ columns = ["user", "token", "host", "ui", "workspace_name", "workspace_id"]
180
+ table.append([user_email, token, host, ui_host, config["name"], config["id"]])
182
181
 
183
182
  click.echo(humanfriendly.tables.format_robust_table(table, column_names=columns))
184
183
 
@@ -214,7 +213,7 @@ async def auth_ls() -> None:
214
213
  else:
215
214
  table.append([1, "default", "", config["host"], True])
216
215
 
217
- columns: List[str] = ["idx", "region", "provider", "host", "api", "current"]
216
+ columns: List[str] = ["idx", "region", "provider", "ui", "host", "current"]
218
217
  echo_safe_humanfriendly_tables_format_smart_table(table, column_names=columns)
219
218
 
220
219
 
@@ -691,21 +691,16 @@ async def push(
691
691
  )
692
692
  @click.option("--match", default=None, help="Retrieve any resourcing matching the pattern. eg --match _test")
693
693
  @click.option("-f", "--force", is_flag=True, default=False, help="Override existing files")
694
+ @click.option("--fmt", is_flag=True, default=False, help="Format files before saving")
694
695
  @click.pass_context
695
696
  @coro
696
- async def pull(
697
- ctx: Context,
698
- folder: str,
699
- auto: bool,
700
- match: Optional[str],
701
- force: bool,
702
- ) -> None:
697
+ async def pull(ctx: Context, folder: str, auto: bool, match: Optional[str], force: bool, fmt: bool) -> None:
703
698
  """Retrieve latest versions for project files from Tinybird."""
704
699
 
705
700
  client = ctx.ensure_object(dict)["client"]
706
701
  folder = folder if folder else getcwd()
707
702
 
708
- return await folder_pull(client, folder, auto, match, force)
703
+ return await folder_pull(client, folder, auto, match, force, fmt=fmt)
709
704
 
710
705
 
711
706
  @cli.command()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 5.8.2.dev1
3
+ Version: 5.8.2.dev3
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -18,15 +18,26 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
18
18
  Changelog
19
19
  ----------
20
20
 
21
+ 5.8.2.dev3
22
+ ***********
23
+
24
+ - `Changed` `tb auth info` and `tb auth ls` now show the region API host properly.
25
+
26
+
27
+ 5.8.2.dev2
28
+ ***********
29
+
30
+ - `Changed` `tb pull` has a new `--fmt` flag to apply the same formatting as `tb fmt` when pulling a datafile.
31
+
21
32
  5.8.2.dev1
22
33
  ***********
23
34
 
24
- - `Removed` missleading output message when `tb auth --token` with TB_TOKEN env var also defined
35
+ - `Removed` misleading output message when `tb auth --token` with TB_TOKEN env var also defined.
25
36
 
26
37
  5.8.1
27
38
  ***********
28
39
 
29
- - `Improved` error message of `tb push` when pushing .datasource files
40
+ - `Improved` error message of `tb push` when pushing .datasource files.
30
41
 
31
42
  5.8.0
32
43
  **********