tinybird 5.0.1.dev0__tar.gz → 5.0.2__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 (130) hide show
  1. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/PKG-INFO +12 -1
  2. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/pyproject.toml +1 -1
  3. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/sql_template_fmt.py +10 -0
  4. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/__cli__.py +2 -2
  5. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/branch.py +28 -12
  6. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/cli.py +10 -1
  7. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/build.py +2 -2
  8. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/pipe_checker.py +8 -2
  9. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/deployment.py +2 -2
  10. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/feedback_manager.py +3 -0
  11. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/local.py +2 -2
  12. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/login_common.py +1 -1
  13. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/logs.py +5 -5
  14. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/token.py +2 -2
  15. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/common.py +2 -2
  16. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird.egg-info/PKG-INFO +12 -1
  17. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/setup.cfg +0 -0
  18. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/__cli__.py +0 -0
  19. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/ch_utils/constants.py +0 -0
  20. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/ch_utils/engine.py +0 -0
  21. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/check_pypi.py +0 -0
  22. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/client.py +0 -0
  23. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/config.py +0 -0
  24. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/context.py +0 -0
  25. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/datafile/common.py +0 -0
  26. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/datafile/exceptions.py +0 -0
  27. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/datafile/parse_connection.py +0 -0
  28. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/datafile/parse_datasource.py +0 -0
  29. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/datafile/parse_pipe.py +0 -0
  30. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/datatypes.py +0 -0
  31. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/feedback_manager.py +0 -0
  32. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/git_settings.py +0 -0
  33. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/iterating/__init__.py +0 -0
  34. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/iterating/data_branch_modes.py +0 -0
  35. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/prompts.py +0 -0
  36. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/service_datasources.py +0 -0
  37. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/sql.py +0 -0
  38. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/sql_template.py +0 -0
  39. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/sql_toolset.py +0 -0
  40. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/syncasync.py +0 -0
  41. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/check_pypi.py +0 -0
  42. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/cli.py +0 -0
  43. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/client.py +0 -0
  44. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/config.py +0 -0
  45. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/build.py +0 -0
  46. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/build_common.py +0 -0
  47. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/cicd.py +0 -0
  48. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/common.py +0 -0
  49. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/config.py +0 -0
  50. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/connection.py +0 -0
  51. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/connection_dynamodb.py +0 -0
  52. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/connection_kafka.py +0 -0
  53. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/connection_s3.py +0 -0
  54. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/copy.py +0 -0
  55. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/create.py +0 -0
  56. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/build_common.py +0 -0
  57. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
  58. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
  59. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/diff.py +0 -0
  60. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/fixture.py +0 -0
  61. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/format_common.py +0 -0
  62. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/format_connection.py +0 -0
  63. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
  64. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
  65. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/playground.py +0 -0
  66. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datafile/pull.py +0 -0
  67. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/datasource.py +0 -0
  68. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/deployment_common.py +0 -0
  69. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/deprecations.py +0 -0
  70. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/endpoint.py +0 -0
  71. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/exceptions.py +0 -0
  72. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/fmt.py +0 -0
  73. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/info.py +0 -0
  74. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/infra.py +0 -0
  75. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/job.py +0 -0
  76. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/job_common.py +0 -0
  77. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/llm.py +0 -0
  78. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/llm_utils.py +0 -0
  79. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/local_common.py +0 -0
  80. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/local_logs.py +0 -0
  81. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/login.py +0 -0
  82. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/logout.py +0 -0
  83. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/materialization.py +0 -0
  84. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/open.py +0 -0
  85. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/pipe.py +0 -0
  86. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/preview.py +0 -0
  87. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/project.py +0 -0
  88. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/project_commands.py +0 -0
  89. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/py_project.py +0 -0
  90. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/query_output.py +0 -0
  91. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/regions.py +0 -0
  92. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/secret.py +0 -0
  93. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/secret_common.py +0 -0
  94. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/sink.py +0 -0
  95. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/table.py +0 -0
  96. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/telemetry.py +0 -0
  97. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/test.py +0 -0
  98. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/test_common.py +0 -0
  99. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
  100. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/ts_project.py +0 -0
  101. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/watch.py +0 -0
  102. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/workspace.py +0 -0
  103. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb/modules/workspace_members.py +0 -0
  104. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli.py +0 -0
  105. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/auth.py +0 -0
  106. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/branch.py +0 -0
  107. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/cicd.py +0 -0
  108. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/cli.py +0 -0
  109. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/config.py +0 -0
  110. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/connection.py +0 -0
  111. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/datasource.py +0 -0
  112. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/exceptions.py +0 -0
  113. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/fmt.py +0 -0
  114. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/job.py +0 -0
  115. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/pipe.py +0 -0
  116. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/regions.py +0 -0
  117. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/tag.py +0 -0
  118. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/telemetry.py +0 -0
  119. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/test.py +0 -0
  120. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  121. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/workspace.py +0 -0
  122. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  123. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/tornado_template.py +0 -0
  124. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/utils/__init__.py +0 -0
  125. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird/utils/bools.py +0 -0
  126. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird.egg-info/SOURCES.txt +0 -0
  127. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird.egg-info/dependency_links.txt +0 -0
  128. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird.egg-info/entry_points.txt +0 -0
  129. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird.egg-info/requires.txt +0 -0
  130. {tinybird-5.0.1.dev0 → tinybird-5.0.2}/tinybird.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 5.0.1.dev0
