tinybird-toolset 2.4.5__tar.gz → 2.4.7__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.4.5/src/tinybird_toolset.egg-info → tinybird_toolset-2.4.7}/PKG-INFO +1 -1
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/setup.py +1 -1
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7/src/tinybird_toolset.egg-info}/PKG-INFO +1 -1
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_convert_to_row_binary.py +16 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_replace_tables.py +52 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/LICENSE +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/MANIFEST.in +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/README.md +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/conf.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/setup.cfg +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/src/chtoolset/__init__.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/src/chtoolset/query.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/src/tinybird_toolset.egg-info/SOURCES.txt +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/src/tinybird_toolset.egg-info/dependency_links.txt +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/src/tinybird_toolset.egg-info/requires.txt +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/src/tinybird_toolset.egg-info/top_level.txt +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_check_compatible_types.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_check_write_query.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_chquery.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_explain_ast.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_get_columns_from_create_query.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_get_left_table.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_internal_cache.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_normalize_query_keep_names.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_normalize_table_column.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_parse_create_materialized_view_target_table.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_replace_tables_backward_compat.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_rewrite_aggregation_states.py +0 -0
- {tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_tables.py +0 -0
|
@@ -8408,6 +8408,22 @@ TEST_CASES = [
|
|
|
8408
8408
|
b'',
|
|
8409
8409
|
b"\x00\x00\x03abc\x00\x00\x05wrong\x00\x01ZInvalid value wrong for type 'Int8' in column 'wrong_value' with jsonpath '$.wrong_value'.\x00\x01\x0bwrong_value\x01\x01",
|
|
8410
8410
|
0, 1),
|
|
8411
|
+
|
|
8412
|
+
# Non-standard but existing behaviour: on duplicate JSON keys, first occurrence wins
|
|
8413
|
+
(ConversionMode.ALWAYS,
|
|
8414
|
+
[('a', 'String', '$.a', False)],
|
|
8415
|
+
'{"a":"x1","a":"x2"}',
|
|
8416
|
+
b'\x00\x02x1',
|
|
8417
|
+
b'',
|
|
8418
|
+
1, 0),
|
|
8419
|
+
|
|
8420
|
+
# Existing behaviour: JSONPaths do not match their encoded keys
|
|
8421
|
+
(ConversionMode.ALWAYS,
|
|
8422
|
+
[('a', 'String', '$.a', False)],
|
|
8423
|
+
'{"\\u0061":"x1"}',
|
|
8424
|
+
b'',
|
|
8425
|
+
b"\x01\x00\x01\xa7\x01Strict type checking failed. Object does not have column 'a', you should send a value or recreate the table with a Nullable column type. While accessing jsonpath \'$.a\'\x00\x01\x01a\x01\x01",
|
|
8426
|
+
0, 1),
|
|
8411
8427
|
]
|
|
8412
8428
|
|
|
8413
8429
|
|
|
@@ -420,6 +420,58 @@ class TestReplaceTables(unittest.TestCase):
|
|
|
420
420
|
"""
|
|
421
421
|
self.assertEqual(replaced, chquery.format(expected_query))
|
|
422
422
|
|
|
423
|
+
def test_column_uses_alias_source_different_from_from(self):
|
|
424
|
+
"""When the same target table has multiple source keys registered
|
|
425
|
+
(e.g., workspace name and CH database name both pointing to the same
|
|
426
|
+
physical table), a column qualified with one alias must still be
|
|
427
|
+
rewritten even if the FROM matched a different alias key."""
|
|
428
|
+
sql = "SELECT acme.events.id FROM events"
|
|
429
|
+
replacements = {
|
|
430
|
+
("d_userdb", "events"): ("d_userdb", "t_xxx"),
|
|
431
|
+
("acme", "events"): ("d_userdb", "t_xxx"),
|
|
432
|
+
}
|
|
433
|
+
expected_query = "SELECT d_userdb.t_xxx.id FROM d_userdb.t_xxx AS events"
|
|
434
|
+
replaced = chquery.replace_tables(
|
|
435
|
+
sql, replacements, default_database="d_userdb"
|
|
436
|
+
)
|
|
437
|
+
self.assertEqual(replaced, chquery.format(expected_query))
|
|
438
|
+
|
|
439
|
+
def test_self_join_with_subquery_target(self):
|
|
440
|
+
"""Self-join of a datasource that is replaced by a subquery. Each FROM
|
|
441
|
+
leg gets its own cloned subquery and its own SQL alias; columns
|
|
442
|
+
qualified by the SQL alias must keep their per-leg binding."""
|
|
443
|
+
sql = """
|
|
444
|
+
SELECT prev.value, curr.value
|
|
445
|
+
FROM workspace_name.events AS prev
|
|
446
|
+
JOIN workspace_name.events AS curr ON curr.id = prev.id + 1
|
|
447
|
+
"""
|
|
448
|
+
replacements = {
|
|
449
|
+
("workspace_name", "events"): ("", "(SELECT * FROM raw_events)"),
|
|
450
|
+
("d_yyy", "events"): ("", "(SELECT * FROM raw_events)"),
|
|
451
|
+
}
|
|
452
|
+
expected_query = """
|
|
453
|
+
SELECT prev.value, curr.value
|
|
454
|
+
FROM (SELECT * FROM raw_events) AS prev
|
|
455
|
+
INNER JOIN (SELECT * FROM raw_events) AS curr ON curr.id = (prev.id + 1)
|
|
456
|
+
"""
|
|
457
|
+
replaced = chquery.replace_tables(
|
|
458
|
+
sql, replacements, default_database="d_yyy"
|
|
459
|
+
)
|
|
460
|
+
self.assertEqual(replaced, chquery.format(expected_query))
|
|
461
|
+
|
|
462
|
+
def test_qualified_asterisk_uses_alias_source_different_from_from(self):
|
|
463
|
+
"""Same as above but for qualified asterisks: SELECT acme.events.*"""
|
|
464
|
+
sql = "SELECT acme.events.* FROM events"
|
|
465
|
+
replacements = {
|
|
466
|
+
("d_userdb", "events"): ("d_userdb", "t_xxx"),
|
|
467
|
+
("acme", "events"): ("d_userdb", "t_xxx"),
|
|
468
|
+
}
|
|
469
|
+
expected_query = "SELECT d_userdb.t_xxx.* FROM d_userdb.t_xxx AS events"
|
|
470
|
+
replaced = chquery.replace_tables(
|
|
471
|
+
sql, replacements, default_database="d_userdb"
|
|
472
|
+
)
|
|
473
|
+
self.assertEqual(replaced, chquery.format(expected_query))
|
|
474
|
+
|
|
423
475
|
def test_qualified_column_in_array(self):
|
|
424
476
|
sql = """SELECT array(join_test.id) FROM default.join_test"""
|
|
425
477
|
|
|
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_toolset-2.4.5 → tinybird_toolset-2.4.7}/src/tinybird_toolset.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/src/tinybird_toolset.egg-info/requires.txt
RENAMED
|
File without changes
|
{tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/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.4.5 → tinybird_toolset-2.4.7}/tests/test_get_columns_from_create_query.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird_toolset-2.4.5 → tinybird_toolset-2.4.7}/tests/test_replace_tables_backward_compat.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|