tinybird-toolset 2.7.0__tar.gz → 2.7.1__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.7.0/src/tinybird_toolset.egg-info → tinybird_toolset-2.7.1}/PKG-INFO +1 -1
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/setup.py +1 -1
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1/src/tinybird_toolset.egg-info}/PKG-INFO +1 -1
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_validate_ttl.py +88 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/LICENSE +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/MANIFEST.in +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/README.md +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/conf.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/setup.cfg +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/src/chtoolset/__init__.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/src/chtoolset/query.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/src/tinybird_toolset.egg-info/SOURCES.txt +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/src/tinybird_toolset.egg-info/dependency_links.txt +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/src/tinybird_toolset.egg-info/requires.txt +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/src/tinybird_toolset.egg-info/top_level.txt +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_check_compatible_types.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_check_ttl_partition_compatibility.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_check_write_query.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_chquery.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_convert_to_row_binary.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_explain_ast.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_get_columns_from_create_query.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_get_left_table.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_internal_cache.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_normalize_query_keep_names.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_normalize_table_column.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_parse_create_materialized_view_target_table.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_replace_tables.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_replace_tables_backward_compat.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_rewrite_aggregation_states.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_tables.py +0 -0
- {tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_validate_partition_key.py +0 -0
|
@@ -377,6 +377,94 @@ class TestValidateTTL(unittest.TestCase):
|
|
|
377
377
|
)
|
|
378
378
|
)
|
|
379
379
|
|
|
380
|
+
def test_valid_ttl_with_json_extract(self):
|
|
381
|
+
# Reported failure: "Unknown function JSONExtractString".
|
|
382
|
+
self.assertIsNone(
|
|
383
|
+
chquery.validate_ttl(
|
|
384
|
+
ttl="if(parseDateTimeBestEffortOrZero(JSONExtractString(JSONExtractRaw(message, 'mail'), 'timestamp')) = toDateTime(0), "
|
|
385
|
+
"toDateTime('2099-01-01 00:00:00'), "
|
|
386
|
+
"parseDateTimeBestEffortOrZero(JSONExtractString(JSONExtractRaw(message, 'mail'), 'timestamp'))) + toIntervalDay(90)",
|
|
387
|
+
columns=[{"name": "message", "type": "String"}],
|
|
388
|
+
sorting_key="tuple()",
|
|
389
|
+
)
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
def test_ttl_with_json_extract_still_checks_result_type(self):
|
|
393
|
+
# JSON functions must resolve, but the TTL result must still be a DateTime/Date.
|
|
394
|
+
err = chquery.validate_ttl(
|
|
395
|
+
ttl="JSONExtractString(message, 'ts')",
|
|
396
|
+
columns=[{"name": "message", "type": "String"}],
|
|
397
|
+
sorting_key="tuple()",
|
|
398
|
+
)
|
|
399
|
+
self.assertIsNotNone(err)
|
|
400
|
+
self.assertIn("TTL expression result column should have DateTime or Date type", err)
|
|
401
|
+
|
|
402
|
+
def test_ttl_with_json_extract_still_checks_columns(self):
|
|
403
|
+
err = chquery.validate_ttl(
|
|
404
|
+
ttl="toDateTime(JSONExtractInt(other, 'ts')) + toIntervalDay(1)",
|
|
405
|
+
columns=[{"name": "message", "type": "String"}],
|
|
406
|
+
sorting_key="tuple()",
|
|
407
|
+
)
|
|
408
|
+
self.assertIsNotNone(err)
|
|
409
|
+
self.assertNotIn("Unknown function", err)
|
|
410
|
+
self.assertIn("other", err)
|
|
411
|
+
|
|
412
|
+
def test_valid_ttl_with_other_json_functions(self):
|
|
413
|
+
ttls = [
|
|
414
|
+
"toDateTime(JSONExtractInt(message, 'ts')) + toIntervalDay(7)",
|
|
415
|
+
"JSONExtract(message, 'ts', 'DateTime') + toIntervalDay(7)",
|
|
416
|
+
"if(JSONHas(message, 'ts'), toDateTime(JSONExtractInt(message, 'ts')), toDateTime(0)) + toIntervalDay(7)",
|
|
417
|
+
]
|
|
418
|
+
for ttl in ttls:
|
|
419
|
+
with self.subTest(ttl=ttl):
|
|
420
|
+
self.assertIsNone(
|
|
421
|
+
chquery.validate_ttl(
|
|
422
|
+
ttl=ttl,
|
|
423
|
+
columns=[{"name": "message", "type": "String"}],
|
|
424
|
+
sorting_key="tuple()",
|
|
425
|
+
)
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
def test_valid_ttl_with_simple_json_functions(self):
|
|
429
|
+
ttls = [
|
|
430
|
+
"toDateTime(simpleJSONExtractInt(message, 'ts')) + toIntervalDay(7)",
|
|
431
|
+
"if(simpleJSONHas(message, 'ts'), toDateTime(simpleJSONExtractInt(message, 'ts')), toDateTime(0)) + toIntervalDay(7)",
|
|
432
|
+
]
|
|
433
|
+
for ttl in ttls:
|
|
434
|
+
with self.subTest(ttl=ttl):
|
|
435
|
+
self.assertIsNone(
|
|
436
|
+
chquery.validate_ttl(
|
|
437
|
+
ttl=ttl,
|
|
438
|
+
columns=[{"name": "message", "type": "String"}],
|
|
439
|
+
sorting_key="tuple()",
|
|
440
|
+
)
|
|
441
|
+
)
|
|
442
|
+
|
|
443
|
+
def test_valid_ttl_with_sql_json_functions(self):
|
|
444
|
+
ttls = [
|
|
445
|
+
"parseDateTimeBestEffortOrZero(JSON_VALUE(message, '$.mail.timestamp')) + toIntervalDay(90)",
|
|
446
|
+
"parseDateTimeBestEffortOrZero(JSON_VALUE(JSON_QUERY(message, '$.mail'), '$.timestamp')) + toIntervalDay(90)",
|
|
447
|
+
"if(JSON_EXISTS(message, '$.mail.timestamp'), parseDateTimeBestEffortOrZero(JSON_VALUE(message, '$.mail.timestamp')), toDateTime(0)) + toIntervalDay(90)",
|
|
448
|
+
]
|
|
449
|
+
for ttl in ttls:
|
|
450
|
+
with self.subTest(ttl=ttl):
|
|
451
|
+
self.assertIsNone(
|
|
452
|
+
chquery.validate_ttl(
|
|
453
|
+
ttl=ttl,
|
|
454
|
+
columns=[{"name": "message", "type": "String"}],
|
|
455
|
+
sorting_key="tuple()",
|
|
456
|
+
)
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
def test_ttl_with_misspelled_json_function_is_rejected(self):
|
|
460
|
+
err = chquery.validate_ttl(
|
|
461
|
+
ttl="toDateTime(JSONExtractStrng(message, 'ts')) + toIntervalDay(1)",
|
|
462
|
+
columns=[{"name": "message", "type": "String"}],
|
|
463
|
+
sorting_key="tuple()",
|
|
464
|
+
)
|
|
465
|
+
self.assertIsNotNone(err)
|
|
466
|
+
self.assertIn("Unknown function JSONExtractStrng", err)
|
|
467
|
+
|
|
380
468
|
# --- Input validation ---
|
|
381
469
|
def test_columns_must_be_list_of_dicts(self):
|
|
382
470
|
with self.assertRaises(TypeError):
|
|
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.7.0 → tinybird_toolset-2.7.1}/src/tinybird_toolset.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/src/tinybird_toolset.egg-info/requires.txt
RENAMED
|
File without changes
|
{tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/src/tinybird_toolset.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_check_ttl_partition_compatibility.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/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
|
|
File without changes
|
{tinybird_toolset-2.7.0 → tinybird_toolset-2.7.1}/tests/test_replace_tables_backward_compat.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|