3
+ Version: 5.0.2
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -52,6 +52,17 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
52
52
  Changelog
53
53
  ----------
54
54
 
55
+ 5.0.2
56
+ *******
57
+
58
+ - `Fixed` ``tb fmt`` keeps ClickHouse numeric literals such as ``1e9``, ``0x1F``, ``0b101``, ``0x1p4`` and ``1_000_000`` intact instead of splitting them into separate tokens.
59
+
60
+ 5.0.1
61
+ *******
62
+
63
+ - `Fixed` Git branches whose name starts with a digit (for example ``3-clean-up-tokens``) work with ``tb build`` and ``tb deploy``. Cloud branches keep the leading digit; Tinybird Local workspaces use a ``branch_`` prefix.
64
+ - `Fixed` ``tb branch clear <name>`` also finds the ``branch_``-prefixed name that ``tb branch create <name>`` generates. If the name matches more than one Branch, use the Branch ID.
65
+
55
66
  5.0.0
56
67
  *******
57
68
 
@@ -108,7 +108,7 @@ dependencies = [
108
108
  "tabulate==0.8.10",
109
109
  "thefuzz==0.22.1",
110
110
  "tinybird-python-sdk[ai]==0.3.7",
111
- "tinybird-toolset==2.7.1",
111
+ "tinybird-toolset==2.7.4",
112
112
  "toposort==1.10",
113
113
  "tornado==6.5.5",
114
114
  "urllib3~=2.8",
@@ -195,6 +195,16 @@ class TinybirdDialect(ClickHouse):
195
195
  ),
196
196
  action=partial(actions.add_node_to_buffer, token_type=TokenType.QUOTED_NAME),
197
197
  ),
198
+ Rule(
199
+ name="number",
200
+ priority=700,
201
+ pattern=group(
202
+ r"-?0x[0-9a-f][0-9a-f_]*(\.[0-9a-f_]*)?(p[+-]?\d[\d_]*)?",
203
+ r"-?0b[01][01_]*",
204
+ r"-?(\d[\d_]*\.?[\d_]*|\.\d[\d_]*)(e[+-]?\d[\d_]*)?",
205
+ ),
206
+ action=partial(actions.add_node_to_buffer, token_type=TokenType.NUMBER),
207
+ ),
198
208
  ],
