tinybird-cli 1.0.2.dev16__tar.gz → 1.1.0__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 (45) hide show
  1. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/PKG-INFO +33 -2
  2. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/__cli__.py +2 -2
  3. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/sql_toolset.py +12 -6
  4. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/cicd.py +29 -7
  5. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/cli.py +4 -1
  6. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird_cli.egg-info/PKG-INFO +33 -2
  7. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/setup.cfg +0 -0
  8. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/ch_utils/constants.py +0 -0
  9. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/ch_utils/engine.py +0 -0
  10. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/check_pypi.py +0 -0
  11. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/client.py +0 -0
  12. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/config.py +0 -0
  13. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/connector_settings.py +0 -0
  14. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/connectors.py +0 -0
  15. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/context.py +0 -0
  16. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/datafile.py +0 -0
  17. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/datatypes.py +0 -0
  18. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/feedback_manager.py +0 -0
  19. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/sql.py +0 -0
  20. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/sql_template.py +0 -0
  21. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/sql_template_fmt.py +0 -0
  22. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/syncasync.py +0 -0
  23. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli.py +0 -0
  24. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/auth.py +0 -0
  25. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/branch.py +0 -0
  26. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/common.py +0 -0
  27. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/config.py +0 -0
  28. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/connection.py +0 -0
  29. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/datasource.py +0 -0
  30. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/exceptions.py +0 -0
  31. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/job.py +0 -0
  32. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/pipe.py +0 -0
  33. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/telemetry.py +0 -0
  34. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/test.py +0 -0
  35. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  36. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  37. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/token.py +0 -0
  38. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/workspace.py +0 -0
  39. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  40. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird/tornado_template.py +0 -0
  41. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird_cli.egg-info/SOURCES.txt +0 -0
  42. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird_cli.egg-info/dependency_links.txt +0 -0
  43. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird_cli.egg-info/entry_points.txt +0 -0
  44. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/tinybird_cli.egg-info/requires.txt +0 -0
  45. {tinybird-cli-1.0.2.dev16 → tinybird-cli-1.1.0}/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: 1.0.2.dev16
3
+ Version: 1.1.0
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://docs.tinybird.co/cli.html
6
6
  Author: Tinybird
@@ -19,6 +19,37 @@ Changelog
19
19
 
20
20
  ---------
21
21
 
22
+ 1.1.0
23
+ ************
24
+
25
+ Released new version 1.1.0 with all these changes:
26
+ - `Added` Support `skip` individual regression tests through the regression.yaml configuration file. CI/CD guide at https://www.tinybird.co/docs/guides/continuous-integration.html
27
+ - `Added` Fail `tb env regression-tests` if no tests are run for any pipe, use `skip` to avoid the error
28
+ - `Added` Skip POST requests by default in `tb env regression-tests` until it's supported
29
+ - `Added` Support append `--fixtures` to shared Data Sources in Environments
30
+ - `Added` support `--assert-max-time` in `tb env regression-tests` so that serves as threshold for response time and avoid flakiness on fast endpoints.
31
+ - `Added` support `tb env regression-tests --main -f regression.yaml` so you can run regression tests agains the main Environment together with a configuration file.
32
+ - `Added` `tb env regression-tests coverage --main` runs coverage regression tests in the main Environment. This command is experimental and undocumented.
33
+ - `Changed` `tb init --git --folder <folder>` includes the `<folder>` in the CI/CD templates as `data_project_dir` and in the paths to track changes so CI and CD only run when there's a change on that folder. If `<folder>` is not provided then it is set to the current directory `.`
34
+ - `Changed` Force `tb init --git` to run in the `main` or `master` git branch
35
+ - `Changed` the creation of the CD/CI workflow when running `tb init --git` to use the admin workspace token instead of the token of your admin user.
36
+ - `Changed` Expose resources and ids when removing releases `tb release rm`
37
+ - `Changed` `--override-commit` option to not require needing to pass the `--git` option as well. Now, running `tb init --override-commit` should work as expected.
38
+ - `Changed` Copy and Sink on-demand jobs now return the job URL.
39
+ - `Changed` allow Workspace admin tokens for CI/CD workflows. Previously, you were asked for user admin token. You can update your TB_ADMIN_TOKEN to be the Workspace admin token instead the admin token from a specific user. CI/CD guide at https://www.tinybird.co/docs/guides/continuous-integration.html
40
+ - `Changed` Improve CI/CD output. Added warning hint in custom deployments.
41
+ - `Fixed` `tb deploy` raises an error if it detects resources renamed in git
42
+ - `Fixed` On `tb push --force --yes` a BigQuery Data Source, it updates both the `SCHEMA` and connector settings.
43
+ - `Fixed` Connection settings of BigQuery Data Sources are preserved in Environments, although the connection does not sync by design, to ingest data use `--fixtures`
44
+ - `Removed` warning message that recommended not using the admin token for CI/CD workflows as we introduced a fix in the version 1.0.1 to avoid the problems that the admin token was causing.
45
+ - `Removed` fallback when running `tb pipe regression-test` does was doing requests to `/v0/pipes/XXX/requests` as it was mostly not used. This endpoint was being called when there weren't requests in `tinybird.pipe_stats_rt` in the last 7 days. This endpoint was really heavy and most of the time wouldn't return any actual data as endpoint not being called after 7 days most likely are not in production.
46
+ - `Removed` `async` parameter in the `/v0/environments` requests as it's not being used.
47
+
48
+
49
+ 1.0.2dev17
50
+ ************
51
+
52
+ - `Changed` `tb init --git --folder <folder>` includes the `<folder>` in the CI/CD templates as `data_project_dir` and in the paths to track changes so CI and CD only run when there's a change on that folder. If `<folder>` is not provided then it is set to the current directory `.`
22
53
 
