tinybird-cli 5.13.2.dev1__py3-none-any.whl → 5.13.2.dev2__py3-none-any.whl

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.
tinybird/__cli__.py CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
- __name__ = 'tinybird-cli'
2
+ __name__ = 'tinybird_cli'
3
3
  __description__ = 'Tinybird Command Line Tool'
4
- __url__ = 'https://www.tinybird.co/docs/cli/introduction.html'
4
+ __url__ = 'https://www.tinybird.co/docs/cli'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '5.13.2.dev1'
8
- __revision__ = '26dd72d'
7
+ __version__ = '5.13.2.dev2'
8
+ __revision__ = '127fab9'
tinybird/context.py CHANGED
@@ -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")
tinybird/sql_template.py CHANGED
@@ -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 %}', {})
@@ -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.2.dev2
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
@@ -52,12 +52,16 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
52
52
  Changelog
53
53
  ----------
54
54
 
55
+ 5.13.1.dev2
56
+ ***********
57
+
58
+ - `Added` comply with [PEP 625](https://peps.python.org/pep-0625/)
59
+
55
60
  5.13.2.dev1
56
61
  ***********
57
62
 
58
63
  - Added `eu-west-1` region to the list of available regions.
59
64
 
60
-
61
65
  5.13.1
62
66
  ***********
63
67
 
@@ -1,15 +1,15 @@
1
- tinybird/__cli__.py,sha256=UaDgCU22h-6Iznt3n6P5jyKl2_yslXAOsBcoKCw-of0,255
1
+ tinybird/__cli__.py,sha256=cmknWFcveEgGsPw8jISuAz-FM64DGwf6vUWT0koCSvo,237
2
2
  tinybird/check_pypi.py,sha256=_4NkharLyR_ELrAdit-ftqIWvOf7jZNPt3i76frlo9g,975
3
3
  tinybird/client.py,sha256=RirJVGZxLKH6yk7m_pnOaYsYoX_zTqXffdr2sk39_fk,50511
4
4
  tinybird/config.py,sha256=ENRNyEMXHj_P882o31iFz0hTveziLabVRrxiWE5RRBE,6233
5
5
  tinybird/connectors.py,sha256=lkpVSUmSuViEZBa4QjTK7YmPHUop0a5UFoTrSmlVq6k,15244
6
- tinybird/context.py,sha256=kutUQ0kCwparowI74_YLXx6wtTzGLRouJ6oGHVBPzBo,1291
6
+ tinybird/context.py,sha256=eeFneyn_oTUoTIfst59CnSkskchvnWuRvyI7UKRFq14,1407
7
7
  tinybird/datafile.py,sha256=deNsQPZOzsgFYJDAC8ut_BoCBHzB942DsfCGXox7Z1g,229459
8
8
  tinybird/datatypes.py,sha256=XNypumfqNjsvLJ5iNXnbVHRvAJe0aQwI3lS6Cxox-e0,10979
9
9
  tinybird/feedback_manager.py,sha256=cNUbt0Jxim02UiIdlyP12DJfXfFFzxDCfJK9XRWZ9A0,67488
10
10
  tinybird/git_settings.py,sha256=Sw_8rGmribEFJ4Z_6idrVytxpFYk7ez8ei0qHULzs3E,3934
11
11
  tinybird/sql.py,sha256=eulpRe05ZFrKFrxYawgxDxxrktFE8uL6hSL1gHIWKyg,46166
12
- tinybird/sql_template.py,sha256=IqYRfUxDYBCoOYjqqvn--_8QXLv9FSRnJ0bInx7q1Xs,93051
12
+ tinybird/sql_template.py,sha256=GmMLAI10MTqjQo9qztuQHLRWs67teozsWDxUBdvkAn4,93668
13
13
  tinybird/sql_template_fmt.py,sha256=1z-PuqSZXtzso8Z_mPqUc-NxIxUrNUcVIPezNieZk-M,10196
14
14
  tinybird/sql_toolset.py,sha256=HAo6xtCjlbhikdpK6xfMC_RvEG6uzRropwhKSHEkIIc,14343
15
15
  tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
@@ -38,8 +38,8 @@ tinybird/tb_cli_modules/workspace.py,sha256=N8f1dl4BYc34ucmJ6oNZc4XZMGKd8m0Fhq7o
38
38
  tinybird/tb_cli_modules/workspace_members.py,sha256=ksXsjd233y9-sNlz4Qb-meZbX4zn1B84e_bSm2i8rhg,8731
39
39
  tinybird/tb_cli_modules/tinyunit/tinyunit.py,sha256=_ydOD4WxmKy7_h-d3fG62w_0_lD0uLl9w4EbEYtwd0U,11720
40
40
  tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py,sha256=hGh1ZaXC1af7rKnX7222urkj0QJMhMWclqMy59dOqwE,1922
41
- tinybird_cli-5.13.2.dev1.dist-info/METADATA,sha256=E4jfSvuPfIZeHiVQspeqE_UU40fUX2pjqK_4Z4TAN_Q,78602
42
- tinybird_cli-5.13.2.dev1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
43
- tinybird_cli-5.13.2.dev1.dist-info/entry_points.txt,sha256=PKPKuPmA4IfJYnCFHHUiw-aAWZuBomFvwCklv1OyCjE,43
44
- tinybird_cli-5.13.2.dev1.dist-info/top_level.txt,sha256=pgw6AzERHBcW3YTi2PW4arjxLkulk2msOz_SomfOEuc,45
45
- tinybird_cli-5.13.2.dev1.dist-info/RECORD,,
41
+ tinybird_cli-5.13.2.dev2.dist-info/METADATA,sha256=r-JBb0P5DH1J_-IF9hAPN5rqQO6tDTdyRvf7ROweqnc,78676
42
+ tinybird_cli-5.13.2.dev2.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
43
+ tinybird_cli-5.13.2.dev2.dist-info/entry_points.txt,sha256=PKPKuPmA4IfJYnCFHHUiw-aAWZuBomFvwCklv1OyCjE,43
44
+ tinybird_cli-5.13.2.dev2.dist-info/top_level.txt,sha256=pgw6AzERHBcW3YTi2PW4arjxLkulk2msOz_SomfOEuc,45
45
+ tinybird_cli-5.13.2.dev2.dist-info/RECORD,,