'Clickhouse: any way to use named connections or substitutions when setting up an HTTP-sourced dictionary with DDL?

I need to create an HTTP-sourced dictionary in Clickhouse with DDL-request (https://clickhouse.com/docs/en/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources/#dicts-external_dicts_dict_sources-http).

My DDL request so far looks like:

CREATE DICTIONARY some_dictionary (id String, name String)
PRIMARY KEY id
SOURCE(HTTP(
    url 'http://127.0.0.1:5050/my-service/some-dictionary'
    format 'JSONEachRow'
    ))
LIFETIME(MIN 240 MAX 300)
LAYOUT(COMPLEX_KEY_HASHED());

My problem is that I need to specify different url for different stands (dev, test, prod) - means I need to externalize url value. I tried named connections (https://clickhouse.com/docs/en/operations/named-collections/), but they seem to work with odbc sourced dictionaries only. I also tried defining substitution parameter in macros section and stating my url like '{url}/my-service/some-dictionary' (https://clickhouse.com/docs/en/operations/server-configuration-parameters/settings/#macros), but it also seems to be for creating replicated tables only.

Any way to externalize http-sourced dictionary url for DDL query?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source