Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Blog
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
Yandex Managed Service for ClickHouse
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Information about existing clusters
    • Creating clusters
    • Connecting to a database
    • Stopping and starting clusters
    • SQL queries in the management console
    • Changing cluster and database settings
    • Setting up access to ObjectStorage
    • Connecting external dictionaries
    • Adding your own geobase
    • Managing machine learning models
    • Managing data format schemas
    • Connecting to DataLens
    • Changing ClickHouse versions
    • Managing ZooKeeper hosts
    • Managing ClickHouse hosts
    • Managing databases
    • Managing database users
    • Managing backups
    • Managing shards
    • Managing groups of shards
    • Viewing cluster logs
    • Deleting clusters
    • Monitoring the state of clusters and hosts
  • Practical guidelines
    • All use cases
    • Adding data to the database
    • Sharding tables
    • Using hybrid storage
    • Getting data from Managed Service for Apache Kafka®
    • Getting data from RabbitMQ
    • Exchanging data with Yandex Data Proc
    • Configuring Yandex Cloud DNS for accessing clusters from other cloud networks
    • Analyzing Object Storage logs in DataLens
    • Configuring Managed Service for ClickHouse for Graphite
    • Saving a Yandex Data Streams data stream in Managed Service for ClickHouse
  • Concepts
    • Relationships between service resources
    • Host classes
      • Active host classes
      • Archive
        • Before June 1, 2020
      • Using deprecated host classes
    • Network in Managed Service for ClickHouse
    • Quotas and limits
    • Storage types
    • Backups
    • Replication
    • Dictionaries
    • Sharding
    • Maintenance
    • Supported clients
    • Managing memory in Managed Service for ClickHouse
    • ClickHouse versioning policy
    • ClickHouse settings
  • Access management
  • Pricing policy
    • Current pricing policy
    • Archive
      • Before January 1, 2019
      • From January 1 to March 1, 2019
      • From March 1, 2019 to February 1, 2020
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • BackupService
      • ClusterService
      • DatabaseService
      • FormatSchemaService
      • MlModelService
      • ResourcePresetService
      • UserService
      • VersionsService
      • OperationService
    • REST
      • Overview
      • Backup
        • Overview
        • get
        • list
      • Cluster
        • Overview
        • addHosts
        • addShard
        • addZookeeper
        • backup
        • create
        • createExternalDictionary
        • createShardGroup
        • delete
        • deleteExternalDictionary
        • deleteHosts
        • deleteShard
        • deleteShardGroup
        • get
        • getShard
        • getShardGroup
        • list
        • listBackups
        • listHosts
        • listLogs
        • listOperations
        • listShardGroups
        • listShards
        • move
        • rescheduleMaintenance
        • restore
        • start
        • stop
        • streamLogs
        • update
        • updateExternalDictionary
        • updateHosts
        • updateShard
        • updateShardGroup
      • Database
        • Overview
        • create
        • delete
        • get
        • list
      • FormatSchema
        • Overview
        • create
        • delete
        • get
        • list
        • update
      • MlModel
        • Overview
        • create
        • delete
        • get
        • list
        • update
      • ResourcePreset
        • Overview
        • get
        • list
      • User
        • Overview
        • create
        • delete
        • get
        • grantPermission
        • list
        • revokePermission
        • update
      • Versions
        • Overview
        • list
      • Operation
        • Overview
        • get
  • Revision history
  • Questions and answers
    • General questions
    • Questions about ClickHouse
    • Connection
    • Updating clusters
    • Cluster configuration
    • Moving and restoring a cluster
    • Monitoring and logs
    • All questions on one page
  1. API reference
  2. REST
  3. Cluster
  4. createExternalDictionary

Managed Service for ClickHouse API, REST: Cluster.createExternalDictionary

Written by
Yandex Cloud
  • HTTP request
  • Path parameters
  • Body parameters
  • Response

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.
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. For more details, see PostgreSQL documentation.

  • DISABLE: Only try a non-SSL connection.
  • ALLOW: First try a non-SSL connection; if that fails, try an SSL connection.
  • PREFER: First try an SSL connection; if that fails, try a non-SSL connection.
  • VERIFY_CA: Only try an SSL connection, and verify that the server certificate is issued by a trusted certificate authority (CA).
  • VERIFY_FULL: Only try an SSL connection, verify that the server certificate is issued by a trusted CA and that the requested server host name matches that in the certificate.

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. The range of possible values is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z, i.e. from 0 to 9 digits for fractions of a second.

To work with values in this field, use the APIs described in the Protocol Buffers reference. In some languages, built-in datetime utilities do not support nanosecond precision (9 digits).

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. The range of possible values is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z, i.e. from 0 to 9 digits for fractions of a second.

To work with values in this field, use the APIs described in the Protocol Buffers reference. In some languages, built-in datetime utilities do not support nanosecond precision (9 digits).

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
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.

Was the article helpful?

Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
In this article:
  • HTTP request
  • Path parameters
  • Body parameters
  • Response