tinybird-cli 4.1.2.dev0__tar.gz → 5.0.0.dev1__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 (46) hide show
  1. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/PKG-INFO +19 -3
  2. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/__cli__.py +2 -2
  3. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/datafile.py +42 -6
  4. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/feedback_manager.py +7 -0
  5. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/pipe.py +8 -0
  6. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird_cli.egg-info/PKG-INFO +19 -3
  7. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/setup.cfg +0 -0
  8. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/ch_utils/constants.py +0 -0
  9. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/ch_utils/engine.py +0 -0
  10. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/check_pypi.py +0 -0
  11. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/client.py +0 -0
  12. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/config.py +0 -0
  13. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/connectors.py +0 -0
  14. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/context.py +0 -0
  15. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/datatypes.py +0 -0
  16. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/git_settings.py +0 -0
  17. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/sql.py +0 -0
  18. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/sql_template.py +0 -0
  19. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/sql_template_fmt.py +0 -0
  20. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/sql_toolset.py +0 -0
  21. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/syncasync.py +0 -0
  22. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli.py +0 -0
  23. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/auth.py +0 -0
  24. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/branch.py +0 -0
  25. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/cicd.py +0 -0
  26. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/cli.py +0 -0
  27. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/common.py +0 -0
  28. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/config.py +0 -0
  29. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/connection.py +0 -0
  30. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/datasource.py +0 -0
  31. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/exceptions.py +0 -0
  32. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/job.py +0 -0
  33. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/regions.py +0 -0
  34. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/telemetry.py +0 -0
  35. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/test.py +0 -0
  36. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  37. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  38. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/token.py +0 -0
  39. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/workspace.py +0 -0
  40. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  41. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird/tornado_template.py +0 -0
  42. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird_cli.egg-info/SOURCES.txt +0 -0
  43. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird_cli.egg-info/dependency_links.txt +0 -0
  44. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird_cli.egg-info/entry_points.txt +0 -0
  45. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/tinybird_cli.egg-info/requires.txt +0 -0
  46. {tinybird-cli-4.1.2.dev0 → tinybird-cli-5.0.0.dev1}/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: 4.1.2.dev0
3
+ Version: 5.0.0.dev1
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -18,6 +18,22 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
18
18
  Changelog
19
19
  ----------
20
20
 
21
+ 5.0.0.dev1
22
+ ************
23
+
24
+ - `Added` `tb push` displays warnings when using a reserved parameter in a pipe.
25
+
26
+ 5.0.0.dev0
27
+ ************
28
+
29
+ - `Changed` Make `insertion_date`` column explicit. This column is no longer inferred, it must be present in the Data Source file.
30
+
31
+ 4.1.2.dev0
32
+ ************
33
+
34
+ - `Added` parameter to `tb pipe regression-test` --relative-change
35
+
36
+
21
37
  4.1.1
22
38
  ************
23
39
 
@@ -27,7 +43,7 @@ Changelog
27
43
  ************
28
44
 
29
45
  - `Added` `tb token create` command to be able to create static and JWT tokens from the CLI. You can check more information at https://www.tinybird.co/blog-posts/jwt-api-endpoints-public-beta
30
- - `Fixed` `tb init --git` to pin `tinybird-cli>=4,<5` in `requirements.txt` to avoid issues with the latest version of the CLI.
46
+ - `Fixed` `tb init --git` to pin `tinybird-cli>=4,<5` in `requirements.txt` to avoid issues with the latest version of the CLI.
31
47
 
32
48
  4.0.0
33
49
  ************
@@ -85,7 +101,7 @@ This is a major release, please read the commands affected below and consider up
85
101
  ************
86
102
 
87
103
  - `Changed` fixed major version of tinybird-cli to lower than 4 when using `tb init --git`
88
- - `Changed` behavior when running `tb deploy` on a branch to push the connection settings to the backend. This change is the backend that decides what to do.
104
+ - `Changed` behavior when running `tb deploy` on a branch to push the connection settings to the backend. This change is the backend that decides what to do.
89
105
  - `Changed` `tb pipe sink` commands are now available
90
106
  - `Fixed` regression tests query when filtering by specific parameter
91
107
  - `Fixed` Avoid `tb fmt` to error if there's a `CASE` in the sql
@@ -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__ = '4.1.2.dev0'
8
- __revision__ = 'b6a6857'
7
+ __version__ = '5.0.0.dev1'
8
+ __revision__ = '77477da'
@@ -711,6 +711,7 @@ class Datafile:
711
711
  self.raw: Optional[List[str]] = None
712
712
  self.includes: Dict[str, Any] = {}
713
713
  self.shared_with: List[str] = []
714
+ self.warnings: List[str] = []
714
715
 
715
716
  def validate(self) -> None:
716
717
  for x in self.nodes:
@@ -773,7 +774,8 @@ def parse_pipe(
773
774
  for node in doc.nodes:
774
775
  sql = node.get("sql", "")
775
776
  if sql.strip()[0] == "%":
776
- sql, _, _ = render_sql_template(sql[1:], test_mode=True, name=node["name"])
777
+ sql, _, variable_warnings = render_sql_template(sql[1:], test_mode=True, name=node["name"])
778
+ doc.warnings = variable_warnings
777
779
  # it'll fail with a ModuleNotFoundError when the toolset is not available but it returns the parsed doc
778
780
  from tinybird.sql_toolset import format_sql as toolset_format_sql
779
781
 
@@ -1565,6 +1567,7 @@ async def process_file(
1565
1567
  "deps": [x for x in set(deps)],
1566
1568
  "tokens": doc.tokens,
1567
1569
  "description": description,
1570
+ "warnings": doc.warnings,
1568
1571
  }
1569
1572
  ]
1570
1573
  elif DataFileExtensions.TOKEN in filename:
@@ -1766,6 +1769,7 @@ class PipeChecker(unittest.TestCase):
1766
1769
  only_response_times: bool,
1767
1770
  ignore_order: bool,
1768
1771
  validate_processed_bytes: bool,
1772
+ relative_change: float,
1769
1773
  *args,
1770
1774
  **kwargs,
1771
1775
  ) -> None:
@@ -1784,6 +1788,7 @@ class PipeChecker(unittest.TestCase):
1784
1788
  self.only_response_times = only_response_times
1785
1789
  self.ignore_order = ignore_order
1786
1790
  self.validate_processed_bytes = validate_processed_bytes
1791
+ self.relative_change = relative_change
1787
1792
 
1788
1793
  parsed = urlparse(self.current_pipe_url)
1789
1794
  self.checker_pipe_url = f"{parsed.scheme}://{parsed.netloc}/v0/pipes/{self.checker_pipe_name}.json"
@@ -1901,12 +1906,13 @@ class PipeChecker(unittest.TestCase):
1901
1906
  for _, (current_data_e, check_fixtures_data_e) in enumerate(zip(current_data, checker_data)):
1902
1907
  self.assertEqual(list(current_data_e.keys()), list(check_fixtures_data_e.keys()))
1903
1908
  for x in current_data_e.keys():
1904
- if isinstance(current_data_e[x], float):
1909
+ if isinstance(current_data_e[x], (float, int)):
1905
1910
  d = abs(current_data_e[x] - check_fixtures_data_e[x])
1911
+
1906
1912
  try:
1907
1913
  self.assertLessEqual(
1908
1914
  d / current_data_e[x],
1909
- 0.01,
1915
+ self.relative_change,
1910
1916
  f"key {x}. old value: {current_data_e[x]}, new value: {check_fixtures_data_e[x]}\n{self.diff(current_data_e, check_fixtures_data_e)}",
1911
1917
  )
1912
1918
  except ZeroDivisionError:
@@ -2057,6 +2063,7 @@ class PipeCheckerRunner:
2057
2063
  only_response_times: bool,
2058
2064
  ignore_order: bool,
2059
2065
  validate_processed_bytes: bool,
2066
+ relative_change: float,
2060
2067
  ) -> PipeChecker:
2061
2068
  return PipeChecker(
2062
2069
  request,
@@ -2066,6 +2073,7 @@ class PipeCheckerRunner:
2066
2073
  only_response_times,
2067
2074
  ignore_order,
2068
2075
  validate_processed_bytes,
2076
+ relative_change,
2069
2077
  )
2070
2078
 
2071
2079
  def _delta_percentage(self, checker: float, current: float) -> float:
@@ -2085,6 +2093,7 @@ class PipeCheckerRunner:
2085
2093
  only_response_times: bool,
2086
2094
  ignore_order: bool,
2087
2095
  validate_processed_bytes: bool,
2096
+ relative_change: float,
2088
2097
  failfast: bool,
2089
2098
  custom_output: bool = False,
2090
2099
  debug: bool = False,
@@ -2123,7 +2132,13 @@ class PipeCheckerRunner:
2123
2132
  for _, request in enumerate(pipe_requests_to_check):
2124
2133
  suite.addTest(
2125
2134
  self._get_checker(
2126
- request, checker_pipe_name, token, only_response_times, ignore_order, validate_processed_bytes
2135
+ request,
2136
+ checker_pipe_name,
2137
+ token,
2138
+ only_response_times,
2139
+ ignore_order,
2140
+ validate_processed_bytes,
2141
+ relative_change,
2127
2142
  )
2128
2143
  )
2129
2144
 
@@ -2264,6 +2279,7 @@ async def check_pipe(
2264
2279
  populate: bool,
2265
2280
  cl: TinyB,
2266
2281
  limit: int = 0,
2282
+ relative_change: float = 0.01,
2267
2283
  sample_by_params: int = 0,
2268
2284
  only_response_times=False,
2269
2285
  matches: Optional[List[str]] = None,
@@ -2342,6 +2358,7 @@ async def check_pipe(
2342
2358
  only_response_times,
2343
2359
  ignore_order,
2344
2360
  validate_processed_bytes,
2361
+ relative_change,
2345
2362
  failfast,
2346
2363
  )
2347
2364
 
@@ -2556,6 +2573,7 @@ async def new_pipe(
2556
2573
  run_tests: bool = False,
2557
2574
  as_standard: bool = False,
2558
2575
  tests_to_run: int = 0,
2576
+ tests_relative_change: float = 0.01,
2559
2577
  tests_to_sample_by_params: int = 0,
2560
2578
  tests_filter_by: Optional[List[str]] = None,
2561
2579
  tests_failfast: bool = False,
@@ -2600,6 +2618,7 @@ async def new_pipe(
2600
2618
  tb_client,
2601
2619
  only_response_times=only_response_times,
2602
2620
  limit=tests_to_run,
2621
+ relative_change=tests_relative_change,
2603
2622
  sample_by_params=tests_to_sample_by_params,
2604
2623
  matches=tests_filter_by,
2605
2624
  failfast=tests_failfast,
@@ -3206,6 +3225,7 @@ async def exec_file(
3206
3225
  run_tests=False,
3207
3226
  as_standard=False,
3208
3227
  tests_to_run: int = 0,
3228
+ tests_relative_change: float = 0.01,
3209
3229
  tests_to_sample_by_params: int = 0,
3210
3230
  tests_filter_by: Optional[List[str]] = None,
3211
3231
  tests_failfast: bool = False,
@@ -3235,6 +3255,7 @@ async def exec_file(
3235
3255
  run_tests=run_tests,
3236
3256
  as_standard=as_standard,
3237
3257
  tests_to_run=tests_to_run,
3258
+ tests_relative_change=tests_relative_change,
3238
3259
  tests_to_sample_by_params=tests_to_sample_by_params,
3239
3260
  tests_filter_by=tests_filter_by,
3240
3261
  tests_failfast=tests_failfast,
@@ -3587,6 +3608,7 @@ async def build_graph(
3587
3608
  workspace_lib_paths: Optional[List[Tuple[str, str]]],
3588
3609
  ):
3589
3610
  name, kind = filename.rsplit(".", 1)
3611
+ warnings = []
3590
3612
 
3591
3613
  try:
3592
3614
  res = await process_file(
@@ -3607,6 +3629,7 @@ async def build_graph(
3607
3629
 
3608
3630
  for r in res:
3609
3631
  fn = r["resource_name"]
3632
+ warnings = r.get("warnings", [])
3610
3633
  if changed and fn in changed and (not changed[fn] or changed[fn] in ["shared", "remote"]):
3611
3634
  continue
3612
3635
 
@@ -3655,7 +3678,7 @@ async def build_graph(
3655
3678
  r["shared_with"] = mapped_workspaces
3656
3679
 
3657
3680
  dep_map[fn] = set(dep_list)
3658
- return os.path.basename(name)
3681
+ return os.path.basename(name), warnings
3659
3682
 
3660
3683
  processed = set()
3661
3684
 
@@ -3675,9 +3698,20 @@ async def build_graph(
3675
3698
  if ".incl" in filename:
3676
3699
  click.echo(FeedbackManager.warning_skipping_include_file(file=filename))
3677
3700
 
3678
- name = await process(filename, deps, dep_map, to_run, workspace_lib_paths)
3701
+ name, warnings = await process(filename, deps, dep_map, to_run, workspace_lib_paths)
3679
3702
  processed.add(name)
3680
3703
 
3704
+ if verbose:
3705
+ if len(warnings) == 1:
3706
+ click.echo(FeedbackManager.warning_pipe_restricted_param(word=warnings[0]))
3707
+ elif len(warnings) > 1:
3708
+ click.echo(
3709
+ FeedbackManager.warning_pipe_restricted_params(
3710
+ words=", ".join(["'{}'".format(param) for param in warnings[:-1]]),
3711
+ last_word=warnings[-1],
3712
+ )
3713
+ )
3714
+
3681
3715
  await get_processed(filenames=filenames)
3682
3716
 
3683
3717
  if process_dependencies:
@@ -3805,6 +3839,7 @@ async def folder_push(
3805
3839
  raise_on_exists: bool = False,
3806
3840
  verbose: bool = True,
3807
3841
  tests_to_run: int = 0,
3842
+ tests_relative_change: float = 0.01,
3808
3843
  tests_sample_by_params: int = 0,
3809
3844
  tests_filter_by: Optional[List[str]] = None,
3810
3845
  tests_failfast: bool = False,
@@ -3991,6 +4026,7 @@ async def folder_push(
3991
4026
  run_tests,
3992
4027
  as_standard,
3993
4028
  tests_to_run,
4029
+ tests_relative_change,
3994
4030
  tests_sample_by_params,
3995
4031
  tests_filter_by,
3996
4032
  tests_failfast,
@@ -554,6 +554,13 @@ Ready? """
554
554
  warning_sink_no_connection = warning_message(
555
555
  "** Warning: pipe '{pipe_name}' does not have an associated Sink connection."
556
556
  )
557
+ warning_pipe_restricted_param = warning_message(
558
+ "** The parameter name '{word}' is a reserved word. Please, choose another name or the pipe will not work as expected."
559
+ )
560
+ warning_pipe_restricted_params = warning_message(
561
+ "** The parameter names {words} and '{last_word}' are reserved words. Please, choose another name or the pipe will not work as expected."
562
+ )
563
+
557
564
  info_fixtures_branch = info_message("** Data Fixtures are only pushed to Branches")
558
565
  info_materialize_push_datasource_exists = warning_message("** Data Source {name} already exists")
559
566
  info_materialize_push_datasource_override = prompt_message(
@@ -539,6 +539,12 @@ async def print_pipe(ctx: Context, pipe: str, query: str, format_: str):
539
539
  help="When set, the checker will get Main Workspace requests",
540
540
  hidden=True,
541
541
  )
542
+ @click.option(
543
+ "--relative-change",
544
+ type=float,
545
+ default=0.01,
546
+ help="When set, the checker will validate the new version has less than this distance with the current version",
547
+ )
542
548
  @click.pass_context
543
549
  @coro
544
550
  async def regression_test(
@@ -556,6 +562,7 @@ async def regression_test(
556
562
  ignore_order: bool,
557
563
  validate_processed_bytes: bool,
558
564
  check_requests_from_main: bool,
565
+ relative_change: float,
559
566
  ):
560
567
  """
561
568
  Run regression tests on Tinybird
@@ -583,6 +590,7 @@ async def regression_test(
583
590
  no_versions=no_versions,
584
591
  run_tests=True,
585
592
  tests_to_run=limit,
593
+ tests_relative_change=relative_change,
586
594
  tests_sample_by_params=sample_by_params,
587
595
  tests_filter_by=match,
588
596
  tests_failfast=failfast,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 4.1.2.dev0
3
+ Version: 5.0.0.dev1
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -18,6 +18,22 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
18
18
  Changelog
19
19
  ----------
20
20
 
21
+ 5.0.0.dev1
22
+ ************
23
+
24
+ - `Added` `tb push` displays warnings when using a reserved parameter in a pipe.
25
+
26
+ 5.0.0.dev0
27
+ ************
28
+
29
+ - `Changed` Make `insertion_date`` column explicit. This column is no longer inferred, it must be present in the Data Source file.
30
+
31
+ 4.1.2.dev0
32
+ ************
33
+
34
+ - `Added` parameter to `tb pipe regression-test` --relative-change
35
+
36
+
21
37
  4.1.1
22
38
  ************
23
39
 
@@ -27,7 +43,7 @@ Changelog
27
43
  ************
28
44
 
29
45
  - `Added` `tb token create` command to be able to create static and JWT tokens from the CLI. You can check more information at https://www.tinybird.co/blog-posts/jwt-api-endpoints-public-beta
30
- - `Fixed` `tb init --git` to pin `tinybird-cli>=4,<5` in `requirements.txt` to avoid issues with the latest version of the CLI.
46
+ - `Fixed` `tb init --git` to pin `tinybird-cli>=4,<5` in `requirements.txt` to avoid issues with the latest version of the CLI.
31
47
 
32
48
  4.0.0
33
49
  ************
@@ -85,7 +101,7 @@ This is a major release, please read the commands affected below and consider up
85
101
  ************
86
102
 
87
103
  - `Changed` fixed major version of tinybird-cli to lower than 4 when using `tb init --git`
88
- - `Changed` behavior when running `tb deploy` on a branch to push the connection settings to the backend. This change is the backend that decides what to do.
104
+ - `Changed` behavior when running `tb deploy` on a branch to push the connection settings to the backend. This change is the backend that decides what to do.
89
105
  - `Changed` `tb pipe sink` commands are now available
90
106
  - `Fixed` regression tests query when filtering by specific parameter
91
107
  - `Fixed` Avoid `tb fmt` to error if there's a `CASE` in the sql