tinybird-toolset 2.6.7__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.
Files changed (32) hide show
  1. {tinybird_toolset-2.6.7/src/tinybird_toolset.egg-info → tinybird_toolset-2.7.1}/PKG-INFO +1 -1
  2. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/README.md +4 -26
  3. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/conf.py +11 -2
  4. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/setup.py +2 -1
  5. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1/src/tinybird_toolset.egg-info}/PKG-INFO +1 -1
  6. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_check_compatible_types.py +1 -1
  7. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_tables.py +3 -0
  8. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_validate_ttl.py +99 -9
  9. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/LICENSE +0 -0
  10. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/MANIFEST.in +0 -0
  11. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/setup.cfg +0 -0
  12. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/src/chtoolset/__init__.py +0 -0
  13. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/src/chtoolset/query.py +0 -0
  14. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/src/tinybird_toolset.egg-info/SOURCES.txt +0 -0
  15. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/src/tinybird_toolset.egg-info/dependency_links.txt +0 -0
  16. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/src/tinybird_toolset.egg-info/requires.txt +0 -0
  17. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/src/tinybird_toolset.egg-info/top_level.txt +0 -0
  18. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_check_ttl_partition_compatibility.py +0 -0
  19. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_check_write_query.py +0 -0
  20. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_chquery.py +0 -0
  21. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_convert_to_row_binary.py +0 -0
  22. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_explain_ast.py +0 -0
  23. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_get_columns_from_create_query.py +0 -0
  24. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_get_left_table.py +0 -0
  25. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_internal_cache.py +0 -0
  26. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_normalize_query_keep_names.py +0 -0
  27. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_normalize_table_column.py +0 -0
  28. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_parse_create_materialized_view_target_table.py +0 -0
  29. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_replace_tables.py +0 -0
  30. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_replace_tables_backward_compat.py +0 -0
  31. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_rewrite_aggregation_states.py +0 -0
  32. {tinybird_toolset-2.6.7 → tinybird_toolset-2.7.1}/tests/test_validate_partition_key.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinybird-toolset
3
- Version: 2.6.7
3
+ Version: 2.7.1
4
4
  Home-page: https://gitlab.com/tinybird/clickhouse-toolset
5
5
  Author: Tinybird.co
6
6
  Author-email: support@tinybird.co
@@ -259,36 +259,14 @@ When the MR is merged to `master` and `setup.py` changed, wheels for all platfor
259
259
 
260
260
  | Platform | CI job | Runner |
261
261
  |----------|--------|--------|
262
- | Linux x86_64 + ARM64 | `release` | Docker (`amd64-spot` / `arm64-spot`) |
263
- | macOS ARM64 | `release/macos arm64` | Native Apple Silicon (`saas-macos-large-m2pro`) |
262
+ | Linux x86_64 + ARM64, macOS ARM64 | `release` | Docker (`amd64-spot`) |
264
263
 
265
- The Linux `release` job will:
266
- - Collect auditwheel-repaired wheels for both x86_64 and ARM64
264
+ The `release` job will:
265
+ - Collect repaired wheels for all platforms
267
266
  - Build the source distribution
268
267
  - Upload everything to PyPI
269
268
  - Create a git tag `vX.Y.Z` automatically
270
269
 
271
- The macOS `release/macos arm64` job runs `release.sh` on a native Apple Silicon runner to build, delocate, test, and upload macOS ARM64 wheels.
270
+ The macOS `build/release macos arm64` job runs `make build test` with a persistent ccache archive in branch and merge request pipelines. The `delocate/release macos arm64` job repairs and tests its wheels on a native Apple Silicon runner.
272
271
 
273
272
  The `PYPI_TOKEN` CI/CD variable must be configured in GitLab (Settings > CI/CD > Variables) with a valid PyPI API token.
