tinybird-cli 5.20.1.dev0__tar.gz → 5.22.2.dev0__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.20.1.dev0 → tinybird_cli-5.22.2.dev0}/PKG-INFO +27 -2
  2. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/__cli__.py +2 -2
  3. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/ch_utils/constants.py +22 -0
  4. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/ch_utils/engine.py +26 -5
  5. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/client.py +4 -1
  6. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/config.py +0 -6
  7. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/connectors.py +1 -7
  8. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/context.py +3 -3
  9. tinybird_cli-5.20.1.dev0/tinybird/datafile.py → tinybird_cli-5.22.2.dev0/tinybird/datafile_common.py +173 -130
  10. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/feedback_manager.py +10 -1
  11. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/sql.py +42 -24
  12. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/sql_template.py +60 -16
  13. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/sql_template_fmt.py +14 -4
  14. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/sql_toolset.py +124 -7
  15. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/auth.py +2 -3
  16. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/branch.py +13 -6
  17. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/cli.py +50 -22
  18. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/common.py +2 -2
  19. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/connection.py +1 -1
  20. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/datasource.py +2 -2
  21. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/fmt.py +6 -4
  22. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/pipe.py +16 -2
  23. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/telemetry.py +1 -1
  24. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +1 -15
  25. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -6
  26. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/token.py +32 -12
  27. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/workspace.py +12 -13
  28. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tornado_template.py +6 -7
  29. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird_cli.egg-info/PKG-INFO +27 -2
  30. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird_cli.egg-info/SOURCES.txt +1 -1
  31. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird_cli.egg-info/requires.txt +1 -1
  32. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/setup.cfg +0 -0
  33. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/check_pypi.py +0 -0
  34. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/datatypes.py +0 -0
  35. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/git_settings.py +0 -0
  36. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/syncasync.py +0 -0
  37. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli.py +0 -0
  38. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/cicd.py +0 -0
  39. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/config.py +0 -0
  40. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/exceptions.py +0 -0
  41. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/job.py +0 -0
  42. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/regions.py +0 -0
  43. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/tag.py +0 -0
  44. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/test.py +0 -0
  45. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  46. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird_cli.egg-info/dependency_links.txt +0 -0
  47. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird_cli.egg-info/entry_points.txt +0 -0
  48. {tinybird_cli-5.20.1.dev0 → tinybird_cli-5.22.2.dev0}/tinybird_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird_cli
3
- Version: 5.20.1.dev0
3
+ Version: 5.22.2.dev0
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli
6
6
  Author: Tinybird
@@ -16,7 +16,7 @@ Requires-Dist: croniter==1.3.15
16
16
  Requires-Dist: GitPython~=3.1.32
17
17
  Requires-Dist: humanfriendly~=8.2
18
18
  Requires-Dist: pydantic~=2.8.0
19
- Requires-Dist: pyperclip==1.8.2
19
+ Requires-Dist: pyperclip==1.9.0
20
20
  Requires-Dist: pyyaml<6.1,>=6.0
21
21
  Requires-Dist: requests<3,>=2.28.1
22
22
  Requires-Dist: shandy-sqlfmt==0.11.1
@@ -61,6 +61,30 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
61
61
  Changelog
62
62
  ----------
63
63
 
64
+ 5.22.1
65
+ ***********
66
+
67
+ - `Fixed` RuntimeWarning for unawaited coroutines when `tb pull` encounters server errors
68
+
69
+ 5.22.0
70
+ ***********
71
+
72
+ - `Added` `tb init --git --override-commit` now works on workspaces without an existing release, allowing you to initialize git deployments from scratch
73
+ - `Added` `tb release create --commit` option to specify a specific git commit instead of using HEAD
74
+ - `Improved` `tb fmt` now supports `{% end if %}` and `{% end for %}` tag variations in addition to the standard Tornado-style `{% end %}` tags
75
+ - `Improved` Error message when trying to format a file using `tb fmt` or when we are running `tb init --git` to include the resource name and source (local/remote)
76
+
77
+ 5.21.1
78
+ ***********
79
+
80
+ - `Fixed` The `--on-demand-compute` flag will now ask for confirmation.
81
+
82
+ 5.21.0
83
+ ***********
84
+
85
+ - `Added` `tb pipe populate` and `tb push <PIPE> --populate` has a new `--on-demand-compute` flag to enable Compute-Compute Separation in populates.
86
+ - `Added` When trying to push a materialized view with an unoptimized join, the CLI will now warn the user.
87
+
64
88
  5.19.0
65
89
  ***********
66
90
 
@@ -198,6 +222,7 @@ Changelog
198
222
  - `Added` `tb tag` commands to manage tags from the CLI.
199
223
  - `Added` support to `TAGS` in `tb fmt`.
200
224
  - `Added` support to `TAGS` in `tb pull` and `tb push`. Allows tagging resources for filtering in the UI.
225
+ - `Changed` Improved message when creating a DynamoDB connection
201
226
 
202
227
  5.7.0
203
228
  **********
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
4
4
  __url__ = 'https://www.tinybird.co/docs/cli'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '5.20.1.dev0'
8
- __revision__ = '4f9495f'
7
+ __version__ = '5.22.2.dev0'
8
+ __revision__ = 'e1b50a6'
@@ -242,3 +242,25 @@ FORBIDDEN_SQL_KEYWORDS = {
242
242
 
243
243
  CH_SETTINGS_JOIN_ALGORITHM_HASH = "hash" # uses 'hash' by default, https://clickhouse.com/docs/en/operations/settings/settings/#settings-join_algorithm
244
244
  CH_SETTINGS_JOIN_ALGORITHM_AUTO = "auto,hash"
245
+
246
+ VALID_QUERY_FORMATS = (
247
+ "JSON",
248
+ "CSV",
249
+ "CSVWithNames",
250
+ "TSV",
251
+ "TSVWithNames",
252
+ "PrettyCompact",
253
+ "JSONEachRow",
254
+ "Parquet",
255
+ "JSONStrings",
256
+ "Prometheus",
257
+ "Native",
258
+ "RowBinaryWithNamesAndTypes",
259
+ "TabSeparated",
260
+ "JSONCompactEachRowWithNamesAndTypes",
261
+ "TabSeparatedWithNamesAndTypes",
262
+ "JSONCompactEachRow",
263
+ "JSONCompact",
264
+ "JSONStringsEachRowWithProgress",
265
+ "ODBCDriver2",
266
+ )
@@ -134,8 +134,9 @@ class TableDetails:
134
134
  _version = self.details.get("version", None)
135
135
  return _version
136
136
 
137
- def is_replicated(self):
138
- return "Replicated" in self.details.get("engine", None)
137
+ def is_replicated(self) -> bool:
138
+ engine: Optional[str] = self.details.get("engine", None)
139
+ return engine is not None and "Replicated" in engine
139
140
 
140
141
  def is_mergetree_family(self) -> bool:
141
142
  return self.engine is not None and "mergetree" in self.engine.lower()
@@ -146,10 +147,9 @@ class TableDetails:
146
147
  def is_replacing_engine(self) -> bool:
147
148
  if self.engine:
148
149
  engine_lower = self.engine.lower()
149
- is_aggregating = "aggregatingmergetree" in engine_lower
150
150
  is_replacing = "replacingmergetree" in engine_lower
151
151
  is_collapsing = "collapsingmergetree" in engine_lower
152
- return is_aggregating or is_replacing or is_collapsing
152
+ return is_replacing or is_collapsing
153
153
  return False
154
154
 
155
155
  def diff_ttl(self, new_ttl: str) -> bool:
@@ -169,6 +169,10 @@ class TableDetails:
169
169
  @property
170
170
  def sorting_key(self) -> Optional[str]:
171
171
  _sorting_key = self.details.get("sorting_key", None)
172
+ # TODO: This should use ENABLED_ENGINES to guess if the sorting key is required or not
173
+ # Also checking this and raising an error in a getter is a bit of an anti-pattern,
174
+ # a data source could have a "wrong" sorting key and we won't be able to even show it in the API.
175
+ # All these checks be performed only on creation time.
172
176
  if self.is_replacing_engine() and not _sorting_key:
173
177
  raise ValueError(f"SORTING_KEY must be defined for the {self.engine} engine")
174
178
  if self.is_mergetree_family():
@@ -354,7 +358,11 @@ class EngineParam:
354
358
  self.required = required
355
359
  self.default_value = default_value
356
360
  self.is_valid = is_valid
357
- self.tb_param = tb_param if tb_param else "_".join(["engine", name])
361
+ self.tb_param = tb_param if tb_param else self.build_engine_param_name(name)
362
+
363
+ @staticmethod
364
+ def build_engine_param_name(name: str):
365
+ return "_".join(["engine", name])
358
366
 
359
367
 
360
368
  def engine_config(name: str, params: Optional[List[EngineParam]] = None, options: Optional[List[EngineOption]] = None):
@@ -491,6 +499,19 @@ ENABLED_ENGINES = [
491
499
  ]
492
500
 
493
501
 
502
+ def __get_valid_engine_params():
503
+ engine_vars = set()
504
+ for _, (params, options) in ENABLED_ENGINES:
505
+ for p in params:
506
+ engine_vars.add(p.name)
507
+ for o in options:
508
+ engine_vars.add(o.name)
509
+ return engine_vars
510
+
511
+
512
+ VALID_ENGINE_PARAMS = __get_valid_engine_params()
513
+
514
+
494
515
  def get_engine_config(engine: str):
495
516
  for name, config in ENABLED_ENGINES:
496
517
  if engine.lower() == name.lower():
@@ -552,7 +552,7 @@ class TinyB:
552
552
  async def analyze_pipe_node(
553
553
  self, pipe_name: str, node: Dict[str, Any], dry_run: str = "false", datasource_name: Optional[str] = None
554
554
  ):
555
- params = {**{"include_datafile": "true", "dry_run": dry_run}, **node.get("params", node)}
555
+ params = {"include_datafile": "true", "dry_run": dry_run, **node.get("params", node)}
556
556
  if "mode" in params:
557
557
  params.pop("mode")
558
558
  node_name = node["params"]["name"] if node.get("params", None) else node["name"]
@@ -569,6 +569,7 @@ class TinyB:
569
569
  populate_condition: Optional[str] = None,
570
570
  truncate: bool = True,
571
571
  unlink_on_populate_error: bool = False,
572
+ on_demand_compute: bool = False,
572
573
  ):
573
574
  params: Dict[str, Any] = {
574
575
  "truncate": "true" if truncate else "false",
@@ -578,6 +579,8 @@ class TinyB:
578
579
  params.update({"populate_subset": populate_subset})
579
580
  if populate_condition:
580
581
  params.update({"populate_condition": populate_condition})
582
+ if on_demand_compute:
583
+ params.update({"on_demand_compute": "true"})
581
584
  response = await self._req(
582
585
  f"/v0/pipes/{pipe_name}/nodes/{node_name}/population?{urlencode(params)}", method="POST"
583
586
  )
@@ -38,13 +38,10 @@ LEGACY_HOSTS = {
38
38
  "https://api.wadus3.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus3",
39
39
  "https://api.wadus4.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus4",
40
40
  "https://api.wadus5.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus5",
41
- "https://api.wadus6.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus6",
42
41
  "https://api.wadus1.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus1",
43
42
  "https://api.wadus2.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus2",
44
43
  "https://api.wadus3.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus3",
45
44
  "https://api.wadus4.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus4",
46
- "https://api.wadus5.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus5",
47
- "https://api.wadus6.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus6",
48
45
  "https://ui.tinybird.co": "https://app.tinybird.co/gcp/europe-west3",
49
46
  "https://ui.us-east.tinybird.co": "https://app.tinybird.co/gcp/us-east4",
50
47
  "https://ui.us-east.aws.tinybird.co": "https://app.tinybird.co/aws/us-east-1",
@@ -62,13 +59,10 @@ LEGACY_HOSTS = {
62
59
  "https://ui.wadus3.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus3",
63
60
  "https://ui.wadus4.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus4",
64
61
  "https://ui.wadus5.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus5",
65
- "https://ui.wadus6.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus6",
66
62
  "https://ui.wadus1.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus1",
67
63
  "https://ui.wadus2.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus2",
68
64
  "https://ui.wadus3.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus3",
69
65
  "https://ui.wadus4.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus4",
70
- "https://ui.wadus5.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus5",
71
- "https://ui.wadus6.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus6",
72
66
  }
73
67
 
74
68
 
@@ -369,13 +369,7 @@ class Snowflake(Connector):
369
369
  the_type = "String"
370
370
  if t.startswith("NUMBER"):
371
371
  the_type = "Int32"
372
- if (
373
- t.startswith("FLOAT")
374
- or t.startswith("DOUBLE")
375
- or t.startswith("REAL")
376
- or t.startswith("NUMERIC")
377
- or t.startswith("DECIMAL")
378
- ):
372
+ if t.startswith(("FLOAT", "DOUBLE", "REAL", "NUMERIC", "DECIMAL")):
379
373
  the_type = "Float32"
380
374
  if t == "DATE":
381
375
  the_type = "Date"
@@ -3,15 +3,15 @@ from typing import TYPE_CHECKING
3
3
 
4
4
  # Avoid circular import error
5
5
  if TYPE_CHECKING:
6
- from tinybird.user import User
6
+ from hfi.hfi_workspace_data import HfiWorkspaceData
7
+
7
8
 
8
9
  workspace_id: ContextVar[str] = ContextVar("workspace_id")
9
- workspace: ContextVar["User"] = ContextVar("workspace")
10
+ hfi_workspace_data: ContextVar["HfiWorkspaceData"] = ContextVar("hfi_workspace_data")
10
11
  table_id: ContextVar[str] = ContextVar("table_id")
11
12
  hfi_frequency: ContextVar[float] = ContextVar("hfi_frequency")
12
13
  hfi_frequency_gatherer: ContextVar[float] = ContextVar("hfi_frequency_gatherer")
13
14
  use_gatherer: ContextVar[bool] = ContextVar("use_gatherer")
14
- allow_gatherer_fallback: ContextVar[bool] = ContextVar("allow_gatherer_fallback")
15
15
  gatherer_allow_s3_backup_on_user_errors: ContextVar[bool] = ContextVar("gatherer_allow_s3_backup_on_user_errors")
16
16
  disable_template_security_validation: ContextVar[bool] = ContextVar("disable_template_security_validation")
17
17
  origin: ContextVar[str] = ContextVar("origin")