NAME

DBIO::ClickHouse::Introspect::Columns - Introspect ClickHouse columns via system.columns

VERSION

version 0.900004

DESCRIPTION

Fetches column metadata from system.columns, scoped to one database and filtered to the tables surfaced by DBIO::ClickHouse::Introspect::Tables.

The raw type string is kept

data_type holds the native ClickHouse type exactly as system.columns.type reports it -- LowCardinality(Nullable(String)), not text. Two reasons:

not_null is the one thing that must be derived here, because ClickHouse has no nullability column in system.columns: nullability is part of the type (Nullable(T)), and columns are NOT NULL by default.

Primary key

ClickHouse has no primary-key constraint. is_pk / pk_position come from primary_key_columns on the table row -- the bare column names of the MergeTree key, in key order. A column that only appears inside a key expression is not marked, because it cannot be named in a portable set_primary_key.

METHODS

fetch

my $columns = DBIO::ClickHouse::Introspect::Columns->fetch($dbh, $tables);
my $columns = DBIO::ClickHouse::Introspect::Columns->fetch($dbh, $tables, $database);

Given the tables hashref from DBIO::ClickHouse::Introspect::Tables, returns a hashref keyed by table name. Each value is an arrayref of column hashrefs in position order with keys: column_name, data_type (the native type string), not_null, default_kind, default_value (the raw default expression, not a Perl value), is_pk, pk_position, is_in_sorting_key, is_in_partition_key, position, comment, compression_codec.

SEE ALSO

AUTHOR

DBIO Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.