tinybird-cli 3.0.2.dev1__tar.gz → 3.0.2.dev2__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.
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/PKG-INFO +7 -2
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/__cli__.py +2 -2
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/git_settings.py +1 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/sql_template_fmt.py +48 -25
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird_cli.egg-info/PKG-INFO +7 -2
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/setup.cfg +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/check_pypi.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/client.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/config.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/connector_settings.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/connectors.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/context.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/datafile.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/datatypes.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/feedback_manager.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/sql.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/sql_template.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/sql_toolset.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/syncasync.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/token.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tornado_template.py +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird_cli.egg-info/SOURCES.txt +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird_cli.egg-info/dependency_links.txt +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird_cli.egg-info/entry_points.txt +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird_cli.egg-info/requires.txt +0 -0
- {tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/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: 3.0.2.
|
|
3
|
+
Version: 3.0.2.dev2
|
|
4
4
|
Summary: Tinybird Command Line Tool
|
|
5
5
|
Home-page: https://docs.tinybird.co/cli.html
|
|
6
6
|
Author: Tinybird
|
|
@@ -19,6 +19,11 @@ Changelog
|
|
|
19
19
|
|
|
20
20
|
---------
|
|
21
21
|
|
|
22
|
+
3.0.2.dev2
|
|
23
|
+
************
|
|
24
|
+
|
|
25
|
+
- `Changed` Internal changes to allow parametrize fmt
|
|
26
|
+
|
|
22
27
|
3.0.1
|
|
23
28
|
************
|
|
24
29
|
|
|
@@ -2486,4 +2491,4 @@ env=test tb push file.datasource
|
|
|
2486
2491
|
*******************
|
|
2487
2492
|
- Limited the amount of rows fetched when running ``tb sql`` to 100. Added ``--row-limit``.
|
|
2488
2493
|
- Fixed warning when pipes use internal tables like ``datasources_ops_log``
|
|
2489
|
-
- Raise an error when ``INSERT`` sql statement is used
|
|
2494
|
+
- Raise an error when ``INSERT`` sql statement is used.
|
|
@@ -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__ = '3.0.2.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '3.0.2.dev2'
|
|
8
|
+
__revision__ = 'bd19d6e'
|
|
@@ -4,7 +4,7 @@ from types import MethodType
|
|
|
4
4
|
from typing import Any, Dict, List, Optional
|
|
5
5
|
|
|
6
6
|
from sqlfmt import actions, api
|
|
7
|
-
from sqlfmt.analyzer import Rule, group
|
|
7
|
+
from sqlfmt.analyzer import Analyzer, Rule, group
|
|
8
8
|
from sqlfmt.comment import Comment
|
|
9
9
|
from sqlfmt.dialect import ClickHouse
|
|
10
10
|
from sqlfmt.jinjafmt import JinjaFormatter, JinjaTag
|
|
@@ -63,25 +63,6 @@ def from_nodes(
|
|
|
63
63
|
return line
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
def standardize_value(cls, token: Token) -> str:
|
|
67
|
-
"""
|
|
68
|
-
Tinybird => Monkey patched to not lower keywords
|
|
69
|
-
https://github.com/tconbeer/sqlfmt/blob/c11775b92d8a45f0e91d871b81a88a894d620bec/src/sqlfmt/node_manager.py#L215
|
|
70
|
-
"""
|
|
71
|
-
if token.type in (
|
|
72
|
-
TokenType.UNTERM_KEYWORD,
|
|
73
|
-
TokenType.STATEMENT_START,
|
|
74
|
-
TokenType.STATEMENT_END,
|
|
75
|
-
TokenType.WORD_OPERATOR,
|
|
76
|
-
TokenType.ON,
|
|
77
|
-
TokenType.BOOLEAN_OPERATOR,
|
|
78
|
-
TokenType.SET_OPERATOR,
|
|
79
|
-
):
|
|
80
|
-
return " ".join(token.token.split())
|
|
81
|
-
else:
|
|
82
|
-
return token.token
|
|
83
|
-
|
|
84
|
-
|
|
85
66
|
def _format_jinja_node(self, node: Node, max_length: int) -> bool:
|
|
86
67
|
"""
|
|
87
68
|
Format a single jinja tag. No-ops for nodes that
|
|
@@ -127,10 +108,36 @@ def _format_jinja_node(self, node: Node, max_length: int) -> bool:
|
|
|
127
108
|
|
|
128
109
|
# Some monkey patching
|
|
129
110
|
Line.from_nodes = MethodType(from_nodes, Line)
|
|
130
|
-
NodeManager.standardize_value = MethodType(standardize_value, NodeManager)
|
|
131
111
|
JinjaFormatter._format_jinja_node = MethodType(_format_jinja_node, JinjaFormatter)
|
|
132
112
|
|
|
133
113
|
|
|
114
|
+
class TinybirdNodeManager(NodeManager):
|
|
115
|
+
def __init__(self, case_sensitive_names: bool, lower_keywords: bool) -> None:
|
|
116
|
+
super().__init__(case_sensitive_names)
|
|
117
|
+
self.lower_keywords = lower_keywords
|
|
118
|
+
|
|
119
|
+
def standardize_value(self, token: Token) -> str:
|
|
120
|
+
"""
|
|
121
|
+
Tinybird => Patched to not lower keywords
|
|
122
|
+
https://github.com/tconbeer/sqlfmt/blob/c11775b92d8a45f0e91d871b81a88a894d620bec/src/sqlfmt/node_manager.py#L215
|
|
123
|
+
"""
|
|
124
|
+
if self.lower_keywords:
|
|
125
|
+
return super().standardize_value(token)
|
|
126
|
+
|
|
127
|
+
if token.type in (
|
|
128
|
+
TokenType.UNTERM_KEYWORD,
|
|
129
|
+
TokenType.STATEMENT_START,
|
|
130
|
+
TokenType.STATEMENT_END,
|
|
131
|
+
TokenType.WORD_OPERATOR,
|
|
132
|
+
TokenType.ON,
|
|
133
|
+
TokenType.BOOLEAN_OPERATOR,
|
|
134
|
+
TokenType.SET_OPERATOR,
|
|
135
|
+
):
|
|
136
|
+
return " ".join(token.token.split())
|
|
137
|
+
else:
|
|
138
|
+
return token.token
|
|
139
|
+
|
|
140
|
+
|
|
134
141
|
class TinybirdDialect(ClickHouse):
|
|
135
142
|
"""
|
|
136
143
|
This is an extension of the base rules.
|
|
@@ -142,8 +149,9 @@ class TinybirdDialect(ClickHouse):
|
|
|
142
149
|
https://github.com/tconbeer/sqlfmt/blob/c11775b92d8a45f0e91d871b81a88a894d620bec/src/sqlfmt/dialect.py#L55
|
|
143
150
|
"""
|
|
144
151
|
|
|
145
|
-
def __init__(self) -> None:
|
|
152
|
+
def __init__(self, lower_keywords: bool = False) -> None:
|
|
146
153
|
super().__init__()
|
|
154
|
+
self.lower_keywords = lower_keywords
|
|
147
155
|
|
|
148
156
|
override_rules = {
|
|
149
157
|
"main": [],
|
|
@@ -171,14 +179,29 @@ class TinybirdDialect(ClickHouse):
|
|
|
171
179
|
self.RULES[section].append(rule)
|
|
172
180
|
break
|
|
173
181
|
|
|
182
|
+
def initialize_analyzer(self, line_length: int) -> Analyzer:
|
|
183
|
+
"""
|
|
184
|
+
Creates and returns an analyzer that uses the Dialect's rules for lexing
|
|
185
|
+
Custom NodeManager for Tinybird
|
|
186
|
+
"""
|
|
187
|
+
analyzer = Analyzer(
|
|
188
|
+
line_length=line_length,
|
|
189
|
+
rules=self.get_rules(),
|
|
190
|
+
node_manager=TinybirdNodeManager(self.case_sensitive_names, self.lower_keywords),
|
|
191
|
+
)
|
|
192
|
+
return analyzer
|
|
193
|
+
|
|
174
194
|
|
|
195
|
+
@dataclass
|
|
175
196
|
class TBMode(Mode):
|
|
197
|
+
lower_keywords: bool = False
|
|
198
|
+
|
|
176
199
|
def __post_init__(self) -> None:
|
|
177
200
|
"""
|
|
178
201
|
Tinybird => Overriden to use `TinybirdDialect`
|
|
179
202
|
https://github.com/tconbeer/sqlfmt/blob/c11775b92d8a45f0e91d871b81a88a894d620bec/src/sqlfmt/mode.py#L31
|
|
180
203
|
"""
|
|
181
|
-
self.dialect = TinybirdDialect()
|
|
204
|
+
self.dialect = TinybirdDialect(self.lower_keywords)
|
|
182
205
|
|
|
183
206
|
|
|
184
207
|
def _calc_str(self) -> str:
|
|
@@ -194,10 +217,10 @@ def _calc_str(self) -> str:
|
|
|
194
217
|
Comment._calc_str = property(_calc_str)
|
|
195
218
|
|
|
196
219
|
|
|
197
|
-
def format_sql_template(sql: str, line_length: Optional[int] = None) -> str:
|
|
220
|
+
def format_sql_template(sql: str, line_length: Optional[int] = None, lower_keywords: bool = False) -> str:
|
|
198
221
|
try:
|
|
199
222
|
# https://github.com/tconbeer/sqlfmt/blob/c11775b92d8a45f0e91d871b81a88a894d620bec/src/sqlfmt/mode.py#L16-L29
|
|
200
|
-
config: Dict[str, Any] = {"line_length": line_length or 80}
|
|
223
|
+
config: Dict[str, Any] = {"line_length": line_length or 80, "lower_keywords": lower_keywords}
|
|
201
224
|
|
|
202
225
|
mode = TBMode(**config)
|
|
203
226
|
sql = sql.strip()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tinybird-cli
|
|
3
|
-
Version: 3.0.2.
|
|
3
|
+
Version: 3.0.2.dev2
|
|
4
4
|
Summary: Tinybird Command Line Tool
|
|
5
5
|
Home-page: https://docs.tinybird.co/cli.html
|
|
6
6
|
Author: Tinybird
|
|
@@ -19,6 +19,11 @@ Changelog
|
|
|
19
19
|
|
|
20
20
|
---------
|
|
21
21
|
|
|
22
|
+
3.0.2.dev2
|
|
23
|
+
************
|
|
24
|
+
|
|
25
|
+
- `Changed` Internal changes to allow parametrize fmt
|
|
26
|
+
|
|
22
27
|
3.0.1
|
|
23
28
|
************
|
|
24
29
|
|
|
@@ -2486,4 +2491,4 @@ env=test tb push file.datasource
|
|
|
2486
2491
|
*******************
|
|
2487
2492
|
- Limited the amount of rows fetched when running ``tb sql`` to 100. Added ``--row-limit``.
|
|
2488
2493
|
- Fixed warning when pipes use internal tables like ``datasources_ops_log``
|
|
2489
|
-
- Raise an error when ``INSERT`` sql statement is used
|
|
2494
|
+
- Raise an error when ``INSERT`` sql statement is used.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/tinyunit/tinyunit.py
RENAMED
|
File without changes
|
{tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird/tb_cli_modules/workspace_members.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-cli-3.0.2.dev1 → tinybird-cli-3.0.2.dev2}/tinybird_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|