Skip to main content

dictionary

Displays the dictionary data as a ClickHouse table. Works the same way as Dictionary engine.

Syntax

dictionary('dict')

Arguments

  • dict β€” A dictionary name. String.

Returned value

A ClickHouse table.

Example

Input table dictionary_source_table:

β”Œβ”€id─┬─value─┐
β”‚ 0 β”‚ 0 β”‚
β”‚ 1 β”‚ 1 β”‚
β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜

Create a dictionary:

CREATE DICTIONARY new_dictionary(id UInt64, value UInt64 DEFAULT 0) PRIMARY KEY id
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dictionary_source_table')) LAYOUT(DIRECT());

Query:

SELECT * FROM dictionary('new_dictionary');

Result:

β”Œβ”€id─┬─value─┐
β”‚ 0 β”‚ 0 β”‚
β”‚ 1 β”‚ 1 β”‚
β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜

See Also