DuckDB Clickhouse System Table emulator for chsql
This project loosely emulates ClickHouse system tables within DuckDB for client compatibility
The chsql_system
extension provides a subset of system functions:
-
system.databases
-
system.tables
-
system.columns
-
system.functions
-
system.uptime
-
system.disks
-
uptime()
coming soon
D -- List all databases in scope
D SELECT * FROM system.databases;
βββββββββββ¬ββββββββββ¬ββββββββββββ¬ββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββ¬ββββββββββ
β name β engine β data_path β metadata_path β uuid β engine_full β comment β
β varchar β varchar β varchar β varchar β uuid β varchar β varchar β
βββββββββββΌββββββββββΌββββββββββββΌββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββΌββββββββββββββΌββββββββββ€
β memory β duckdb β NULL β β 80000000-0000-0000-0000-000000000000 β DuckDB β NULL β
β test β duckdb β test.db β β 80000000-0000-0000-0000-000000000000 β DuckDB β NULL β
β system β duckdb β NULL β β 80000000-0000-0000-0000-000000000000 β DuckDB β NULL β
β temp β duckdb β NULL β β 80000000-0000-0000-0000-000000000000 β DuckDB β NULL β
βββββββββββ΄ββββββββββ΄ββββββββββββ΄ββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββ΄ββββββββββ
D -- List all tables in scope
D SELECT * FROM system.tables;
ββββββββββββ¬βββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ¬βββββββββββββ¬βββββββββββββββ¬ββββββββββββ¬ββββββββββββββββ¬βββββββββββββββββββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ
β database β name β uuid β engine β is_temporary β data_path β metadata_path β metadata_modification_time β metadata_version β create_table_query β
β varchar β varchar β uuid β varchar β boolean β varchar β varchar β timestamp β int32 β varchar β
ββββββββββββΌβββββββββββββββΌβββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌβββββββββββββββΌββββββββββββΌββββββββββββββββΌβββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββ€
β test β remote_table β 80000000-0000-0000-0000-000000000000 β BASE TABLE β false β β β 1970-01-01 00:00:00 β 0 β CREATE TABLE remote_table(id INTEGER); β
ββββββββββββ΄βββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ΄βββββββββββββ΄βββββββββββββββ΄ββββββββββββ΄ββββββββββββββββ΄βββββββββββββββββββββββββββββ΄βββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββ
D -- List all columns in scope
D SELECT * FROM system.columns;
ββββββββββββ¬ββββββββββββ¬βββββββββββββββββββββββββββββ¬ββββββββββββ¬βββββββββββ¬ββββββββββ
β database β table β name β type β position β comment β
β varchar β varchar β varchar β varchar β int32 β varchar β
ββββββββββββΌββββββββββββΌβββββββββββββββββββββββββββββΌββββββββββββΌβββββββββββΌββββββββββ€
β memory β columns β database β VARCHAR β 0 β β
β memory β columns β table β VARCHAR β 1 β β
β memory β columns β name β VARCHAR β 2 β β
β memory β columns β type β VARCHAR β 3 β β
β memory β columns β position β INTEGER β 4 β β
β memory β columns β comment β VARCHAR β 5 β β
β memory β databases β name β VARCHAR β 0 β β
β memory β databases β engine β VARCHAR β 1 β β
β memory β databases β data_path β VARCHAR β 2 β β
β memory β databases β metadata_path β VARCHAR β 3 β β
β memory β databases β uuid β UUID β 4 β β
β memory β databases β engine_full β VARCHAR β 5 β β
β memory β databases β comment β VARCHAR β 6 β β
β memory β functions β name β VARCHAR β 0 β β
β memory β functions β is_aggregate β BOOLEAN β 1 β β
β memory β functions β case_insensitive β BOOLEAN β 2 β β
β memory β functions β description β VARCHAR β 3 β β
β memory β tables β database β VARCHAR β 0 β β
β memory β tables β name β VARCHAR β 1 β β
β memory β tables β uuid β UUID β 2 β β
β memory β tables β engine β VARCHAR β 3 β β
β memory β tables β is_temporary β BOOLEAN β 4 β β
β memory β tables β data_path β VARCHAR β 5 β β
β memory β tables β metadata_path β VARCHAR β 6 β β
β memory β tables β metadata_modification_time β TIMESTAMP β 7 β β
β memory β tables β metadata_version β INTEGER β 8 β β
β memory β tables β create_table_query β VARCHAR β 9 β β
ββββββββββββ΄ββββββββββββ΄βββββββββββββββββββββββββββββ΄ββββββββββββ΄βββββββββββ΄ββββββββββ€
β 27 rows 6 columns β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
D -- List all functions in scope
D SELECT * FROM system.functions;
ββββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β name β is_aggregate β case_insensitive β description β
β varchar β boolean β boolean β varchar β
ββββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β test_all_types β false β false β NULL β
β pragma_version β false β false β NULL β
β duckdb_sequences β false β false β NULL β
β duckdb_functions β false β false β NULL β
β duckdb_extensions β false β false β NULL β
β duckdb_constraints β false β false β NULL β
β system_columns β false β false β NULL β β
β Β· β Β· β Β· β Β· β
β Β· β Β· β Β· β Β· β
β Β· β Β· β Β· β Β· β
β format_type β false β false β NULL β
β has_column_privilege β false β false β NULL β
β inet_client_port β false β false β NULL β
ββββββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββ΄βββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 692 rows (40 shown) 4 columns β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
D -- List all attached databases and blocks as disks
D SELECT * FROM system.disks;
ββββββββββββ¬βββββββββββββββ¬βββββββββββββ¬ββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββ¬ββββββββββ¬ββββββββββββββββββββββ¬ββββββββββββββββ¬βββββββββββββββ¬βββββββββββββββ¬ββββββββββββββββ¬ββββββββββββ¬ββββββββββββ¬βββββββββββββ
β name β path β free_space β total_space β unreserved_space β keep_free_space β type β object_storage_type β metadata_type β is_encrypted β is_read_only β is_write_once β is_remote β is_broken β cache_path β
β varchar β varchar β int64 β int64 β int64 β int64 β varchar β varchar β varchar β boolean β boolean β boolean β boolean β boolean β varchar β
ββββββββββββΌβββββββββββββββΌβββββββββββββΌββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββΌββββββββββΌββββββββββββββββββββββΌββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌββββββββββββββββΌββββββββββββΌββββββββββββΌβββββββββββββ€
β localdb β test.db β 0 β 262144 β 0 β 0 β Local β None β None β false β false β false β false β false β β
β memory β NULL β 0 β 0 β 0 β 0 β Local β None β None β false β false β false β false β false β β
β testduck β /tmp/duck.db β 262144 β 786432 β 262144 β 0 β Local β None β None β false β false β false β false β false β β
ββββββββββββ΄βββββββββββββββ΄βββββββββββββ΄ββββββββββββββ΄βββββββββββββββββββ΄ββββββββββββββββββ΄ββββββββββ΄ββββββββββββββββββββββ΄ββββββββββββββββ΄βββββββββββββββ΄βββββββββββββββ΄ββββββββββββββββ΄ββββββββββββ΄ββββββββββββ΄βββββββββββββ
Don't use this unless you need ClickHouse client compatibility. Rely on pure DuckDB functions to build your applications.