274
-
275
- ### 3. Manual macOS release
276
-
277
- To run the macOS release manually from a Mac with Apple Silicon:
278
-
279
- ```bash
280
- export TWINE_USERNAME=__token__
281
- export TWINE_PASSWORD=pypi-... # PyPI API token
282
- ./release.sh
283
- ```
284
-
285
- The script will:
286
- - Build wheels for Python 3.13-3.14
287
- - Delocate them (bundle dynamic libraries, set minimum macOS version to 11.0)
288
- - Run tests for each Python version
289
- - Upload to PyPI
290
-
291
- Requirements:
292
- - macOS with Apple Silicon (ARM64)
293
- - Homebrew LLVM 19 (`CC` and `CXX` must point to the Homebrew clang, not Apple's)
294
- - `uv` and `make` installed
@@ -56,9 +56,11 @@ def apply_patch(patch_path):
56
56
  print('PATCH NOT APPLIED:', patch_path)
57
57
  return
58
58
 
59
- # Check if the patch is already applied by doing a reverse dry-run
59
+ # Check if the patch is already applied by doing a reverse dry-run.
60
+ # -f: never ask "Unreversed patch detected! Ignore -R?"; BSD patch answers
61
+ # yes to it and then reports success for a patch that is not applied.
60
62
  with open(patch_path, "r") as patch:
61
- check = subprocess.Popen(['patch', '-p1', '-R', '--dry-run'],
63
+ check = subprocess.Popen(['patch', '-p1', '-R', '-f', '--dry-run'],
62
64
  cwd=ROOT_DIR,
63
65
  stdin=patch,
64
66
  stdout=subprocess.PIPE,
@@ -152,6 +154,10 @@ class ClickHouseBuildExt(build_ext):
152
154
  # remove once the fix lands in the pinned ClickHouse submodule.
153
155
  apply_patch("patches/ColumnVectorTryInsert.patch")
154
156
 
157
+ # Keep TTL result validation compatible with ClickHouse versions before 25.8:
158
+ # DateTime64 and Date32 results must remain rejected until all servers migrate.
159
+ apply_patch("patches/ttl_result_type_compat.patch")
160
+
155
161
  if sys.platform == 'darwin':
156
162
  # We disable whole_archive options destined for AppleClang, which is unsupported but keeps being a PITA
157
163
  apply_patch("patches/darwin.patch")
@@ -350,6 +356,9 @@ class CustomBuildWithFromCH(build_ext):
350
356
  @staticmethod
351
357
  def ldflags():
352
358
  link_flags = CustomBuildWithFromCH.ninja_extractor_ldflags('LINK_FLAGS')
359
+ # On Linux the extracted flags include ClickHouse's `--wrap=malloc` & co.
360
+ # They stay: ClickHouse code calls `__real_*` directly, which only exists
361
+ # under --wrap, and src/AllocatorWrappers.cpp provides the `__wrap_*` side.
353
362
  if sys.platform == 'linux':
354
363
  link_flags.append('-g' if BUILD_FOR_VALGRIND or DEBUG_SYMBOLS else '-s')
355
364
  link_flags.append('-Wl,--whole-archive')
@@ -1,7 +1,7 @@
1
1
  from setuptools import setup, Extension
2
2
 
3
3
  NAME = 'tinybird-toolset'
4
- VERSION = '2.6.7'
4
+ VERSION = '2.7.1'
5
5
 
6
6
  # Shared metadata for both the full (extension) build and the metadata-only
7
7
  # fallback below, so the two setup() calls can't drift apart.
@@ -24,6 +24,7 @@ try:
24
24
  "chtoolset._query",
25
25
  sources=[
26
26
  "src/query.cpp",
27
+ "src/AllocatorWrappers.cpp",
27
28
  ],
28
29
  depends=[
29
30
  "conf.py",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinybird-toolset
3
- Version: 2.6.7
3
+ Version: 2.7.1
4
4
  Home-page: https://gitlab.com/tinybird/clickhouse-toolset
5
5
  Author: Tinybird.co
6
6
  Author-email: support@tinybird.co
@@ -124,7 +124,7 @@ EXISTING_TYPES = [
124
124
  # '{"name":"SimpleAggregateFunction","case_insensitive":0,"alias_to":""}',
125
125
  '{"name":"String","case_insensitive":0,"alias_to":""}',
126
126
  '{"name":"TEXT","case_insensitive":1,"alias_to":"String"}',
127
- '{"name":"TIME","case_insensitive":1,"alias_to":"Int64"}',
127
+ '{"name":"TIME","case_insensitive":1,"alias_to":""}',
128
128
  '{"name":"TIMESTAMP","case_insensitive":1,"alias_to":"DateTime"}',
129
129
  '{"name":"TINYBLOB","case_insensitive":1,"alias_to":"String"}',
130
130
  '{"name":"TINYINT","case_insensitive":1,"alias_to":"Int8"}',
@@ -29,6 +29,9 @@ class TestTables(unittest.TestCase):
29
29
  ('SELECT * FROM t WHERE event_date IN (Select * FROM system.query_log)', [('', 't', ''), ('system', 'query_log', '')]),
30
30
  ]
31
31
 
32
+ def test_json_all_paths_is_allowed(self):
33
+ self.assertEqual(chquery.tables("SELECT JSONAllPaths('{}'::JSON)"), [])
34
+
32
35
  def test_extract_tables(self):
33
36
  for (sql, expected_tables) in self.scenarios:
34
37
  with self.subTest(sql=sql, expected_tables=expected_tables):
@@ -82,15 +82,17 @@ class TestValidateTTL(unittest.TestCase):
82
82
  )
83
83
  )
84
84
 
85
- def test_invalid_unwrapped_datetime64(self):
86
- err = chquery.validate_ttl(
87
- ttl="event_time + toIntervalDay(7)",
88
- columns=[{"name": "event_time", "type": "DateTime64(3)"}],
89
- sorting_key="event_time",
90
- primary_key="event_time",
91
- )
92
- self.assertIsNotNone(err)
93
- self.assertIn("TTL expression result column should have DateTime or Date type", err)
85
+ def test_invalid_unwrapped_datetime64_and_date32(self):
86
+ for type_name in ("DateTime64(3)", "Date32"):
87
+ with self.subTest(type_name=type_name):
88
+ err = chquery.validate_ttl(
89
+ ttl="event_time + toIntervalDay(7)",
90
+ columns=[{"name": "event_time", "type": type_name}],
91
+ sorting_key="event_time",
92
+ primary_key="event_time",
93
+ )
94
+ self.assertIsNotNone(err)
95
+ self.assertIn("TTL expression result column should have DateTime or Date type", err)
94
96
 
95
97
  def test_invalid_unknown_column(self):
96
98
  err = chquery.validate_ttl(
@@ -375,6 +377,94 @@ class TestValidateTTL(unittest.TestCase):
375
377
  )
376
378
  )
377
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
+
378
468
  # --- Input validation ---
379
469
  def test_columns_must_be_list_of_dicts(self):
380
470
  with self.assertRaises(TypeError):