199
209
  "jinja": [
200
210
  Rule(
@@ -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__ = '5.0.1.dev0'
8
- __revision__ = '3fcfdc16'
7
+ __version__ = '5.0.2'
8
+ __revision__ = '74fe6e30'
@@ -7,7 +7,7 @@ from typing import Any, Dict, List, Optional, Tuple
7
7
 
8
8
  import click
9
9
 
10
- from tinybird.tb.modules.cli import _looks_like_uuid, cli, ensure_valid_workspace_name
10
+ from tinybird.tb.modules.cli import _looks_like_uuid, cli, ensure_valid_workspace_name, sanitize_branch_name
11
11
  from tinybird.tb.modules.common import (
12
12
  MAIN_BRANCH,
13
13
  create_workspace_branch,
@@ -207,17 +207,33 @@ def clear_branch(
207
207
  if branch_name_or_id:
208
208
  if branch_name_or_id == MAIN_BRANCH:
209
209
  raise CLIException(FeedbackManager.error_not_allowed_in_main_branch())
210
- lookup_branch_name_or_id = (
211
- branch_name_or_id if _looks_like_uuid(branch_name_or_id) else ensure_valid_workspace_name(branch_name_or_id)
212
- )
213
- workspace_to_clear = next(
214
- (
215
- workspace
216
- for workspace in workspace_branches
217
- if workspace["name"] == lookup_branch_name_or_id or workspace["id"] == lookup_branch_name_or_id
218
- ),
219
- None,
220
- )
210
+ if _looks_like_uuid(branch_name_or_id):
211
+ lookup_candidates = [branch_name_or_id]
212
+ else:
213
+ # Git-derived branches keep a leading digit, `tb branch create` adds branch_.
214
+ unprefixed_name = sanitize_branch_name(branch_name_or_id, enforce_workspace_prefix_rules=False)
215
+ lookup_candidates = [unprefixed_name or branch_name_or_id, sanitize_branch_name(branch_name_or_id)]
216
+ lookup_branch_name_or_id = lookup_candidates[0]
217
+ matching_branches = [
218
+ workspace
219
+ for candidate in dict.fromkeys(lookup_candidates)
220
+ for workspace in workspace_branches
221
+ if workspace["name"] == candidate or workspace["id"] == candidate
222
+ ]
223
+ if len({workspace["id"] for workspace in matching_branches}) > 1:
224
+ raise CLIBranchException(
225
+ FeedbackManager.error_branch_name_ambiguous(
226
+ branch=branch_name_or_id,
227
+ matches=", ".join(f"'{workspace['name']}' ({workspace['id']})" for workspace in matching_branches),
228
+ )
229
+ )
230
+ workspace_to_clear = matching_branches[0] if matching_branches else None
231
+ if workspace_to_clear and branch_name_or_id not in (workspace_to_clear["name"], workspace_to_clear["id"]):
232
+ click.echo(
233
+ FeedbackManager.warning_branch_name_sanitized(
234
+ context="Branch", original=branch_name_or_id, sanitized=workspace_to_clear["name"]
235
+ )
236
+ )
221
237
  else:
222
238
  workspace_to_clear = next(
223
239
  (workspace for workspace in workspace_branches if workspace["id"] == config["id"]), None
@@ -202,9 +202,18 @@ def get_tinybird_branch_name_from_git_branch(branch_name: Optional[str]) -> Opti
202
202
  if not branch_name:
203
203
  return None
204
204
  sanitized = sanitize_branch_name(branch_name, enforce_workspace_prefix_rules=False)
205
+ if sanitized.startswith("d_"):
206
+ sanitized = f"branch_{sanitized}"
205
207
  return sanitized or None
206
208
 
207
209
 
210
+ def get_local_workspace_name_from_git_branch(branch_name: Optional[str]) -> Optional[str]:
211
+ # Tinybird Local creates a regular Workspace, not a Branch, so the name must start with a letter.
212
+ if not branch_name:
213
+ return None
214
+ return sanitize_branch_name(branch_name) or None
215
+
216
+
208
217
  def is_tinybird_local_running(timeout_seconds: float = 0.2) -> bool:
209
218
  try:
210
219
  with socket.create_connection((TB_LOCAL_HOST, TB_LOCAL_PORT), timeout=timeout_seconds):
@@ -1159,7 +1168,7 @@ def create_ctx_client(
1159
1168
  if not test and not explicit_token_passed:
1160
1169
  git_branch = get_current_git_branch()
1161
1170
  if git_branch and not is_main_git_branch(git_branch):
1162
- local_branch = get_tinybird_branch_name_from_git_branch(git_branch)
1171
+ local_branch = get_local_workspace_name_from_git_branch(git_branch)
1163
1172
  ctx.ensure_object(dict)["git_branch"] = git_branch
1164
1173
  client, workspace_created = get_tinybird_local_client(config, test=test, staging=staging, branch=local_branch)
1165
1174
  if local_branch and config.get("local_workspace_name") == local_branch:
@@ -4,7 +4,7 @@ import re
4
4
  import urllib
5
5
  from copy import deepcopy
6
6
  from dataclasses import dataclass
7
- from datetime import datetime, timezone
7
+ from datetime import UTC, datetime
8
8
  from pathlib import Path
9
9
  from typing import Any, Dict, Iterable, List, Optional, Set, Tuple
10
10
 
@@ -678,7 +678,7 @@ def process_file(
678
678
  if import_from_timestamp := params.get("import_from_timestamp", None):
679
679
  try:
680
680
  dt = datetime.fromisoformat(import_from_timestamp)
681
- if dt.tzinfo is None or dt.tzinfo != timezone.utc:
681
+ if dt.tzinfo is None or dt.tzinfo != UTC:
682
682
  # If the datetime does not have an embedded timezone info
683
683
  # or differs from UTC, user should change it.
684
684
  raise click.ClickException(
@@ -20,6 +20,10 @@ from tinybird.tb.modules.common import getenv_bool
20
20
  PIPE_CHECKER_RETRIES: int = 3
21
21
 
22
22
 
23
+ def _escape_single_quote_str(value: str) -> str:
24
+ return "'" + value.replace("\\", "\\\\").replace("'", "''") + "'"
25
+
26
+
23
27
  class PipeChecker(unittest.TestCase):
24
28
  RETRIES_LIMIT = PIPE_CHECKER_RETRIES
25
29
 
@@ -262,6 +266,8 @@ class PipeCheckerRunner:
262
266
  pipe_stats_rt_table: str = "",
263
267
  extra_where_clause: str = "",
264
268
  ):
269
+ limit = int(limit)
270
+ sample_by_params = int(sample_by_params)
265
271
  pipe_stats_rt = pipe_stats_rt_table or "tinybird.pipe_stats_rt"
266
272
  # TODO it may not be needed to extract token, pipe_checker, form or debug. They may be used in next steps
267
273
  # TODO extractURLParameter(assumeNotNull(url), 'from') <> 'ui' should read from request_param_names.
@@ -289,7 +295,7 @@ class PipeCheckerRunner:
289
295
  AND extractURLParameter(assumeNotNull(url), 'debug') <> 'query'
290
296
  AND error = 0
291
297
  AND not mapContains(parameters, '__tb__semver')
292
- {" AND " + " AND ".join([f"mapContains(pipe_request_params, '{match}')" for match in matches]) if matches and len(matches) > 0 else ""}
298
+ {" AND " + " AND ".join([f"mapContains(pipe_request_params, {_escape_single_quote_str(match)})" for match in matches]) if matches and len(matches) > 0 else ""}
293
299
  {extra_where_clause}
294
300
  Limit 5000000 -- Enough to bring data while not processing all requests from highly used pipes
295
301
  )
@@ -318,7 +324,7 @@ class PipeCheckerRunner:
318
324
  AND extractURLParameter(assumeNotNull(url), 'debug') <> 'query'
319
325
  AND error = 0
320
326
  AND not mapContains(parameters, '__tb__semver')
321
- {" AND " + " AND ".join([f"mapContains(pipe_request_params, '{match}')" for match in matches]) if matches and len(matches) > 0 else ""}
327
+ {" AND " + " AND ".join([f"mapContains(pipe_request_params, {_escape_single_quote_str(match)})" for match in matches]) if matches and len(matches) > 0 else ""}
322
328
  {extra_where_clause}
323
329
  LIMIT {limit}
324
330
  )
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  import logging
3
3
  import os
4
- from datetime import datetime, timedelta, timezone
4
+ from datetime import UTC, datetime, timedelta
5
5
  from pathlib import Path
6
6
  from typing import Any, Dict, Optional
7
7
 
@@ -582,7 +582,7 @@ data-host="{client.host}"
582
582
 
583
583
  try:
584
584
  ttl = timedelta(days=365 * 10)
585
- expiration_time = int((ttl + datetime.now(timezone.utc)).timestamp())
585
+ expiration_time = int((ttl + datetime.now(UTC)).timestamp())
586
586
  datasources = client.datasources()
587
587
  pipes = client.pipes()
588
588
 
@@ -297,6 +297,9 @@ class FeedbackManager:
297
297
  error_branch = error_message(
298
298
  "Branch {branch} not found. use '{cli} branch ls' to list your Branches, make sure you are authenticated using the right workspace token"
299
299
  )
300
+ error_branch_name_ambiguous = error_message(
301
+ "Branch name '{branch}' matches more than one Branch: {matches}. Use the Branch ID instead."
302
+ )
300
303
  error_not_a_branch = error_message(
301
304
  "To use this command you need to be authenticated on a Branch. Use '{cli} branch ls' and '{cli} branch use' and retry the command."
302
305
  )
@@ -12,7 +12,7 @@ from tinybird.tb.client import AuthNoTokenException
12
12
  from tinybird.tb.modules.cli import (
13
13
  cli,
14
14
  get_current_git_branch,
15
- get_tinybird_branch_name_from_git_branch,
15
+ get_local_workspace_name_from_git_branch,
16
16
  is_main_git_branch,
17
17
  )
18
18
  from tinybird.tb.modules.common import (
@@ -96,7 +96,7 @@ def clear_local_workspace() -> None:
96
96
  ws_name = config.get("name")
97
97
  git_branch = get_current_git_branch()
98
98
  if git_branch and not is_main_git_branch(git_branch):
99
- branch_ws_name = get_tinybird_branch_name_from_git_branch(git_branch)
99
+ branch_ws_name = get_local_workspace_name_from_git_branch(git_branch)
100
100
  if branch_ws_name:
101
101
  ws_name = branch_ws_name
102
102
  if not ws_name:
@@ -258,7 +258,7 @@ def open_url(url: str, *, new_tab: bool = False) -> bool:
258
258
  # 1. Try the standard library first on CPython ≥ 3.11 this already
259
259
  # recognises WSL and fires up the Windows default browser for us.
260
260
  try:
261
- wb: Any = webbrowser.get() # mypy: Any for Py < 3.10
261
+ wb: Any = webbrowser.get()
262
262
  if new_tab:
263
263
  if wb.open_new_tab(url):
264
264
  return True
@@ -6,7 +6,7 @@ import json
6
6
  import re
7
7
  import time
8
8
  from contextlib import suppress
9
- from datetime import datetime, timedelta, timezone
9
+ from datetime import UTC, datetime, timedelta
10
10
  from typing import Any, Dict, List, Optional, Sequence, Set, Tuple
11
11
 
12
12
  import click
@@ -199,11 +199,11 @@ _MILLISECOND_DURATION_SOURCES: Set[str] = set()
199
199
 
200
200
 
201
201
  def _to_iso_utc(dt: datetime) -> str:
202
- return dt.astimezone(timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z")
202
+ return dt.astimezone(UTC).replace(microsecond=0).isoformat().replace("+00:00", "Z")
203
203
 
204
204
 
205
205
  def _parse_relative_time(value: str, now: Optional[datetime] = None) -> str:
206
- now = now or datetime.now(timezone.utc)
206
+ now = now or datetime.now(UTC)
207
207
  cleaned_value = value.strip()
208
208
  match = _RELATIVE_TIME_RE.match(cleaned_value)
209
209
  if not match:
@@ -281,7 +281,7 @@ def _parse_sources(raw_sources: Sequence[str]) -> List[str]:
281
281
  def _format_time(timestamp_value: Any) -> str:
282
282
  timestamp = str(timestamp_value)
283
283
  try:
284
- parsed_dt = datetime.fromisoformat(timestamp.replace("Z", "+00:00"))
284
+ parsed_dt = datetime.fromisoformat(timestamp)
285
285
  return parsed_dt.strftime("%Y-%m-%d %H:%M:%S")
286
286
  except ValueError:
287
287
  return timestamp
@@ -595,7 +595,7 @@ def logs(
595
595
  return
596
596
 
597
597
  client: TinyB = ctx.ensure_object(dict)["client"]
598
- now = datetime.now(timezone.utc)
598
+ now = datetime.now(UTC)
599
599
 
600
600
  resolved_start = _parse_relative_time(start_time, now)
601
601
  resolved_end = _parse_relative_time(end_time, now) if end_time else _to_iso_utc(now)
@@ -1,4 +1,4 @@
1
- from datetime import datetime, timedelta, timezone
1
+ from datetime import UTC, datetime, timedelta
2
2
  from typing import Any, Dict, List, Optional
3
3
 
4
4
  import click
@@ -201,7 +201,7 @@ def create_jwt_token(ctx: Context, name: str, ttl: timedelta, scope, resource, f
201
201
  obj: Dict[str, Any] = ctx.ensure_object(dict)
202
202
  client: TinyB = obj["client"]
203
203
 
204
- expiration_time = int((ttl + datetime.now(timezone.utc)).timestamp())
204
+ expiration_time = int((ttl + datetime.now(UTC)).timestamp())
205
205
  if len(scope) != len(resource):
206
206
  raise CLITokenException(FeedbackManager.error_number_of_scopes_and_resources_mismatch())
207
207
 
@@ -1561,7 +1561,7 @@ async def wait_job(
1561
1561
  if result["status"] != "done":
1562
1562
  raise CLIException(FeedbackManager.error_while_running_job(error=result["error"]))
1563
1563
  return result
1564
- except asyncio.TimeoutError:
1564
+ except TimeoutError:
1565
1565
  raise CLIException(FeedbackManager.error_while_running_job(error="Reach timeout, job cancelled"))
1566
1566
  except JobException as e:
1567
1567
  raise CLIException(FeedbackManager.error_while_running_job(error=str(e)))
@@ -1579,7 +1579,7 @@ async def wait_job_no_ui(
1579
1579
  if result["status"] != "done":
1580
1580
  raise JobException(result.get("error"))
1581
1581
  return result
1582
- except asyncio.TimeoutError:
1582
+ except TimeoutError:
1583
1583
  await tb_client.job_cancel(job_id)
1584
1584
  raise
1585
1585
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 5.0.1.dev0
3
+ Version: 5.0.2
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -52,6 +52,17 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
52
52
  Changelog
53
53
  ----------
54
54
 
55
+ 5.0.2
56
+ *******
57
+
58
+ - `Fixed` ``tb fmt`` keeps ClickHouse numeric literals such as ``1e9``, ``0x1F``, ``0b101``, ``0x1p4`` and ``1_000_000`` intact instead of splitting them into separate tokens.
59
+
60
+ 5.0.1
61
+ *******
62
+
63
+ - `Fixed` Git branches whose name starts with a digit (for example ``3-clean-up-tokens``) work with ``tb build`` and ``tb deploy``. Cloud branches keep the leading digit; Tinybird Local workspaces use a ``branch_`` prefix.
64
+ - `Fixed` ``tb branch clear <name>`` also finds the ``branch_``-prefixed name that ``tb branch create <name>`` generates. If the name matches more than one Branch, use the Branch ID.
65
+
55
66
  5.0.0
56
67
  *******
57
68
 
File without changes
File without changes