Method createExternalDictionary

Creates an external dictionary for the specified ClickHouse cluster.

HTTP request

POST https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/clusters/{clusterId}:createExternalDictionary

Path parameters

Parameter Description
clusterId Required. ID of the ClickHouse cluster to create the external dictionary for. To get the cluster ID, use a list request. The maximum string length in characters is 50.

Body parameters

{
  "externalDictionary": {
    "name": "string",
    "structure": {
      "id": {
        "name": "string"
      },
      "key": {
        "attributes": [
          {
            "name": "string",
            "type": "string",
            "nullValue": "string",
            "expression": "string",
            "hierarchical": true,
            "injective": true
          }
        ]
      },
      "rangeMin": {
        "name": "string",
        "type": "string",
        "nullValue": "string",
        "expression": "string",
        "hierarchical": true,
        "injective": true
      },
      "rangeMax": {
        "name": "string",
        "type": "string",
        "nullValue": "string",
        "expression": "string",
        "hierarchical": true,
        "injective": true
      },
      "attributes": [
        {
          "name": "string",
          "type": "string",
          "nullValue": "string",
          "expression": "string",
          "hierarchical": true,
          "injective": true
        }
      ]
    },
    "layout": {
      "type": "string",
      "sizeInCells": "string"
    },

    // `externalDictionary` includes only one of the fields `httpSource`, `mysqlSource`, `clickhouseSource`, `mongodbSource`, `postgresqlSource`
    "fixedLifetime": "string",
    "lifetimeRange": {
      "min": "string",
      "max": "string"
    },
    // end of the list of possible fields`externalDictionary`

    "httpSource": {
      "url": "string",
      "format": "string"
    },
    "mysqlSource": {
      "db": "string",
      "table": "string",
      "port": "string",
      "user": "string",
      "password": "string",
      "replicas": [
        {
          "host": "string",
          "priority": "string",
          "port": "string",
          "user": "string",
          "password": "string"
        }
      ],
      "where": "string",
      "invalidateQuery": "string"
    },
    "clickhouseSource": {
      "db": "string",
      "table": "string",
      "host": "string",
      "port": "string",
      "user": "string",
      "password": "string",
      "where": "string"
    },
    "mongodbSource": {
      "db": "string",
      "collection": "string",
      "host": "string",
      "port": "string",
      "user": "string",
      "password": "string"
    },
    "postgresqlSource": {
      "db": "string",
      "table": "string",
      "hosts": [
        "string"
      ],
      "port": "string",
      "user": "string",
      "password": "string",
      "invalidateQuery": "string",
      "sslMode": "string"
    }
  }
}
Field Description
externalDictionary object

Configuration of the external dictionary.

externalDictionary.
name
string

Required. Name of the external dictionary.

externalDictionary.
structure
object
Required. Set of attributes for the external dictionary. For in-depth description, see ClickHouse documentation.
externalDictionary.
structure.
id
object

Single numeric key column for the dictionary.

Numeric key.

externalDictionary.
structure.
id.
name
string

Required. Name of the numeric key.

externalDictionary.
structure.
key
object

Composite key for the dictionary, containing of one or more key columns. For details, see ClickHouse documentation.

Complex key.

externalDictionary.
structure.
key.
attributes[]
object

Required. Attributes of a complex key.

Must contain at least one element.

externalDictionary.
structure.
key.
attributes[].
name
string

Required. Name of the column.

externalDictionary.
structure.
key.
attributes[].
type
string

Required. Type of the column.

externalDictionary.
structure.
key.
attributes[].
nullValue
string

Default value for an element without data (for example, an empty string).

externalDictionary.
structure.
key.
attributes[].
expression
string

Expression, describing the attribute, if applicable.

externalDictionary.
structure.
key.
attributes[].
hierarchical
boolean (boolean)

Indication of hierarchy support. Default value: false.

externalDictionary.
structure.
key.
attributes[].
injective
boolean (boolean)

Indication of injective mapping "id -> attribute". Default value: false.

externalDictionary.
structure.
rangeMin
object

Field holding the beginning of the range for dictionaries with RANGE_HASHED layout. For details, see ClickHouse documentation.

externalDictionary.
structure.
rangeMin.
name
string

Required. Name of the column.

externalDictionary.
structure.
rangeMin.
type
string

Required. Type of the column.

externalDictionary.
structure.
rangeMin.
nullValue
string

Default value for an element without data (for example, an empty string).

externalDictionary.
structure.
rangeMin.
expression
string

Expression, describing the attribute, if applicable.

externalDictionary.
structure.
rangeMin.
hierarchical
boolean (boolean)

Indication of hierarchy support. Default value: false.

externalDictionary.
structure.
rangeMin.
injective
boolean (boolean)

Indication of injective mapping "id -> attribute". Default value: false.

externalDictionary.
structure.
rangeMax
object

Field holding the end of the range for dictionaries with RANGE_HASHED layout. For details, see ClickHouse documentation.

externalDictionary.
structure.
rangeMax.
name
string

