tinybird-cli 5.13.2.dev1__tar.gz → 5.13.3__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 (49) hide show
  1. {tinybird-cli-5.13.2.dev1/tinybird_cli.egg-info → tinybird_cli-5.13.3}/PKG-INFO +16 -5
  2. tinybird_cli-5.13.3/tinybird/__cli__.py +8 -0
  3. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/context.py +1 -0
  4. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/datafile.py +55 -1
  5. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/feedback_manager.py +6 -0
  6. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/sql_template.py +21 -2
  7. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/common.py +19 -17
  8. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3/tinybird_cli.egg-info}/PKG-INFO +15 -4
  9. tinybird-cli-5.13.2.dev1/tinybird/__cli__.py +0 -8
  10. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/setup.cfg +0 -0
  11. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/ch_utils/constants.py +0 -0
  12. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/ch_utils/engine.py +0 -0
  13. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/check_pypi.py +0 -0
  14. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/client.py +0 -0
  15. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/config.py +0 -0
  16. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/connectors.py +0 -0
  17. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/datatypes.py +0 -0
  18. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/git_settings.py +0 -0
  19. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/sql.py +0 -0
  20. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/sql_template_fmt.py +0 -0
  21. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/sql_toolset.py +0 -0
  22. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/syncasync.py +0 -0
  23. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli.py +0 -0
  24. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/auth.py +0 -0
  25. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/branch.py +0 -0
  26. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/cicd.py +0 -0
  27. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/cli.py +0 -0
  28. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/config.py +0 -0
  29. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/connection.py +0 -0
  30. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/datasource.py +0 -0
  31. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/exceptions.py +0 -0
  32. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/fmt.py +0 -0
  33. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/job.py +0 -0
  34. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/pipe.py +0 -0
  35. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/regions.py +0 -0
  36. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/tag.py +0 -0
  37. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/telemetry.py +0 -0
  38. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/test.py +0 -0
  39. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  40. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  41. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/token.py +0 -0
  42. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/workspace.py +0 -0
  43. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  44. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird/tornado_template.py +0 -0
  45. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird_cli.egg-info/SOURCES.txt +0 -0
  46. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird_cli.egg-info/dependency_links.txt +0 -0
  47. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird_cli.egg-info/entry_points.txt +0 -0
  48. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird_cli.egg-info/requires.txt +0 -0
  49. {tinybird-cli-5.13.2.dev1 → tinybird_cli-5.13.3}/tinybird_cli.egg-info/top_level.txt +0 -0
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
- Name: tinybird-cli
3
- Version: 5.13.2.dev1
2
+ Name: tinybird_cli
3
+ Version: 5.13.3
4
4
  Summary: Tinybird Command Line Tool
5
- Home-page: https://www.tinybird.co/docs/cli/introduction.html
5
+ Home-page: https://www.tinybird.co/docs/cli
6
6
  Author: Tinybird
7
7
  Author-email: support@tinybird.co
8
8
  Requires-Python: >=3.9, <3.13
@@ -18,11 +18,22 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
18
18
  Changelog
19
19
  ----------
20
20
 
21
- 5.13.2.dev1
21
+ 5.13.3
22
22
  ***********
23
23
 
24
- - Added `eu-west-1` region to the list of available regions.
24
+ - `Fixed` updating the cron schedule of a BigQuery data source when having a query but no external_data_source setting.
25
+ - `Fixed` handle Kafka connector with multiple brokers properly.
25
26
 
