ClickhouseAnnouncement
Executable UDFs are now in public beta on ClickHouse Cloud
Summary
Executable UDFs are available in public beta on ClickHouse Cloud, allowing Python functions packaged as zip files to be called from SQL like built-in functions. ClickHouse runs them in a pool of long-lived sandboxed processes, keeping model code near the data and supporting use in ad-hoc queries, joins, and materialized views. The demonstration wraps a roughly 270K-parameter PyTorch autoencoder in an embed_trade UDF that consumes 14 features, produces a 32-dimensional embedding and reconstruction error, and scores trades as they enter through a materialized view. Training uses streamed Parquet chunks, incremental StandardScaler fitting, early stopping, and saved model artifacts; the deployed pool keeps the 2MB model hot, so inference occurs once per trade and downstream queries read the resulting table.
Context
Applying a trained model to streaming ClickHouse data previously required a separate scoring service, translating the model into SQL, or batch scoring offline. These options add infrastructure, make model updates cumbersome, or sacrifice freshness for data that needs to be evaluated as it arrives.
Approach / What changed
A Python model is packaged with its dependencies and artifacts in a zip file and uploaded through the ClickHouse Cloud console as an executable_pool UDF. Long-lived sandboxed processes load the model at startup, while a materialized view calls the UDF on every insert and writes embeddings and reconstruction scores to a table for downstream SQL queries.
Takeaways
Executable UDFs can be called from SQL in ad-hoc queries, joins, and materialized views, including views that run on every insert.
The demo's embed_trade UDF wraps a roughly 270K-parameter PyTorch autoencoder, producing a 32-dimensional embedding and reconstruction error from 14 input features.
The deployed pool loads the 2MB model once per process and performs inference once per trade during ingest; the webapp reads the resulting table instead of rerunning the model.
Source and freshness
- Source
- clickhouse.com
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.