Required. Name of the column.

externalDictionary.
structure.
rangeMax.
type
string

Required. Type of the column.

externalDictionary.
structure.
rangeMax.
nullValue
string

Default value for an element without data (for example, an empty string).

externalDictionary.
structure.
rangeMax.
expression
string

Expression, describing the attribute, if applicable.

externalDictionary.
structure.
rangeMax.
hierarchical
boolean (boolean)

Indication of hierarchy support. Default value: false.

externalDictionary.
structure.
rangeMax.
injective
boolean (boolean)

Indication of injective mapping "id -> attribute". Default value: false.

externalDictionary.
structure.
attributes[]
object

Required. Description of the fields available for database queries. For details, see ClickHouse documentation.

Must contain at least one element.

externalDictionary.
structure.
attributes[].
name
string

Required. Name of the column.

externalDictionary.
structure.
attributes[].
type
string

Required. Type of the column.

externalDictionary.
structure.
attributes[].
nullValue
string

Default value for an element without data (for example, an empty string).

externalDictionary.
structure.
attributes[].
expression
string

Expression, describing the attribute, if applicable.

externalDictionary.
structure.
attributes[].
hierarchical
boolean (boolean)

Indication of hierarchy support. Default value: false.

externalDictionary.
structure.
attributes[].
injective
boolean (boolean)

Indication of injective mapping "id -> attribute". Default value: false.

externalDictionary.
layout
object
Required. Layout for storing the dictionary in memory. For in-depth description, see ClickHouse documentation.

Layout determining how to store the dictionary in memory.

externalDictionary.
layout.
type
string

Required. Layout type for an external dictionary.

  • FLAT: The entire dictionary is stored in memory in the form of flat arrays. Available for all dictionary sources.
  • HASHED: The entire dictionary is stored in memory in the form of a hash table. Available for all dictionary sources.
  • COMPLEX_KEY_HASHED: Similar to HASHED, to be used with composite keys. Available for all dictionary sources.
  • RANGE_HASHED: The entire dictionary is stored in memory in the form of a hash table, with an ordered array of ranges and their corresponding values. Available for all dictionary sources.
  • CACHE: The dictionary is stored in a cache with a set number of cells. Available for MySQL, ClickHouse and HTTP dictionary sources.
  • COMPLEX_KEY_CACHE: Similar to CACHE, to be used with composite keys. Available for MySQL, ClickHouse and HTTP dictionary sources.
externalDictionary.
layout.
sizeInCells
string (int64)

Number of cells in the cache. Rounded up to a power of two. Applicable only for CACHE and COMPLEX_KEY_CACHE layout types.

externalDictionary.
fixedLifetime
string (int64)
externalDictionary includes only one of the fields fixedLifetime, lifetimeRange

Fixed interval between dictionary updates.

externalDictionary.
lifetimeRange
object
Range of intervals between dictionary updates for ClickHouse to choose from.
externalDictionary includes only one of the fields fixedLifetime, lifetimeRange

externalDictionary.
lifetimeRange.
min
string (int64)

Minimum dictionary lifetime.

externalDictionary.
lifetimeRange.
max
string (int64)

Maximum dictionary lifetime.

externalDictionary.
httpSource
object
HTTP source for the dictionary.
externalDictionary includes only one of the fields httpSource, mysqlSource, clickhouseSource, mongodbSource, postgresqlSource

externalDictionary.
httpSource.
url
string

Required. URL of the source dictionary available over HTTP.

externalDictionary.
httpSource.
format
string

Required. The data format. Valid values are all formats supported by ClickHouse SQL dialect.

externalDictionary.
mysqlSource
object
MySQL source for the dictionary.
externalDictionary includes only one of the fields httpSource, mysqlSource, clickhouseSource, mongodbSource, postgresqlSource

externalDictionary.
mysqlSource.
db
string

Required. Name of the MySQL database to connect to.

externalDictionary.
mysqlSource.
table
string

Required. Name of the database table to use as a ClickHouse dictionary.

externalDictionary.
mysqlSource.
port
string (int64)

Default port to use when connecting to a replica of the dictionary source.

Acceptable values are 0 to 65535, inclusive.

externalDictionary.
mysqlSource.
user
string

Name of the default user for replicas of the dictionary source.

externalDictionary.
mysqlSource.
password
string

Password of the default user for replicas of the dictionary source.

externalDictionary.
mysqlSource.
replicas[]
object

Required. List of MySQL replicas of the database used as dictionary source.

Must contain at least one element.

externalDictionary.
mysqlSource.
replicas[].
host
string

Required. MySQL host of the replica.

The maximum string length in characters is 253.

externalDictionary.
mysqlSource.
replicas[].
priority
string (int64)

Required. The priority of the replica that ClickHouse takes into account when connecting. Replica with the highest priority should have this field set to the lowest number.

Value must be greater than 0.

externalDictionary.
mysqlSource.
replicas[].
port
string (int64)

Port to use when connecting to the replica. If a port is not specified for a replica, ClickHouse uses the port specified for the source.

Acceptable values are 0 to 65535, inclusive.

externalDictionary.
mysqlSource.
replicas[].
user
string

Name of the MySQL database user.

externalDictionary.
mysqlSource.
replicas[].
password
string

Password of the MySQL database user.

externalDictionary.
mysqlSource.
where
string

Selection criteria for the data in the specified MySQL table.

externalDictionary.
mysqlSource.
invalidateQuery
string

Query for checking the dictionary status, to pull only updated data. For more details, see ClickHouse documentation on dictionaries.

externalDictionary.
clickhouseSource
object
ClickHouse source for the dictionary.
externalDictionary includes only one of the fields httpSource, mysqlSource, clickhouseSource, mongodbSource, postgresqlSource

externalDictionary.
clickhouseSource.
db
string

Required. Name of the ClickHouse database.

externalDictionary.
clickhouseSource.
table
string

Required. Name of the table in the specified database to be used as the dictionary source.

externalDictionary.
clickhouseSource.
host
string

Required. ClickHouse host of the specified database.

The maximum string length in characters is 253.

externalDictionary.
clickhouseSource.
port
string (int64)

Port to use when connecting to the host.

Acceptable values are 0 to 65535, inclusive.

externalDictionary.
clickhouseSource.
user
string

Required. Name of the ClickHouse database user.

externalDictionary.
clickhouseSource.
password
string

Password of the ClickHouse database user.

externalDictionary.
clickhouseSource.
where
string

Selection criteria for the data in the specified ClickHouse table.

externalDictionary.
mongodbSource
object
MongoDB source for the dictionary.
externalDictionary includes only one of the fields httpSource, mysqlSource, clickhouseSource, mongodbSource, postgresqlSource

externalDictionary.
mongodbSource.
db
string

Required. Name of the MongoDB database.

externalDictionary.
mongodbSource.
collection
string

Required. Name of the collection in the specified database to be used as the dictionary source.

externalDictionary.
mongodbSource.
host
string

Required. MongoDB host of the specified database.

The maximum string length in characters is 253.

externalDictionary.
mongodbSource.
port
string (int64)

Port to use when connecting to the host.

Acceptable values are 0 to 65535, inclusive.

externalDictionary.
mongodbSource.
user
string

Required. Name of the MongoDB database user.

externalDictionary.
mongodbSource.
password
string

Password of the MongoDB database user.

externalDictionary.
postgresqlSource
object
PostgreSQL source for the dictionary.
externalDictionary includes only one of the fields httpSource, mysqlSource, clickhouseSource, mongodbSource, postgresqlSource

externalDictionary.
postgresqlSource.
db
string

Required. Name of the PostrgreSQL database.

externalDictionary.
postgresqlSource.
table
string

Required. Name of the table in the specified database to be used as the dictionary source.

externalDictionary.
postgresqlSource.
hosts[]
string

Required. Name of the PostrgreSQL host

Must contain at least one element.

externalDictionary.
postgresqlSource.
port
string (int64)

Port to use when connecting to the host.

Acceptable values are 0 to 65535, inclusive.

externalDictionary.
postgresqlSource.
user
string

Required. Name of the PostrgreSQL database user.

externalDictionary.
postgresqlSource.
password
string

Password of the PostrgreSQL database user.

externalDictionary.
postgresqlSource.
invalidateQuery
string

Query for checking the dictionary status, to pull only updated data. For more details, see ClickHouse documentation on dictionaries.

externalDictionary.
postgresqlSource.
sslMode
string

Mode of SSL TCP/IP connection to the PostgreSQL host. There are six modes: disable, allow, prefer (default), require, verify-ca, verify-full. For more details, see PostgreSQL documentation.

Response

HTTP Code: 200 - OK

{
  "id": "string",
  "description": "string",
  "createdAt": "string",
  "createdBy": "string",
  "modifiedAt": "string",
  "done": true,
  "metadata": "object",

  //  includes only one of the fields `error`, `response`
  "error": {
    "code": "integer",
    "message": "string",
    "details": [
      "object"
    ]
  },
  "response": "object",
  // end of the list of possible fields

}

An Operation resource. For more information, see Operation.

Field Description
id string

ID of the operation.

description string

Description of the operation. 0-256 characters long.

createdAt string (date-time)

Creation timestamp.

String in RFC3339 text format.

createdBy string

ID of the user or service account who initiated the operation.

modifiedAt string (date-time)

The time when the Operation resource was last modified.

String in RFC3339 text format.

done boolean (boolean)

If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.

metadata object

Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.

error object
The error result of the operation in case of failure or cancellation.
includes only one of the fields error, response

The error result of the operation in case of failure or cancellation.

error.
code
integer (int32)

Error code. An enum value of google.rpc.Code.

error.
message
string

An error message.

error.
details[]
object

A list of messages that carry the error details.

response object
includes only one of the fields error, response

The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is the standard Create/Update, the response should be the target resource of the operation. Any method that returns a long-running operation should document the response type, if any.