Skip to main content

Designing ClickHouse table structure

NineData provides a visual table structure design solution. User can click the mouse in the SQL console to complete the table structure design without manually entering SQL commands.

Prerequisite

  • Database is ClickHouse.

  • In Organizational mode, user has the SQL console function module authority.

  • In Organizational mode, user has read and write permissions to the target data source.

    ::tip

    If user do not have the above permissions, please contact organization's system administrator to Configure permissions or Bind roles.

    :::

  • In the commercial versions (DevOps Pro, DevOps Enterprise), please ensure that your monthly/yearly subscription is not expired, as it may result in the inability to use the Database DevOpsservice. You can quickly check the remaining quota and expiration date at the top right corner of the NineData console page.

    check_quota

Steps

User can design the table structure when creating or editing a table through the SQL console. This article takes creating a table as an example to demonstrate.

  1. Open the SQL console and go to the target data source.

  2. In the database list on the left side of the SQL console, right-click the target database and click Create Table.

    ck_create_table

    tip

    The data table will be created in the target database.

  3. On the Create Table tab, user can start to visually design the table structure, and the system will automatically generate SQL Script at the bottom of the page according to the configuration. For details of the variable structure design page, please select the corresponding tab below.

    ck_table_creation

Click to expand the full visual parameter description of the table structure.
  • **Name**: The name of the custom table.
  • **Database**: Select the database under which the current table needs to be created. The default is the database right-clicked in step 2.
  • **Comment**: Comments for the table, that is, the COMMENT attribute.
  • **Table Engine**: Select the storage engine for the table.
  • **Local Table** (Displayed only when the table engine is Distributed): Select a local table to create a distributed table for.
  • **Distributed Parameters** (Displayed only when the table engine is Distributed): The parameters of the distributed table.
  • **Engine Parameters**: Table engine corresponding to the engine parameter.
  • On Cluster: Select the cluster to which the current ClickHouse database belongs, the current form and all later action on the table will take effect in all databases of the cluster. And **Create Distributed Table** will be selected by default. This option will specify the create table option: Engine = Distributed table.
  1. Click Save and click OK in the popup Submit window.

    tip

    SQL script can be used to perform in other database clients.