tinybird-toolset 2.2.0__tar.gz → 2.2.2__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_toolset-2.2.0/src/tinybird_toolset.egg-info → tinybird_toolset-2.2.2}/PKG-INFO +1 -1
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/README.md +4 -9
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/conf.py +1 -1
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/setup.py +1 -1
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2/src/tinybird_toolset.egg-info}/PKG-INFO +1 -1
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_check_write_query.py +5 -78
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_replace_tables.py +0 -135
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_tables.py +0 -65
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/LICENSE +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/MANIFEST.in +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/setup.cfg +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/src/chtoolset/__init__.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/src/chtoolset/query.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/src/tinybird_toolset.egg-info/SOURCES.txt +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/src/tinybird_toolset.egg-info/dependency_links.txt +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/src/tinybird_toolset.egg-info/requires.txt +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/src/tinybird_toolset.egg-info/top_level.txt +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_check_compatible_types.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_chquery.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_convert_to_row_binary.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_explain_ast.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_get_columns_from_create_query.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_get_left_table.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_internal_cache.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_normalize_query_keep_names.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_parse_create_materialized_view_target_table.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_replace_tables_backward_compat.py +0 -0
- {tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_rewrite_aggregation_states.py +0 -0
|
@@ -208,7 +208,7 @@ make build
|
|
|
208
208
|
A couple of environment variables can be defined with a non-empty value to help retrying the compilation and debugging:
|
|
209
209
|
|
|
210
210
|
* `OMIT_PATCHES` prevents the application of the ClickHouse patches: this is useful if you've already applied them to avoid having to restore the original source code, since some patches may not re-apply cleanly.
|
|
211
|
-
* `DEBUG_SYMBOLS`
|
|
211
|
+
* `DEBUG_SYMBOLS` controls the generation of debug symbols for the python extension code (query.cpp and the C++ functions, but not for the ClickHouse code). It is enabled by default for package builds; set `DEBUG_SYMBOLS=0` to disable it.
|
|
212
212
|
|
|
213
213
|
## Examples
|
|
214
214
|
|
|
@@ -226,18 +226,13 @@ Releasing a new version requires publishing wheels for three platforms: Linux x8
|
|
|
226
226
|
|
|
227
227
|
### 2. Linux release (automatic)
|
|
228
228
|
|
|
229
|
-
Linux x86_64 and ARM64 wheels are published automatically
|
|
229
|
+
Linux x86_64 and ARM64 wheels are published automatically when the MR is merged to `master`. The CI detects the `setup.py` change, and the `release` job will:
|
|
230
230
|
|
|
231
|
-
|
|
232
|
-
git tag v1.5.0
|
|
233
|
-
git push origin v1.5.0
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
The CI `release` job will:
|
|
237
|
-
- Validate that the tag version matches `setup.py` VERSION
|
|
231
|
+
- Compare the version in `setup.py` with the latest version on PyPI (skips if already published)
|
|
238
232
|
- Collect auditwheel-repaired wheels for both x86_64 and ARM64
|
|
239
233
|
- Build the source distribution
|
|
240
234
|
- Upload everything to PyPI
|
|
235
|
+
- Create a git tag `vX.Y.Z` automatically
|
|
241
236
|
|
|
242
237
|
The `PYPI_TOKEN` CI/CD variable must be configured in GitLab (Settings > CI/CD > Variables) with a valid PyPI API token.
|
|
243
238
|
|
|
@@ -21,7 +21,7 @@ COMPILER_CC = os.environ.get('CC', 'clang')
|
|
|
21
21
|
COMPILER_CXX = os.environ.get('CXX', 'clang++')
|
|
22
22
|
|
|
23
23
|
BUILD_FOR_VALGRIND = bool(os.environ.get('BUILD_FOR_VALGRIND', ''))
|
|
24
|
-
DEBUG_SYMBOLS =
|
|
24
|
+
DEBUG_SYMBOLS = os.environ.get('DEBUG_SYMBOLS', '1').lower() not in ('', '0', 'false', 'no')
|
|
25
25
|
OMIT_PATCHES = bool(os.environ.get('OMIT_PATCHES', ''))
|
|
26
26
|
SIMDJSON_DEBUG = bool(os.environ.get('SIMDJSON_DEBUG', ''))
|
|
27
27
|
|
|
@@ -154,48 +154,6 @@ class TestCreateTable(unittest.TestCase):
|
|
|
154
154
|
"""
|
|
155
155
|
self.assertEqual(query.format(query.check_valid_write_query(q)), query.format(q))
|
|
156
156
|
|
|
157
|
-
def test_create_table_with_default_column_with_joinget_is_ok(self):
|
|
158
|
-
q = """
|
|
159
|
-
CREATE TABLE visits2
|
|
160
|
-
(
|
|
161
|
-
`event_time` DateTime,
|
|
162
|
-
`query` String,
|
|
163
|
-
`three` String DEFAULT joinGet(other_database.other_table,'val', toUInt32(number))
|
|
164
|
-
)
|
|
165
|
-
ENGINE = MergeTree
|
|
166
|
-
PARTITION BY toYYYYMM(event_time)
|
|
167
|
-
ORDER BY event_time
|
|
168
|
-
"""
|
|
169
|
-
self.assertEqual(query.format(query.check_valid_write_query(q)), query.format(q))
|
|
170
|
-
|
|
171
|
-
def test_create_table_with_materialized_column_with_joinget_is_ok(self):
|
|
172
|
-
q = """
|
|
173
|
-
CREATE TABLE visits2
|
|
174
|
-
(
|
|
175
|
-
`event_time` DateTime,
|
|
176
|
-
`query` String,
|
|
177
|
-
`three` String MATERIALIZED toInt64(joinGet(other_database.other_table,'val', toUInt32(number)))
|
|
178
|
-
)
|
|
179
|
-
ENGINE = MergeTree
|
|
180
|
-
PARTITION BY toYYYYMM(event_time)
|
|
181
|
-
ORDER BY event_time
|
|
182
|
-
"""
|
|
183
|
-
self.assertEqual(query.format(query.check_valid_write_query(q)), query.format(q))
|
|
184
|
-
|
|
185
|
-
def test_create_table_with_default_column_with_alias_is_ok(self):
|
|
186
|
-
q = """
|
|
187
|
-
CREATE TABLE visits2
|
|
188
|
-
(
|
|
189
|
-
`event_time` DateTime,
|
|
190
|
-
`query` String,
|
|
191
|
-
`three` String ALIAS toInt64(toString(joinGet(other_database.other_table,'val', toUInt32(number))))
|
|
192
|
-
)
|
|
193
|
-
ENGINE = MergeTree
|
|
194
|
-
PARTITION BY toYYYYMM(event_time)
|
|
195
|
-
ORDER BY event_time
|
|
196
|
-
"""
|
|
197
|
-
self.assertEqual(query.format(query.check_valid_write_query(q)), query.format(q))
|
|
198
|
-
|
|
199
157
|
def test_create_table_with_subqueries_in_alias_definition__is_ok(self):
|
|
200
158
|
q = """
|
|
201
159
|
CREATE TABLE visits4
|
|
@@ -253,33 +211,6 @@ class TestCreateTable(unittest.TestCase):
|
|
|
253
211
|
PARTITION BY toYYYYMM(event_time)
|
|
254
212
|
""")
|
|
255
213
|
|
|
256
|
-
def test_create_table_with_primary_key_with_joinget(self):
|
|
257
|
-
with self.assertRaisesRegex(ValueError, "CREATE TABLE: Unsupported function joinGet: in PRIMARY KEY declaration"):
|
|
258
|
-
query.check_valid_write_query("""
|
|
259
|
-
CREATE TABLE visits6
|
|
260
|
-
(
|
|
261
|
-
`event_time` DateTime,
|
|
262
|
-
`query` String,
|
|
263
|
-
`three` String
|
|
264
|
-
)
|
|
265
|
-
ENGINE = MergeTree
|
|
266
|
-
PARTITION BY toYYYYMM(event_time)
|
|
267
|
-
PRIMARY KEY (event_time, toInt64(joinGet(default.other_table, 'val', toInt32(event_time))))
|
|
268
|
-
""")
|
|
269
|
-
|
|
270
|
-
with self.assertRaisesRegex(ValueError, "CREATE TABLE: Unsupported function joinGet: in PRIMARY KEY declaration"):
|
|
271
|
-
query.check_valid_write_query("""
|
|
272
|
-
CREATE TABLE visits6
|
|
273
|
-
(
|
|
274
|
-
`event_time` DateTime,
|
|
275
|
-
`query` String,
|
|
276
|
-
`three` String,
|
|
277
|
-
PRIMARY KEY (event_time, toInt64(joinGet(default.other_table, 'val', toInt32(event_time))))
|
|
278
|
-
)
|
|
279
|
-
ENGINE = MergeTree
|
|
280
|
-
PARTITION BY toYYYYMM(event_time)
|
|
281
|
-
""")
|
|
282
|
-
|
|
283
214
|
def test_create_table_with_projections_is_supported(self):
|
|
284
215
|
q = '''
|
|
285
216
|
CREATE TABLE default.github_events
|
|
@@ -332,19 +263,15 @@ class TestCreateTable(unittest.TestCase):
|
|
|
332
263
|
ORDER BY id
|
|
333
264
|
""")
|
|
334
265
|
|
|
335
|
-
def
|
|
336
|
-
with self.assertRaisesRegex(ValueError, "
|
|
266
|
+
def test_create_table_with_join_engine_is_forbidden(self):
|
|
267
|
+
with self.assertRaisesRegex(ValueError, "Creation of tables with ENGINE Join is not supported"):
|
|
337
268
|
query.check_valid_write_query("""
|
|
338
|
-
CREATE TABLE
|
|
269
|
+
CREATE TABLE join_table
|
|
339
270
|
(
|
|
340
271
|
`id` UInt32,
|
|
341
|
-
|
|
342
|
-
(
|
|
343
|
-
SELECT *
|
|
344
|
-
ORDER BY id
|
|
345
|
-
)
|
|
272
|
+
`val` String
|
|
346
273
|
)
|
|
347
|
-
ENGINE = Join(ANY, LEFT, id)
|
|
274
|
+
ENGINE = Join(ANY, LEFT, id)
|
|
348
275
|
""")
|
|
349
276
|
|
|
350
277
|
def test_create_table_as_query_is_forbidden(self):
|
|
@@ -342,90 +342,6 @@ class TestReplaceTables(unittest.TestCase):
|
|
|
342
342
|
replaced = chquery.replace_tables(sql, replacements)
|
|
343
343
|
self.assertEqual(replaced, chquery.format(expected_query))
|
|
344
344
|
|
|
345
|
-
def test_join_get(self):
|
|
346
|
-
replacements = {("", "abcd"): ("", "t_id_abcd")}
|
|
347
|
-
expected_query = "select joinGet('t_id_abcd', 'test', 1)"
|
|
348
|
-
replaced = chquery.replace_tables(
|
|
349
|
-
"select joinGet('abcd', 'test', 1)", replacements
|
|
350
|
-
)
|
|
351
|
-
self.assertEqual(replaced, chquery.format(expected_query))
|
|
352
|
-
|
|
353
|
-
expected_query = "select joinGet('t_id_abcd', 'test', 1)"
|
|
354
|
-
replaced = chquery.replace_tables(
|
|
355
|
-
"select joinGet(abcd, 'test', 1)", replacements
|
|
356
|
-
)
|
|
357
|
-
self.assertEqual(replaced, chquery.format(expected_query))
|
|
358
|
-
|
|
359
|
-
sql = "Select joinGet()"
|
|
360
|
-
replaced = chquery.replace_tables(sql, replacements)
|
|
361
|
-
self.assertEqual(chquery.format(sql), chquery.format(replaced))
|
|
362
|
-
|
|
363
|
-
def test_join_get_with_subquery(self):
|
|
364
|
-
replacements = {("", "abcd", ""): ("", "(select * from public.nyc_taxi)", "")}
|
|
365
|
-
with self.assertRaisesRegex(
|
|
366
|
-
ValueError, "DB::Exception: Can't replace 'abcd' with a subquery"
|
|
367
|
-
):
|
|
368
|
-
chquery.replace_tables("select joinGet(abcd, 'test', 1)", replacements)
|
|
369
|
-
|
|
370
|
-
with self.assertRaisesRegex(
|
|
371
|
-
ValueError, "DB::Exception: Can't replace 'abcd' with a subquery"
|
|
372
|
-
):
|
|
373
|
-
chquery.replace_tables("select joinGet('abcd', 'test', 1)", replacements)
|
|
374
|
-
|
|
375
|
-
def test_join_get_database(self):
|
|
376
|
-
replacements = {("db_0", "abcd"): ("db_1", "t_id_abcd")}
|
|
377
|
-
expected_query = "select joinGet('db_1.t_id_abcd', 'test', 1)"
|
|
378
|
-
replaced = chquery.replace_tables(
|
|
379
|
-
"select joinGet('db_0.abcd', 'test', 1)", replacements
|
|
380
|
-
)
|
|
381
|
-
self.assertEqual(replaced, chquery.format(expected_query))
|
|
382
|
-
|
|
383
|
-
expected_query = "select joinGet('db_1.t_id_abcd', 'test', 1)"
|
|
384
|
-
replaced = chquery.replace_tables(
|
|
385
|
-
"select joinGet(db_0.abcd, 'test', 1)", replacements
|
|
386
|
-
)
|
|
387
|
-
self.assertEqual(replaced, chquery.format(expected_query))
|
|
388
|
-
|
|
389
|
-
def test_join_get_or_null_database(self):
|
|
390
|
-
replacements = {("db_0", "abcd"): ("db_1", "t_id_abcd")}
|
|
391
|
-
expected_query = "select joinGetOrNull('db_1.t_id_abcd', 'test', 1)"
|
|
392
|
-
replaced = chquery.replace_tables(
|
|
393
|
-
"select joinGetOrNull('db_0.abcd', 'test', 1)", replacements
|
|
394
|
-
)
|
|
395
|
-
self.assertEqual(replaced, chquery.format(expected_query))
|
|
396
|
-
|
|
397
|
-
expected_query = "select joinGetOrNull('db_1.t_id_abcd', 'test', 1)"
|
|
398
|
-
replaced = chquery.replace_tables(
|
|
399
|
-
"select joinGetOrNull(db_0.abcd, 'test', 1)", replacements
|
|
400
|
-
)
|
|
401
|
-
self.assertEqual(replaced, chquery.format(expected_query))
|
|
402
|
-
|
|
403
|
-
def test_join_get_nested(self):
|
|
404
|
-
replacements = {
|
|
405
|
-
("d_012345", "t1"): ("d_012345", "t_id_1"),
|
|
406
|
-
("d_012345", "t2"): ("d_012345", "t_id_2"),
|
|
407
|
-
("d_012345", "t3"): ("d_012345", "t_id_3"),
|
|
408
|
-
}
|
|
409
|
-
expected_query = "SELECT joinGet('d_012345.t_id_1', 'c1', concat(joinGet('d_012345.t_id_2', 'c2', i2), '_', joinGet('d_012345.t_id_3', 'c3', i3), '_', 'label'))"
|
|
410
|
-
replaced = chquery.replace_tables(
|
|
411
|
-
"SELECT joinGet('t1', 'c1', concat(joinGet('t2', 'c2', i2), '_', joinGet('t3', 'c3', i3), '_', 'label'))",
|
|
412
|
-
replacements,
|
|
413
|
-
default_database="d_012345",
|
|
414
|
-
)
|
|
415
|
-
self.assertEqual(replaced, chquery.format(expected_query))
|
|
416
|
-
|
|
417
|
-
def test_join_nested_2(self):
|
|
418
|
-
replacements = {
|
|
419
|
-
("d_012345", "blabla"): ("d_012345", "alibaba"),
|
|
420
|
-
("d_012345", "pp"): ("d_012345", "t_pp_01"),
|
|
421
|
-
}
|
|
422
|
-
query = "select joinGet(blabla, 'a', joinGet(pp, 'b', c))"
|
|
423
|
-
replaced = chquery.replace_tables(
|
|
424
|
-
query, replacements, default_database="d_012345"
|
|
425
|
-
)
|
|
426
|
-
expected_query = "select joinGet('d_012345.alibaba', 'a', joinGet('d_012345.t_pp_01', 'b', c))"
|
|
427
|
-
self.assertEqual(replaced, chquery.format(expected_query))
|
|
428
|
-
|
|
429
345
|
def test_qualified_column_in_where(self):
|
|
430
346
|
sql = """
|
|
431
347
|
SELECT
|
|
@@ -1520,54 +1436,3 @@ class TestDisabledFunctions(unittest.TestCase):
|
|
|
1520
1436
|
)
|
|
1521
1437
|
expected_query = "WITH (select * from d_012345.repl2 as table2 limit 1) as table1, (select 1 as v where v in d_012345.repl1) as x select x"
|
|
1522
1438
|
self.assertEqual(replaced, chquery.format(expected_query))
|
|
1523
|
-
|
|
1524
|
-
def test_join_get_column_aliases(self):
|
|
1525
|
-
replacements = {
|
|
1526
|
-
("d_012345", "table1"): ("d_012345", "repl1"),
|
|
1527
|
-
("d_012345", "table2"): ("d_012345", "repl2"),
|
|
1528
|
-
}
|
|
1529
|
-
queries = [
|
|
1530
|
-
(
|
|
1531
|
-
"select joinGet(table2, 'col', 1), 'table1' as table2",
|
|
1532
|
-
"select joinGet(d_012345.repl2, 'col', 1), 'table1' as table2",
|
|
1533
|
-
),
|
|
1534
|
-
(
|
|
1535
|
-
"select 'table1' as table2, joinGet(table2, 'col', 1)",
|
|
1536
|
-
"select 'table1' as table2, joinGet(d_012345.repl2, 'col', 1)",
|
|
1537
|
-
),
|
|
1538
|
-
(
|
|
1539
|
-
"select '_local.join1' as table2, joinGet(d_012345.repl2, 'b', toInt32(1))",
|
|
1540
|
-
"select '_local.join1' as table2, joinGet(d_012345.repl2, 'b', toInt32(1))",
|
|
1541
|
-
),
|
|
1542
|
-
(
|
|
1543
|
-
"select concat(y,'1') as table2, '_local.join' as y, joinGet(d_012345.repl2, 'b', toInt32(1))",
|
|
1544
|
-
"select concat(y,'1') as table2, '_local.join' as y, joinGet(d_012345.repl2, 'b', toInt32(1))",
|
|
1545
|
-
),
|
|
1546
|
-
(
|
|
1547
|
-
"select '_local.join' as y, concat(y,'1') as table2, joinGet(d_012345.repl2, 'b', toInt32(1))",
|
|
1548
|
-
"select '_local.join' as y, concat(y,'1') as table2, joinGet(d_012345.repl2, 'b', toInt32(1))",
|
|
1549
|
-
),
|
|
1550
|
-
(
|
|
1551
|
-
"select (select 'otherdb.t2') as table2, joinGet(d_012345.repl2, 'c1', i1)",
|
|
1552
|
-
"select (select 'otherdb.t2') as table2, joinGet(d_012345.repl2, 'c1', i1)",
|
|
1553
|
-
),
|
|
1554
|
-
]
|
|
1555
|
-
for query, expected_query in queries:
|
|
1556
|
-
replaced = chquery.replace_tables(
|
|
1557
|
-
query, replacements, default_database="d_012345"
|
|
1558
|
-
)
|
|
1559
|
-
self.assertEqual(replaced, chquery.format(expected_query))
|
|
1560
|
-
|
|
1561
|
-
def test_join_get_column_aliases_no_format(self):
|
|
1562
|
-
replacements = {
|
|
1563
|
-
("d_012345", "table1"): ("d_012345", "repl1"),
|
|
1564
|
-
("d_012345", "table2"): ("d_012345", "repl2"),
|
|
1565
|
-
}
|
|
1566
|
-
query = "select joinGet(table2, 'col', 1), 'table1' as table2"
|
|
1567
|
-
expected_query = (
|
|
1568
|
-
"SELECT\n joinGet('d_012345.repl2', 'col', 1),\n 'table1' AS table2"
|
|
1569
|
-
)
|
|
1570
|
-
replaced = chquery.replace_tables(
|
|
1571
|
-
query, replacements, default_database="d_012345"
|
|
1572
|
-
)
|
|
1573
|
-
self.assertEqual(replaced, expected_query)
|
|
@@ -44,58 +44,6 @@ class TestTables(unittest.TestCase):
|
|
|
44
44
|
"SELECT `cod_store`,`country_iso`,sum(stores_stock) as stores_stock from stores_stock group by `cod_store`,`country_iso`"),
|
|
45
45
|
[('', 'stores_stock', '')])
|
|
46
46
|
|
|
47
|
-
def test_join_get(self):
|
|
48
|
-
self.assertEqual(chquery.tables("select joinGet()"), [])
|
|
49
|
-
self.assertEqual(chquery.tables("select joinGet(abcd, 'test', 1)"), [('', 'abcd', '')])
|
|
50
|
-
self.assertEqual(chquery.tables("select joinGet('abcd', 'test', 1)"), [('', 'abcd', '')])
|
|
51
|
-
self.assertEqual(chquery.tables("select joinGet(`aaaa.aaaa.aaaa.aaaa`, 'test', 1)"), [('aaaa', 'aaaa.aaaa.aaaa', '')])
|
|
52
|
-
self.assertEqual(chquery.tables("SELECT joinGetOrNull('join_test', 'num', 500)"), [('', 'join_test', '')])
|
|
53
|
-
|
|
54
|
-
def test_join_get_default_database(self):
|
|
55
|
-
self.assertEqual(chquery.tables("select joinGet(abcd, 'test', 1)", default_database='d_012345'), [('d_012345', 'abcd', '')])
|
|
56
|
-
self.assertEqual(chquery.tables("select joinGet('abcd', 'test', 1)", default_database='d_012345'), [('d_012345', 'abcd', '')])
|
|
57
|
-
self.assertEqual(chquery.tables("select joinGet(`aaaa.aaaa.aaaa.aaaa`, 'test', 1)", default_database='d_012345'), [('aaaa', 'aaaa.aaaa.aaaa', '')])
|
|
58
|
-
|
|
59
|
-
def test_join_get_database(self):
|
|
60
|
-
self.assertEqual(chquery.tables("select joinGet(db_extract.abcd, 'test', 1)"), [('db_extract', 'abcd', '')])
|
|
61
|
-
self.assertEqual(chquery.tables("select joinGet('db_extract.abcd', 'test', 1)"), [('db_extract', 'abcd', '')])
|
|
62
|
-
self.assertEqual(chquery.tables("select joinGet(db_extract.`aaaa.aaaa.aaaa.aaaa`, 'test', 1)", default_database='d_012345'), [('db_extract', 'aaaa.aaaa.aaaa.aaaa', '')])
|
|
63
|
-
|
|
64
|
-
def test_join_get_database_default_database(self):
|
|
65
|
-
self.assertEqual(chquery.tables("select joinGet(db_extract.abcd, 'test', 1)", default_database='d_012345'), [('db_extract', 'abcd', '')])
|
|
66
|
-
self.assertEqual(chquery.tables("select joinGet('db_extract.abcd', 'test', 1)", default_database='d_012345'), [('db_extract', 'abcd', '')])
|
|
67
|
-
self.assertEqual(chquery.tables("select joinGet(db_extract.`aaaa.aaaa.aaaa.aaaa`, 'test', 1)", default_database='d_012345'), [('db_extract', 'aaaa.aaaa.aaaa.aaaa', '')])
|
|
68
|
-
|
|
69
|
-
def test_join_get_or_null(self):
|
|
70
|
-
self.assertEqual(chquery.tables("select joinGetOrNull('db_extract.abcd', 'test', 1)", default_database='d_012345'), [('db_extract', 'abcd', '')])
|
|
71
|
-
self.assertEqual(chquery.tables("select joinGetOrNull(db_extract.`aaaa.aaaa.aaaa.aaaa`, 'test', 1)", default_database='d_012345'), [('db_extract', 'aaaa.aaaa.aaaa.aaaa', '')])
|
|
72
|
-
|
|
73
|
-
def test_join_get_coredump_regression(self):
|
|
74
|
-
tables = chquery.tables('SELECT property_id, toDate(visit_date) AS "visit_day", joinGet(destinations, \'property_id_dst\', property_id)\nFROM wpbv\nGROUP BY property_id, visit_day')
|
|
75
|
-
self.assertEqual(sorted(tables), sorted([('', 'wpbv', ''), ('', 'destinations', '')]))
|
|
76
|
-
|
|
77
|
-
def test_join_get_nested(self):
|
|
78
|
-
tables = chquery.tables("SELECT joinGet('t1', 'c1', concat(joinGet('t2', 'c2', i2), '_', joinGet('t3', 'c3', i3), '_', 'label'))")
|
|
79
|
-
self.assertEqual(sorted(tables), sorted([('', 't1', ''), ('', 't2', ''), ('', 't3', '')]))
|
|
80
|
-
self.assertEqual(sorted(chquery.tables("select joinGet('blabla', 'a', joinGet('pp', 'b', c))")), sorted([('', 'blabla', ''), ('', 'pp', '')]))
|
|
81
|
-
self.assertEqual(sorted(chquery.tables("select joinGet(blabla, 'a', joinGet(pp, 'b', c))")), sorted([('', 'blabla', ''), ('', 'pp', '')]))
|
|
82
|
-
|
|
83
|
-
def test_join_get_nested_nested_raises(self):
|
|
84
|
-
with self.assertRaisesRegex(ValueError, 'quoted literals'):
|
|
85
|
-
chquery.tables("SELECT joinGet(joinGet('t2', 'c2', i2), 'c1', i1)")
|
|
86
|
-
|
|
87
|
-
def test_join_get_nested_alias(self):
|
|
88
|
-
tables = chquery.tables("with (select 'otherdb.t2' as t) as t select joinGet(t, 'c1', i1)")
|
|
89
|
-
self.assertEqual(tables, [('', 't', '')])
|
|
90
|
-
|
|
91
|
-
tables = chquery.tables("with (select 'otherdb.t2' as t) as t select t")
|
|
92
|
-
self.assertEqual(tables, [])
|
|
93
|
-
|
|
94
|
-
def test_join_get_cte(self):
|
|
95
|
-
tables = chquery.tables("WITH 'id_val' as a SELECT joinGet(a, 'val',toUInt32(number)) from numbers(4)",
|
|
96
|
-
default_database='db_test')
|
|
97
|
-
self.assertEqual(tables, [('', '', 'numbers'), ('db_test', 'a', '')])
|
|
98
|
-
|
|
99
47
|
def test_has_column_in_table(self):
|
|
100
48
|
with self.assertRaisesRegex(ValueError, """DB::Exception: Usage of function hasColumnInTable is restricted"""):
|
|
101
49
|
chquery.tables("Select hasColumnInTable('default', 'join_test', 'id')")
|
|
@@ -1090,8 +1038,6 @@ SELECT *
|
|
|
1090
1038
|
{"name":"javaHash","case_insensitive":0,"table_function":False},
|
|
1091
1039
|
{"name":"javaHashUTF16LE","case_insensitive":0,"table_function":False},
|
|
1092
1040
|
{"name":"jdbc","case_insensitive":0,"table_function":True},
|
|
1093
|
-
{"name":"joinGet","case_insensitive":0,"table_function":False},
|
|
1094
|
-
{"name":"joinGetOrNull","case_insensitive":0,"table_function":False},
|
|
1095
1041
|
{"name":"jsonMergePatch","case_insensitive":0,"table_function":False},
|
|
1096
1042
|
{"name":"jumpConsistentHash","case_insensitive":0,"table_function":False},
|
|
1097
1043
|
{"name":"kafkaMurmurHash","case_insensitive":0,"table_function":False},
|
|
@@ -2144,17 +2090,6 @@ SELECT *
|
|
|
2144
2090
|
tables = chquery.tables("WITH (select * from table2 limit 1) as table1, (select 1 as v where v in table1) as x select x")
|
|
2145
2091
|
self.assertEqual(tables, [('', 'table1', ''), ('', 'table2', '')])
|
|
2146
2092
|
|
|
2147
|
-
def test_join_get_column_aliases(self):
|
|
2148
|
-
queries = ["select joinGet(table2, 'col', 1), 'table1' as table2",
|
|
2149
|
-
"select 'table1' as table2, joinGet(table2, 'col', 1)",
|
|
2150
|
-
"select '_local.join1' as table2, joinGet(table2, 'b', toInt32(1))",
|
|
2151
|
-
"select concat(y,'1') as table2, '_local.join' as y, joinGet(table2, 'b', toInt32(1))",
|
|
2152
|
-
"select '_local.join' as y, concat(y,'1') as table2, joinGet(table2, 'b', toInt32(1))",
|
|
2153
|
-
"select (select 'otherdb.t2') as table2, joinGet(table2, 'c1', i1)"]
|
|
2154
|
-
for query in queries:
|
|
2155
|
-
tables = chquery.tables(query)
|
|
2156
|
-
self.assertEqual(tables, [('', 'table2', '')])
|
|
2157
|
-
|
|
2158
2093
|
def test_recursive_cte(self):
|
|
2159
2094
|
tables = chquery.tables("with recursive test_table as (select 1 as number union all select number + 1 from test_table where number < 100) select sum(number) from test_table")
|
|
2160
2095
|
self.assertEqual(tables, [])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/src/tinybird_toolset.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/src/tinybird_toolset.egg-info/requires.txt
RENAMED
|
File without changes
|
{tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/src/tinybird_toolset.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_get_columns_from_create_query.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird_toolset-2.2.0 → tinybird_toolset-2.2.2}/tests/test_replace_tables_backward_compat.py
RENAMED
|
File without changes
|
|
File without changes
|