From f1c427f0c31fb8dbb5a965f922ece7ace4488582 Mon Sep 17 00:00:00 2001 From: Benoit Ranque Date: Tue, 3 Oct 2023 11:27:25 -0400 Subject: [PATCH] rename to ndc-clickhouse in missing places --- Dockerfile | 4 +- README.md | 117 ++++++++++++++++++++++++++--------------------------- 2 files changed, 60 insertions(+), 61 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8a6450e..4718b9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,12 +3,12 @@ WORKDIR /tmp COPY Cargo.toml ./ COPY Cargo.lock ./ COPY src src -RUN cargo build --locked --profile release --package clickhouse_ndc +RUN cargo build --locked --profile release --package ndc-clickhouse # todo: figure out how to get rid of dependency libssl.so.1.1 # so we can use multistage builds for a smaller image # unable to determine where the dependency comes from, # this may be somewhere upstream? -ENTRYPOINT ["/tmp/target/release/clickhouse_ndc"] +ENTRYPOINT ["/tmp/target/release/ndc-clickhouse"] CMD ["serve", "--configuration", "/etc/connector/config.json"] diff --git a/README.md b/README.md index 815ac0f..1b8182c 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,14 @@ The Clickhouse Native Data Connector allows for connecting to a Clickhouse instance giving you an instant GraphQL API on top of your Clickhouse data. This uses the [Rust Data Connector SDK](https://github.com/hasura/ndc-hub#rusk-sdk) from the [Data connector Hub](https://github.com/hasura/ndc-hub) and implements the [Data Connector Spec](https://github.com/hasura/ndc-spec). -* [Clickhouse Connector information in the Hasura Connectors directory](https://hasura.io/connectors/clickhouse) -* TODO: Docs Link +- [Clickhouse Connector information in the Hasura Connectors directory](https://hasura.io/connectors/clickhouse) +- TODO: Docs Link In order to use this connector you will need to: -* Create a [Clickhouse account](https://clickhouse.cloud/signUp?loc=nav-get-started) -* Log in to A Hasura CLI Session -* Create a Pre-Shared Token for service authentication between the Hasura V3 Engine and your connector +- Create a [Clickhouse account](https://clickhouse.cloud/signUp?loc=nav-get-started) +- Log in to A Hasura CLI Session +- Create a Pre-Shared Token for service authentication between the Hasura V3 Engine and your connector ## Features @@ -22,57 +22,56 @@ If you wish to use this connector with your Hasura projects, the best instructio The following steps will allow you to deploy the connector and use it in a Hasura V3 project: -* Create a Hasura V3 Project (or use an existing project) -* Ensure that you have a metadata definition -* Create a configuration for the Clickhouse Connector referencing your credentials: - `clickhouse.connector.configuration.json` - You have 2 options for the config: - 1. The easiest option is to is to run the connector locally in config mode: - ``` - cargo run -- configuration serve --port 5000 - curl -X POST -d '{"connection": {"username": "your_username", "password": "your_password", "url": "your_clickhouse_url"}, "tables": []}' http://localhost:5000 > clickhouse.connector.configuration.json - ``` - 2. The other option is to manually write your config that follows this pattern: - ``` - { - "connection": { - "username": "your_username", - "password": "your_password", - "url": "your_clickhouse_url" - }, - "tables": [ - { - "name": "TableName", - "schema": "SchemaName", - "alias": "TableAlias", - "primary_key": { "name": "TableId", "columns": ["TableId"] }, - "columns": [ - { "name": "TableId", "alias": "TableId", "data_type": "Int32" }, - ] - } - ] - } - ``` -* Run the following command to deploy the connector -* Ensure you are logged in to Hasura CLI - ``` - hasura3 cloud login --pat 'YOUR-HASURA-TOKEN' - ``` -* Deploy the connector - ``` - hasura3 connector create clickhouse:v1 \ - --github-repo-url https://github.com/hasura/clickhouse_ndc/tree/main \ - --config-file ./clickhouse.connector.configuration.json - ``` -* Ensure that your deployed connector is referenced from your metadata with the service token -* Edit your metadata using the LSP support to import the defined schema, functions, procedures -* Deploy or update your Hasura cloud project - ``` - hasura3 cloud build create --project-id my-project-id \ - --metadata-file metadata.json my-build-id - ``` -* View in your cloud console, access via the graphql API - +- Create a Hasura V3 Project (or use an existing project) +- Ensure that you have a metadata definition +- Create a configuration for the Clickhouse Connector referencing your credentials: + `clickhouse.connector.configuration.json` + You have 2 options for the config: + 1. The easiest option is to is to run the connector locally in config mode: + ``` + cargo run -- configuration serve --port 5000 + curl -X POST -d '{"connection": {"username": "your_username", "password": "your_password", "url": "your_clickhouse_url"}, "tables": []}' http://localhost:5000 > clickhouse.connector.configuration.json + ``` + 2. The other option is to manually write your config that follows this pattern: + ``` + { + "connection": { + "username": "your_username", + "password": "your_password", + "url": "your_clickhouse_url" + }, + "tables": [ + { + "name": "TableName", + "schema": "SchemaName", + "alias": "TableAlias", + "primary_key": { "name": "TableId", "columns": ["TableId"] }, + "columns": [ + { "name": "TableId", "alias": "TableId", "data_type": "Int32" }, + ] + } + ] + } + ``` +- Run the following command to deploy the connector +- Ensure you are logged in to Hasura CLI + ``` + hasura3 cloud login --pat 'YOUR-HASURA-TOKEN' + ``` +- Deploy the connector + ``` + hasura3 connector create clickhouse:v1 \ + --github-repo-url https://github.com/hasura/ndc-clickhouse/tree/main \ + --config-file ./clickhouse.connector.configuration.json + ``` +- Ensure that your deployed connector is referenced from your metadata with the service token +- Edit your metadata using the LSP support to import the defined schema, functions, procedures +- Deploy or update your Hasura cloud project + ``` + hasura3 cloud build create --project-id my-project-id \ + --metadata-file metadata.json my-build-id + ``` +- View in your cloud console, access via the graphql API ## For Developers @@ -98,6 +97,6 @@ cargo run -- serve --configuration clickhouse.connector.congifuration.json The `Dockerfile` is used by the `connector create` command and can be tested as follows: ``` -docker build . --tag clickhouse_ndc -docker run -it --v ./clickhouse.connector.configuration.json:/config.json clickhouse_ndc -``` \ No newline at end of file +docker build . --tag ndc-clickhouse +docker run -it --v ./clickhouse.connector.configuration.json:/config.json ndc-clickhouse +```