23
54
  1.0.2dev16
24
55
  ************
@@ -103,7 +134,7 @@ Changelog
103
134
  1.0.2dev1
104
135
  ************
105
136
 
106
- - `Changed` Improve CI/CD output
137
+ - `Changed` Improve CI/CD output. Added warning hint in custom deployments.
107
138
 
108
139
  1.0.1
109
140
  ************
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
4
4
  __url__ = 'https://docs.tinybird.co/cli.html'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '1.0.2dev16'
8
- __revision__ = '3152eff'
7
+ __version__ = '1.1.0'
8
+ __revision__ = '695ba55'
@@ -142,10 +142,13 @@ def replacements_to_tuples(replacements: dict) -> dict:
142
142
 
143
143
  @lru_cache(maxsize=2**13)
144
144
  def replace_tables_chquery_cached(
145
- sql: str, sorted_replacements: Optional[tuple] = None, default_database: str = ""
145
+ sql: str,
146
+ sorted_replacements: Optional[tuple] = None,
147
+ default_database: str = "",
148
+ output_one_line: bool = False,
146
149
  ) -> str:
147
150
  replacements = dict(sorted_replacements) if sorted_replacements else {}
148
- return chquery.replace_tables(sql, replacements, default_database=default_database)
151
+ return chquery.replace_tables(sql, replacements, default_database=default_database, one_line=output_one_line)
149
152
 
150
153
 
