Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement clickhouse metadata APIs #648

Merged
merged 3 commits into from
Jul 4, 2024
Merged

Conversation

onlyjackfrost
Copy link
Collaborator

@onlyjackfrost onlyjackfrost commented Jul 3, 2024

(POST) /v2/ibis/clickhouse/metadata/tables

Request payload Example

{
  "connectionInfo": {
      "connectionUrl": "clickhouse://user:pwd@host:port/database?secure=1"
  }
}

or

{
  "connectionInfo": {
      "host": "localhost",
      "port":  8443,
      "user": "my-user",
      "password": "my-pwd",
      "database": "my-database"
  }
}

Response Example

  • name: unique table name (might contain schema name, depends on are you listing table across schema or not )
  • columns
    • name: column name in the datasource
    • type: column data type
    • notNull: boolean, nullable or not
    • description: column description(comment) if any
    • properties: column properties if any
  • description: table description if any
  • properties
    • schema: schema name to build tableReference
    • catalog: catalog name to build tableReference
    • table: table name to build tableReference
  • primaryKey: the column name which is bind with primary constraint
[
    {
        "name": "dbo.REGION",
        "columns": [
            {
                "name": "R_COMMENT",
                "type": "VARCHAR",
                "notNull": false,
                "description": "",
                "properties": null
            }
        ],
        "description": "",
        "properties": {
            "schema": "db",
            "catalog": "def",
            "table": "REGION"
        },
        "primaryKey": ""
    },
]

(POST) /v2/ibis/clickhouse/metadata/constraints

Request payload Example

{
  "connectionInfo": {
      "connectionUrl": "clickhouse://user:pwd@host:port/database"
  }
}

Note: ClickHouse does not support foreign key constraints. This API will return an empty array for now.

Response Example

[]

@onlyjackfrost onlyjackfrost force-pushed the feature/metadata-clickhouse branch from 0e230fa to 96189a2 Compare July 3, 2024 13:11
@grieve54706
Copy link
Contributor

How about adding a test for getting constraints that will return an empty array?

Copy link
Contributor

@grieve54706 grieve54706 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@grieve54706 grieve54706 merged commit 112bc5f into main Jul 4, 2024
4 checks passed
@grieve54706 grieve54706 deleted the feature/metadata-clickhouse branch July 4, 2024 02:56
grieve54706 pushed a commit that referenced this pull request Dec 13, 2024
* implement clickhouse metadata  APIs

* add list constraints test

* fix format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants