Skip to content

Instantly share code, notes, and snippets.

View lesandie's full-sized avatar

Diego Nieto lesandie

View GitHub Profile
@lesandie
lesandie / README.md
Created November 12, 2026 10:44
ClickHouse JSON column example: ingestion, typed paths, arrays and versioned queries (companion to path selection)

ClickHouse JSON in 26.8: versioned satellite telemetry and shared access

This lab adapts a telemetry table with a stable 20-column event envelope and multiple payload families to native JSON. It preserves the original String payload, event identity, monthly partitions and replacement rules. It adds typed paths for selected measurements and keeps customer access in a separate relation.

All identifiers and values in the executable examples are synthetic. Measurement paths and column structure follow the supplied schema. No company names, source satellite names, credentials, endpoints or copied event records are included.

The complete lab was executed on ClickHouse 26.8.6.5 in Docker. This is a correctness check, not a performance benchmark or validation on another build.

Companion guide: JSON path and type selection. Start here for runnable ingestion and query examples; use the companion to choose hints and compare path budgets.

@lesandie
lesandie / README.md
Created October 21, 2026 11:39
ClickHouse JSON path and type selection runbook

ClickHouse JSON path and type selection runbook

Use this runbook to choose JSON type hints and a max_dynamic_paths budget for a changing JSON payload. It is generic: replace the example table, envelope, and payload paths with your own. Load a representative dataset and test on the exact ClickHouse build you plan to use.

How paths are stored

Original JSON string ──► native JSON column
                              │
 ┌────────────┴────────────┐
@lesandie
lesandie / research-report.md
Last active June 26, 2026 16:07
ClickHouse WebAssembly UDF — State of the Art (June 2026)

ClickHouse WASM UDF — State of the Art (June 2026)

ClickHouse shipped native WASM UDF support in v26.3 LTS (2026-03-26), marked experimental. It is actively developed — ~20 PRs merged in the four months since release — but carries material limitations: the feature requires a server-level opt-in flag, is not available on ClickHouse Cloud, and the sandboxing/ABI surface is still evolving. For self-managed clusters on v26.3+, WASM UDFs are usable today. Cloud deployments must wait for a GA announcement or use the existing executable-UDF approach.

See also: How to write a ClickHouse WebAssembly UDF — practical howto covering syntax, compilation, and loading


1. Availability and Versions

@lesandie
lesandie / RESUME.md
Last active September 26, 2026 09:42
ClickHouse Keeper tuning: snapshot_distance, reserved_log_items, rotate_log_storage_interval

RESUME: continuing the Keeper snapshot tests

This file is for whoever picks the tests up next, whether an engineer or an AI agent. Read it before you run anything. Findings live in clickhouse-keeper-tuning.md; this file covers how to continue.

Where testing stopped (2026-09-26)

  • Done: E1–E10 and the E5/E9 catch-up cases, on Keeper 26.8.10.6. Results are in the guide, the data-*.csv files, and raw-results.tar.zst (as results-v2/).
@lesandie
lesandie / clickhouse-wasm-udf-howto.md
Last active June 26, 2026 16:04
ClickHouse WebAssembly UDF howto

How to write a ClickHouse WebAssembly UDF

A short howto for creating, compiling, loading, and using WebAssembly user-defined functions in ClickHouse. Grounded in the upstream documentation (docs/en/sql-reference/functions/wasm_udf.md) and the repo's own test fixtures (tests/queries/0_stateless/wasm/).

WASM UDFs are experimental and not available in ClickHouse Cloud.
See also: ClickHouse WASM UDF — State of the Art (June 2026) for the full PR history, known issues, and roadmap.

@lesandie
lesandie / upgrade.xml
Created June 25, 2024 08:32
Upgrade snippet for ClickHouse to allow Downgrades
<!-- Upgrade from 21/22 to 23.8 and after to 24 -->
<clickhouse>
<index_mark_cache_size>5368709120</index_mark_cache_size>
<merge_tree>
<ratio_of_defaults_for_sparse_serialization>1</ratio_of_defaults_for_sparse_serialization>
<compress_marks>0</compress_marks>
<compress_primary_key>0</compress_primary_key>
</merge_tree>
</clickhouse>
@lesandie
lesandie / file_buffering.py
Created November 28, 2021 10:05
File buffering example
# Simple line buffering example
# When using the context maganet with,
# simply use a 1 to open the file in buffering mode
filename = "input_file.txt"
with open(filename, 'r', 1) as filehandle:
filecontent = filehandle.buffer
for line in filecontent:
line = line.decode()
line = line.strip()
print(line)
@lesandie
lesandie / txt2csv.py
Created November 26, 2021 20:02
Simple python txt to csv conversion
from csv import Reader, Writer
txt_file = "infile.txt"
csv_file = "output.txt"
delimiter = "|"
with open(txt_file, 'r') as txt_fh, \
open(csv_file, 'w'i, newline="", encoding="utf-8") as csv_fh:
writer(csv_fh).writerows(reader(txt_fh, delimiter=delimiter))
@lesandie
lesandie / pg_admin.md
Last active November 26, 2021 20:00
Curso_postgres acctaplic DB

ADMIN queries

-------------------
-- Check max conn
-------------------
SELECT  * FROM
(SELECT COUNT(*) used FROM pg_stat_activity) q1,
(SELECT setting::int res_for_super FROM pg_settings WHERE name=$$superuser_reserved_connections$$) q2,
(SELECT setting::int max_conn FROM pg_settings WHERE name=$$max_connections$$) q3;

Keybase proof

I hereby claim:

  • I am lesandie on github.
  • I am dnieto (https://keybase.io/dnieto) on keybase.
  • I have a public key ASAXr56B-V6EOKUoZoqOhWIXfF2GNhdYHELNNEd58QF8IAo

To claim this, I am signing this object: