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

dventimihasura/add-calcite : working on publishing Ken's calcite connector : DO NOT MERGE #284

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
83 changes: 83 additions & 0 deletions registry/hasura/cassandra/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
## Overview

The Cassandra Native Data Connector allows for connecting to a Cassandra instance giving you an instant GraphQL API on top of your Cassandra 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).

Cassandra is a powerful open-source columnar database that offers a range of features designed for speed and efficiency in processing large volumes of data. Cassandra is an excellent choice for a database when you are dealing with large volumes of data and require high-speed data retrieval, aggregation, and analysis. It's particularly well-suited for real-time analytics and handling time-series data, log data, or any scenario where read operations vastly outnumber writes. Cassandra thrives in environments where query performance and the ability to generate reports quickly are critical, such as in financial analysis, IoT data management, and online analytical processing (OLAP). Furthermore, its column-oriented architecture makes it ideal for queries that need to scan large datasets but only access a subset of columns.

## Connect to Hasura

Please refer to the [Getting Started - Create an API](https://hasura.io/docs/3.0/getting-started/create-a-project) documentation if you get stuck during any of the steps outlined below.

### Prerequisites
1. Install the [new Hasura CLI](https://hasura.io/docs/3.0/cli/installation) — to quickly and easily create and manage your Hasura projects and builds.
2. (recommended) Install the [Hasura VS Code extension](https://marketplace.visualstudio.com/items?itemName=HasuraHQ.hasura) — with support for other editors coming soon!
3. Create a [Cassandra account](https://Cassandra.cloud/signUp?loc=nav-get-started) if you don't already have one.
4. Make sure to make your Cassandra service open to the public or add Hasura's IP to the allowlist.

### Create Project and Connect Cassandra

Login to Hasura Cloud with the CLI

```
ddn login
```

Create a new project using the [create project](https://hasura.io/docs/3.0/cli/commands/create-project/) command in the CLI and change to the new directory that was generated.

```
ddn create project --dir ./my-first-supergraph
cd my-first-supergraph
```

Run the add [connector-manifest](https://hasura.io/docs/3.0/cli/commands/add-connector-manifest/) command to create a connector for Cassandra in your project.

```
ddn add connector-manifest Cassandra_connector --subgraph app --hub-connector hasura/Cassandra --type cloud
```

Add values for your Cassandra username, password, and connection string to corresponding definition found in: `app/Cassandra/connector/Cassandra_connector.build.hml`

```
kind: ConnectorManifest
version: v1
spec:
supergraphManifests:
- base
definition:
name: Cassandra_connector
type: cloud
connector:
type: hub
name: hasura/Cassandra:v0.2.5
deployments:
- context: .
env:
CASSANDRA_PASSWORD:
value: ""
CASSANDRA_URL:
value: ""
CASSANDRA_USERNAME:
value: ""
```

Note: You can also use environment variables for these values. Please refer to our [Getting Started - Add a connector manifest](https://hasura.io/docs/3.0/cli/commands/add-connector-manifest/) for more details.

### Update Connector, Track Models and Build

At this point you can either run the [dev](https://hasura.io/docs/3.0/cli/commands/dev/) mode to watch your project and create new builds as changes are made to your metadata using [Hasura’s LSP](https://hasura.io/docs/3.0/glossary/#lsp-language-server-protocol) and [VSCode extension](https://marketplace.visualstudio.com/items?itemName=HasuraHQ.hasura).
Copy link
Collaborator

Choose a reason for hiding this comment

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

The ddn dev command is now outdated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codingkarthik rewrote the README by copying the README from ndc-mongodb (which is pretty much boilerplate) and replacing mongodb -> cassandra. This got rid of the reference to ddn dev.


```
ddn dev
```

Alternatively, you can run the following commands to add specific models, in this example the `Trips` table and `MonthlyRevenue` view if added the view following the steps mentioned above.
```
ddn update connector-manifest Cassandra_connector
ddn update data-connector-link Cassandra_connector
ddn add model --data-connector-link Cassandra_connector --name Trips
ddn add model --data-connector-link Cassandra_connector --name MonthlyRevenue
ddn build supergraph-manifest
```

You are now ready to start using your API! During the previous step the console will return some information including the Console URL. Load this link in your browser to explore the API you have created for your Cassandra database. The UI will resemble something like this.
Binary file added registry/hasura/cassandra/logo-white-r.png
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please name this file to logo.png ? This is because the publication automation process only picks up the logo file if it is logo.png / logo.svg

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions registry/hasura/cassandra/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"overview": {
"namespace": "hasura",
"description": "The Cassandra Native Data Connector allows for connecting to a Cassandra instance giving you an instant GraphQL API on top of your Cassandra data.",
"title": "Cassandra Native Data Connector",
"logo": "logo-white-r.png",
"tags": [
"database"
],
"latest_version": "v1.0.0"
},
"author": {
"support_email": "[email protected]",
"homepage": "https://hasura.io",
"name": "Hasura"
},
"is_verified": true,
"is_hosted_by_hasura": false,
"source_code": {
"is_open_source": true,
"repository": "https://github.com/hasura/ndc-cassandra/",
"version": [
{
"tag": "v1.0.0",
"hash": "d24a7b7c25026ffaf9aad48a6c29d47003c0c03a",
"is_verified": true
}
]
}
}
11 changes: 11 additions & 0 deletions registry/hasura/cassandra/releases/v1.0.0/connector-packaging.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "1.0.0",
"uri": "https://github.com/hasura/ndc-cassandra/releases/download/v1.0.0/connector-definition.tgz",
Copy link
Collaborator

Choose a reason for hiding this comment

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

@dventimihasura The docker image present in this file is docker.io/kstott/meta_connector:cb76d3d-dirty. Usually, we push the connector docker images to Hasura's connector container registry in GHCR (Github container registry). For example, the azure cosmos connector's docker image is ghcr.io/hasura/ndc-azure-cosmos:v0.1.6, if you can do that for Cassandra also it will be great!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codingkarthik Replaced kstott -> ghcr.io/hasura everywhere, including in the connector definition that's pointed to here (in a new release v1.0.1)

"checksum": {
"type": "sha256",
"value": "a1375bffffb8bbe77b80f42cbdeeab6697717355c92810fefb93d18f8f7f8f6c"
},
"source": {
"hash": "d24a7b7c25026ffaf9aad48a6c29d47003c0c03a"
}
}
Loading