27
+ 5.13.2
28
+ ***********
29
+
30
+ - `Fixed` Correctly handle Kafka connector with multiple brokers
31
+
32
+ 5.13.1.dev2
33
+ ***********
34
+
35
+ - `Added` comply with [PEP 625](https://peps.python.org/pep-0625/)
36
+ - `Added` `eu-west-1` region to the list of available regions.
26
37
 
27
38
  5.13.1
28
39
  ***********
@@ -0,0 +1,8 @@
1
+
2
+ __name__ = 'tinybird_cli'
3
+ __description__ = 'Tinybird Command Line Tool'
4
+ __url__ = 'https://www.tinybird.co/docs/cli'
5
+ __author__ = 'Tinybird'
6
+ __author_email__ = 'support@tinybird.co'
7
+ __version__ = '5.13.3'
8
+ __revision__ = '3595fd7'
@@ -21,3 +21,4 @@ wait_parameter: ContextVar[bool] = ContextVar("wait_parameter")
21
21
  api_host: ContextVar[str] = ContextVar("api_host")
22
22
  ff_split_to_array_escape: ContextVar[bool] = ContextVar("ff_split_to_array_escape")
23
23
  ff_preprocess_parameters_circuit_breaker: ContextVar[bool] = ContextVar("ff_preprocess_parameters_circuit_breaker")
24
+ ff_column_json_backticks_circuit_breaker: ContextVar[bool] = ContextVar("ff_column_json_backticks_circuit_breaker")
@@ -3434,14 +3434,33 @@ async def new_ds(
3434
3434
  DATASOURCE_VALID_SERVICES_TO_UPDATE = ["bigquery", "snowflake"]
3435
3435
  if datasource_exists and service and service in [*DATASOURCE_VALID_SERVICES_TO_UPDATE, *PREVIEW_CONNECTOR_SERVICES]:
3436
3436
  connector_required_params = {
3437
- "bigquery": ["service", "cron", "external_data_source"],
3437
+ "bigquery": ["service", "cron"],
3438
3438
  "snowflake": ["connector", "service", "cron", "external_data_source"],
3439
3439
  "s3": ["connector", "service", "cron", "bucket_uri"],
3440
3440
  "s3_iamrole": ["connector", "service", "cron", "bucket_uri"],
3441
3441
  "gcs": ["connector", "service", "cron", "bucket_uri"],
3442
3442
  }.get(service, [])
3443
3443
 
3444
+ connector_at_least_one_required_param = {
3445
+ "bigquery": ["external_data_source", "query"],
3446
+ }.get(service, [])
3447
+
3448
+ if connector_at_least_one_required_param and not any(
3449
+ key in ds_params for key in connector_at_least_one_required_param
3450
+ ):
3451
+ params = [
3452
+ (ImportReplacements.get_datafile_param_for_linker_param(service, param) or param).upper()
3453
+ for param in connector_at_least_one_required_param
3454
+ ]
3455
+ click.echo(FeedbackManager.error_updating_connector_missing_at_least_one_param(param=" or ".join(params)))
3456
+ return
3457
+
3444
3458
  if not all(key in ds_params for key in connector_required_params):
3459
+ params = [
3460
+ (ImportReplacements.get_datafile_param_for_linker_param(service, param) or param).upper()
3461
+ for param in connector_required_params
3462
+ ]
3463
+ click.echo(FeedbackManager.error_updating_connector_missing_params(param=", ".join(params)))
3445
3464
  return
3446
3465
 
3447
3466
  connector = ds_params.get("connector", None)
@@ -5589,3 +5608,38 @@ def is_file_a_datasource(filename: str) -> bool:
5589
5608
  return True
5590
5609
 
5591
5610
  return False
5611
+
5612
+
5613
+ def update_connector_params(service: str, ds_params: Dict[str, Any], connector_required_params: List[str]) -> None:
5614
+ """
5615
+ Update connector parameters for a given service, ensuring required parameters exist.
5616
+
5617
+ :param service: The name of the service (e.g., 'bigquery').
5618
+ :param ds_params: The data source parameters to be checked.
5619
+ :param connector_required_params: The list of required parameters for the connector.
5620
+ :return: None
5621
+ """
5622
+
5623
+ connector_at_least_one_required_param: List[str] = {
5624
+ "bigquery": ["external_data_source", "query"],
5625
+ }.get(service, [])
5626
+
5627
+ # Handle the "at least one param" requirement
5628
+ if connector_at_least_one_required_param and not any(
5629
+ key in ds_params for key in connector_at_least_one_required_param
5630
+ ):
5631
+ params = [
5632
+ (ImportReplacements.get_datafile_param_for_linker_param(service, param) or param).upper()
5633
+ for param in connector_at_least_one_required_param
5634
+ ]
5635
+ click.echo(FeedbackManager.error_updating_connector_missing_at_least_one_param(param=" or ".join(params)))
5636
+ return
5637
+
5638
+ # Handle the mandatory params requirement
5639
+ if not all(key in ds_params for key in connector_required_params):
5640
+ params = [
5641
+ (ImportReplacements.get_datafile_param_for_linker_param(service, param) or param).upper()
5642
+ for param in connector_required_params
5643
+ ]
5644
+ click.echo(FeedbackManager.error_updating_connector_missing_params(param=", ".join(params)))
5645
+ return
@@ -130,6 +130,12 @@ class FeedbackManager:
130
130
  error_remove_no_endpoint = error_message("Pipe does not have any endpoint")
131
131
  error_updating_pipe = error_message("Failed updating pipe {error}")
132
132
  error_updating_connector_not_supported = error_message("Changing {param} is not currently supported")
133
+ error_updating_connector_missing_at_least_one_param = error_message(
134
+ "Connection settings not updated. Connection info should have at least one of {param} settings"
135
+ )
136
+ error_updating_connector_missing_params = error_message(
137
+ "Connection settings not updated. Connection info should have {param} settings"
138
+ )
133
139
  error_removing_node = error_message("Failed removing node from pipe {pipe}: {error}")
134
140
  error_pushing_pipe = error_message("Failed pushing pipe {pipe}: {error}")
135
141
  error_creating_endpoint = error_message("Failed creating endpoint in node {node} on pipe {pipe}: {error}")
@@ -12,7 +12,11 @@ from typing import Any, Dict, List, Optional, Tuple, Union
12
12
  from tornado import escape
13
13
  from tornado.util import ObjectDict, exec_in, unicode_type
14
14
 
15
- from tinybird.context import ff_preprocess_parameters_circuit_breaker, ff_split_to_array_escape
15
+ from tinybird.context import (
16
+ ff_column_json_backticks_circuit_breaker,
17
+ ff_preprocess_parameters_circuit_breaker,
18
+ ff_split_to_array_escape,
19
+ )
16
20
 
17
21
  from .datatypes import testers
18
22
  from .tornado_template import VALID_CUSTOM_FUNCTION_NAMES, SecurityException, Template
@@ -271,6 +275,8 @@ def columns(x, default=None, fn=None):
271
275
 
272
276
 
273
277
  def column(x, default=None):
278
+ bypass_colunn_json_backticks = ff_column_json_backticks_circuit_breaker.get(False)
279
+
274
280
  if x is None or isinstance(x, Placeholder):
275
281
  if default is None:
276
282
  raise SQLTemplateException(
@@ -278,7 +284,18 @@ def column(x, default=None):
278
284
  documentation="/cli/advanced-templates.html#column",
279
285
  )
280
286
  x = default
281
- return Symbol("`" + sqlescape(x) + "`")
287
+
288
+ quote = "`"
289
+ if bypass_colunn_json_backticks:
290
+ return Symbol(quote + sqlescape(x) + quote)
291
+
292
+ try:
293
+ slices = x.split(".")
294
+ escaped_slices = [quote + sqlescape(s) + quote for s in slices]
295
+ escaped = ".".join(escaped_slices)
296
+ return Symbol(escaped)
297
+ except Exception: # in case there's a problem with .split
298
+ return Symbol(quote + sqlescape(x) + quote)
282
299
 
283
300
 
284
301
  def symbol(x, quote="`"):
@@ -2109,6 +2126,8 @@ def render_sql_template(
2109
2126
  ('SELECT `foo`', {}, [])
2110
2127
  >>> render_sql_template("SELECT {{column(agg)}}", {'agg': '"foo"'})
2111
2128
  ('SELECT `foo`', {}, [])
2129
+ >>> render_sql_template("SELECT {{column(agg)}}", {'agg': 'json.a'})
2130
+ ('SELECT `json`.`a`', {}, [])
2112
2131
  >>> render_sql_template('{% if not defined(test) %}error("This is an error"){% end %}', {})
2113
2132
  ('error("This is an error")', {}, [])
2114
2133
  >>> render_sql_template('{% if not defined(test) %}custom_error({error: "This is an error"}){% end %}', {})
@@ -1252,26 +1252,28 @@ def is_url_valid(url):
1252
1252
  return False
1253
1253
 
1254
1254
 
1255
- def validate_kafka_bootstrap_servers(host_and_port):
1256
- if not isinstance(host_and_port, str):
1255
+ def validate_kafka_bootstrap_servers(bootstrap_servers):
1256
+ if not isinstance(bootstrap_servers, str):
1257
1257
  raise CLIException(FeedbackManager.error_kafka_bootstrap_server())
1258
- parts = host_and_port.split(":")
1259
- if len(parts) > 2:
1260
- raise CLIException(FeedbackManager.error_kafka_bootstrap_server())
1261
- host = parts[0]
1262
- port_str = parts[1] if len(parts) == 2 else "9092"
1263
- try:
1264
- port = int(port_str)
1265
- except Exception:
1266
- raise CLIException(FeedbackManager.error_kafka_bootstrap_server())
1267
- with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
1258
+
1259
+ for host_and_port in bootstrap_servers.split(","):
1260
+ parts = host_and_port.split(":")
1261
+ if len(parts) > 2:
1262
+ raise CLIException(FeedbackManager.error_kafka_bootstrap_server())
1263
+ host = parts[0]
1264
+ port_str = parts[1] if len(parts) == 2 else "9092"
1268
1265
  try:
1269
- sock.settimeout(3)
1270
- sock.connect((host, port))
1271
- except socket.timeout:
1272
- raise CLIException(FeedbackManager.error_kafka_bootstrap_server_conn_timeout())
1266
+ port = int(port_str)
1273
1267
  except Exception:
1274
- raise CLIException(FeedbackManager.error_kafka_bootstrap_server_conn())
1268
+ raise CLIException(FeedbackManager.error_kafka_bootstrap_server())
1269
+ with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
1270
+ try:
1271
+ sock.settimeout(3)
1272
+ sock.connect((host, port))
1273
+ except socket.timeout:
1274
+ raise CLIException(FeedbackManager.error_kafka_bootstrap_server_conn_timeout())
1275
+ except Exception:
1276
+ raise CLIException(FeedbackManager.error_kafka_bootstrap_server_conn())
1275
1277
 
1276
1278
 
1277
1279
  def validate_kafka_key(s):
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 5.13.2.dev1
3
+ Version: 5.13.3
4
4
  Summary: Tinybird Command Line Tool
5
- Home-page: https://www.tinybird.co/docs/cli/introduction.html
5
+ Home-page: https://www.tinybird.co/docs/cli
6
6
  Author: Tinybird
7
7
  Author-email: support@tinybird.co
8
8
  Requires-Python: >=3.9, <3.13
@@ -18,11 +18,22 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
18
18
  Changelog
19
19
  ----------
20
20
 
21
- 5.13.2.dev1
21
+ 5.13.3
22
22
  ***********
23
23
 
24
- - Added `eu-west-1` region to the list of available regions.
24
+ - `Fixed` updating the cron schedule of a BigQuery data source when having a query but no external_data_source setting.
25
+ - `Fixed` handle Kafka connector with multiple brokers properly.
25
26
 
27
+ 5.13.2
28
+ ***********
29
+
30
+ - `Fixed` Correctly handle Kafka connector with multiple brokers
31
+
32
+ 5.13.1.dev2
33
+ ***********
34
+
35
+ - `Added` comply with [PEP 625](https://peps.python.org/pep-0625/)
36
+ - `Added` `eu-west-1` region to the list of available regions.
26
37
 
27
38
  5.13.1
28
39
  ***********
@@ -1,8 +0,0 @@
1
-
2
- __name__ = 'tinybird-cli'
3
- __description__ = 'Tinybird Command Line Tool'
4
- __url__ = 'https://www.tinybird.co/docs/cli/introduction.html'
5
- __author__ = 'Tinybird'
6
- __author_email__ = 'support@tinybird.co'
7
- __version__ = '5.13.2.dev1'
8
- __revision__ = '26dd72d'