MeridianMERIDIAN

DuckDB Extension

Classify, inspect, and cast text data directly inside DuckDB using the FineType community extension.

The FineType DuckDB extension brings semantic type detection into your SQL queries. Classify values, inspect detailed results, normalise data for safe casting, and unpack JSON fields — all without leaving DuckDB.

Early Release

FineType is under active development. Expect breaking changes to taxonomy labels, function signatures, and model formats between releases. Pin to a specific version if stability matters for your use case.

Installation

INSTALL finetype FROM community;
LOAD finetype;

The extension embeds model weights at compile time — no external files or network requests needed at runtime.

Functions

finetype() — Classify a value

Returns the semantic type label for a text value.

SELECT finetype('192.168.1.1');
-- → 'technology.internet.ip_v4'

SELECT finetype('2024-01-15T09:30:00Z');
-- → 'datetime.timestamp.iso_8601'

SELECT finetype('GB82 WEST 1234 5698 7654 32');
-- → 'finance.banking.iban'

finetype_detail() — Detailed classification

Returns a JSON object with the type label, confidence score, and DuckDB broad type.

SELECT finetype_detail(value) FROM my_table;
-- → '{"type":"datetime.date.us_slash","confidence":0.98,"broad_type":"DATE"}'

This is useful when you need to filter by confidence or inspect broad type mappings programmatically.

finetype_cast() — Normalise for safe casting

Returns a normalised version of the value that can be safely passed to TRY_CAST. FineType knows the format, so it can rewrite the value into a form DuckDB will accept.

SELECT finetype_cast(value) FROM my_table;

finetype_unpack() — Recursively classify JSON fields

Walks a JSON column and classifies each leaf value, returning the structure with type annotations.

SELECT finetype_unpack(json_col) FROM my_table;

finetype_version() — Check extension version

SELECT finetype_version();

Example workflow

Profile a table's text columns, then use the results to build safe casts:

-- Step 1: Classify a column
SELECT DISTINCT finetype(order_date) AS detected_type
FROM orders;
-- → 'datetime.date.us_slash'

-- Step 2: Cast with the detected type
SELECT TRY_CAST(finetype_cast(order_date) AS DATE) AS order_date
FROM orders;

See also

On this page