151
154
  def replace_tables(
@@ -155,6 +158,7 @@ def replace_tables(
155
158
  check_functions: bool = False,
156
159
  only_replacements: bool = False,
157
160
  valid_tables: Optional[Set[Tuple[str, str]]] = None,
161
+ output_one_line: bool = False,
158
162
  ) -> str:
159
163
  """
160
164
  Given a query and a list of table replacements, returns the query after applying the table replacements.
@@ -163,7 +167,7 @@ def replace_tables(
163
167
  """
164
168
  if not replacements:
165
169
  # Always call replace_tables to do validation and formatting
166
- return replace_tables_chquery_cached(sql, None)
170
+ return replace_tables_chquery_cached(sql, None, output_one_line=output_one_line)
167
171
 
168
172
  _replaced_with = set()
169
173
  _replacements = ReplacementsDict()
@@ -210,7 +214,7 @@ def replace_tables(
210
214
  deps_sorted = list(reversed(list(toposort(deps))))
211
215
 
212
216
  if not deps_sorted:
213
- return replace_tables_chquery_cached(sql, None)
217
+ return replace_tables_chquery_cached(sql, None, output_one_line=output_one_line)
214
218
 
215
219
  for current_deps in deps_sorted:
216
220
  current_replacements = {}
@@ -232,9 +236,11 @@ def replace_tables(
232
236
  if current_replacements:
233
237
  # We need to transform the dictionary into something cacheable, so a sorted tuple of tuples it is
234
238
  r = tuple(sorted([(k, v) for k, v in current_replacements.items()]))
235
- sql = replace_tables_chquery_cached(sql, r, default_database=default_database)
239
+ sql = replace_tables_chquery_cached(
240
+ sql, r, default_database=default_database, output_one_line=output_one_line
241
+ )
236
242
  else:
237
- sql = replace_tables_chquery_cached(sql, None)
243
+ sql = replace_tables_chquery_cached(sql, None, output_one_line=output_one_line)
238
244
 
239
245
  return sql
240
246
 
@@ -28,9 +28,12 @@ GITHUB_CI_YML = """
28
28
  workflow_dispatch:
29
29
  pull_request:
30
30
  branches:
31
- - main
32
- - master
31
+ - main
32
+ - master
33
33
  types: [opened, reopened, labeled, unlabeled, synchronize, closed]
34
+ paths:
35
+ - '$data_project_dir/**/*'
36
+ - '$data_project_dir/*'
34
37
 
35
38
  concurrency: ${{ github.workflow }}-${{ github.event.pull_request.number }}
36
39
 
@@ -38,7 +41,7 @@ GITHUB_CI_YML = """
38
41
  ci: # ci using environments from workspace '$workspace_name'
39
42
  uses: tinybirdco/ci/.github/workflows/ci.yml@v2.3.0
40
43
  with:
41
- data_project_dir: .
44
+ data_project_dir: $data_project_dir
42
45
  secrets:
43
46
  tb_admin_token: ${{ secrets.TB_ADMIN_TOKEN }} # set the Workspace admin token in GitHub secrets
44
47
  tb_host: $tb_host
@@ -58,12 +61,15 @@ GITHUB_CD_YML = """
58
61
  branches:
59
62
  - main
60
63
  - master
64
+ paths:
65
+ - '$data_project_dir/**/*'
66
+ - '$data_project_dir/*'
61
67
  jobs:
62
68
  cd: # deploy changes to workspace '$workspace_name'
63
69
  uses: tinybirdco/ci/.github/workflows/cd.yml@v2.3.0
64
70
  with:
65
71
  tb_deploy: false
66
- data_project_dir: .
72
+ data_project_dir: $data_project_dir
67
73
  secrets:
68
74
  tb_admin_token: ${{ secrets.TB_ADMIN_TOKEN }} # set the Workspace admin token in GitHub secrets
69
75
  tb_host: $tb_host
@@ -81,18 +87,27 @@ GITLAB_YML = """
81
87
  .ci_config_rules:
82
88
  - &ci_config_rule
83
89
  if: $CI_PIPELINE_SOURCE == "merge_request_event"
90
+ changes:
91
+ - $data_project_dir/*
92
+ - $data_project_dir/**/*
84
93
  - &ci_cleanup_rule
85
94
  if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
95
+ changes:
96
+ - $data_project_dir/*
97
+ - $data_project_dir/**/*
86
98
 
87
99
  .cd_config_rules:
88
100
  - &cd_config_rule
89
101
  if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
102
+ changes:
103
+ - $data_project_dir/*
104
+ - $data_project_dir/**/*
90
105
 
91
106
  .cicd_variables:
92
107
  variables: &cicd_variables
93
108
  TB_HOST: "$tb_host"
94
109
  TB_ADMIN_TOKEN: $TB_ADMIN_TOKEN # set the Workspace admin token in GitLab CI/CD Variables
95
- DATA_PROJECT_DIR: "."
110
+ DATA_PROJECT_DIR: "$data_project_dir"
96
111
  TB_DEPLOY: "false"
97
112
 
98
113
  run_ci: # ci using environments from workspace '$workspace_name'
@@ -217,12 +232,18 @@ def ask_provider_interactively():
217
232
  provider_index = -1
218
233
 
219
234
 
220
- async def init_cicd(client: TinyB, workspace: Dict[str, Any], config: Dict[str, Any], path: Optional[str] = None):
235
+ async def init_cicd(
236
+ client: TinyB,
237
+ workspace: Dict[str, Any],
238
+ config: Dict[str, Any],
239
+ path: Optional[str] = None,
240
+ data_project_dir: Optional[str] = None,
241
+ ):
221
242
  provider = ask_provider_interactively()
222
243
  if provider:
223
244
  path = path if path else getcwd()
245
+ data_project_dir = data_project_dir if data_project_dir else "."
224
246
  generator = CICDGeneratorBase.build_generator(provider)
225
-
226
247
  workspace_info = await client.workspace_info()
227
248
  token = await client.get_token_by_name("admin token")
228
249
  params = {
@@ -230,6 +251,7 @@ async def init_cicd(client: TinyB, workspace: Dict[str, Any], config: Dict[str,
230
251
  "workspace_name": workspace_info["name"],
231
252
  "token_name": token["name"],
232
253
  "token_id": token["id"],
254
+ "data_project_dir": data_project_dir,
233
255
  }
234
256
  warning_message = generator(path, params)
235
257
  if warning_message:
@@ -415,7 +415,10 @@ async def init(
415
415
  click.echo(FeedbackManager.info_cicd_already_exists(provider=cicd_provider.name))
416
416
  else:
417
417
  if click.confirm(FeedbackManager.prompt_init_cicd(), default=True):
418
- await init_cicd(client, current_ws, config, path=cli_git_release.working_dir())
418
+ data_project_dir = os.path.relpath(folder, cli_git_release.working_dir())
419
+ await init_cicd(
420
+ client, current_ws, config, path=cli_git_release.working_dir(), data_project_dir=data_project_dir
421
+ )
419
422
 
420
423
  click.echo(final_response)
421
424
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 1.0.2.dev16
3
+ Version: 1.1.0
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://docs.tinybird.co/cli.html
6
6
  Author: Tinybird
@@ -19,6 +19,37 @@ Changelog
19
19
 
20
20
  ---------
21
21
 
22
+ 1.1.0
23
+ ************
24
+
25
+ Released new version 1.1.0 with all these changes:
26
+ - `Added` Support `skip` individual regression tests through the regression.yaml configuration file. CI/CD guide at https://www.tinybird.co/docs/guides/continuous-integration.html
27
+ - `Added` Fail `tb env regression-tests` if no tests are run for any pipe, use `skip` to avoid the error
28
+ - `Added` Skip POST requests by default in `tb env regression-tests` until it's supported
29
+ - `Added` Support append `--fixtures` to shared Data Sources in Environments
30
+ - `Added` support `--assert-max-time` in `tb env regression-tests` so that serves as threshold for response time and avoid flakiness on fast endpoints.
31
+ - `Added` support `tb env regression-tests --main -f regression.yaml` so you can run regression tests agains the main Environment together with a configuration file.
32
+ - `Added` `tb env regression-tests coverage --main` runs coverage regression tests in the main Environment. This command is experimental and undocumented.
33
+ - `Changed` `tb init --git --folder <folder>` includes the `<folder>` in the CI/CD templates as `data_project_dir` and in the paths to track changes so CI and CD only run when there's a change on that folder. If `<folder>` is not provided then it is set to the current directory `.`
34
+ - `Changed` Force `tb init --git` to run in the `main` or `master` git branch
35
+ - `Changed` the creation of the CD/CI workflow when running `tb init --git` to use the admin workspace token instead of the token of your admin user.
36
+ - `Changed` Expose resources and ids when removing releases `tb release rm`
37
+ - `Changed` `--override-commit` option to not require needing to pass the `--git` option as well. Now, running `tb init --override-commit` should work as expected.
38
+ - `Changed` Copy and Sink on-demand jobs now return the job URL.
39
+ - `Changed` allow Workspace admin tokens for CI/CD workflows. Previously, you were asked for user admin token. You can update your TB_ADMIN_TOKEN to be the Workspace admin token instead the admin token from a specific user. CI/CD guide at https://www.tinybird.co/docs/guides/continuous-integration.html
40
+ - `Changed` Improve CI/CD output. Added warning hint in custom deployments.
41
+ - `Fixed` `tb deploy` raises an error if it detects resources renamed in git
42
+ - `Fixed` On `tb push --force --yes` a BigQuery Data Source, it updates both the `SCHEMA` and connector settings.
43
+ - `Fixed` Connection settings of BigQuery Data Sources are preserved in Environments, although the connection does not sync by design, to ingest data use `--fixtures`
44
+ - `Removed` warning message that recommended not using the admin token for CI/CD workflows as we introduced a fix in the version 1.0.1 to avoid the problems that the admin token was causing.
45
+ - `Removed` fallback when running `tb pipe regression-test` does was doing requests to `/v0/pipes/XXX/requests` as it was mostly not used. This endpoint was being called when there weren't requests in `tinybird.pipe_stats_rt` in the last 7 days. This endpoint was really heavy and most of the time wouldn't return any actual data as endpoint not being called after 7 days most likely are not in production.
46
+ - `Removed` `async` parameter in the `/v0/environments` requests as it's not being used.
47
+
48
+
49
+ 1.0.2dev17
50
+ ************
51
+
52
+ - `Changed` `tb init --git --folder <folder>` includes the `<folder>` in the CI/CD templates as `data_project_dir` and in the paths to track changes so CI and CD only run when there's a change on that folder. If `<folder>` is not provided then it is set to the current directory `.`
22
53
 
23
54
  1.0.2dev16
24
55
  ************
@@ -103,7 +134,7 @@ Changelog
103
134
  1.0.2dev1
104
135
  ************
105
136
 
106
- - `Changed` Improve CI/CD output
137
+ - `Changed` Improve CI/CD output. Added warning hint in custom deployments.
107
138
 
108
139
  1.0.1
109
140
  ************