Skip to content

Commit

Permalink
Trino v1.0.0 (#432)
Browse files Browse the repository at this point in the history
Co-authored-by: gneeri <[email protected]>
  • Loading branch information
GavinRay97 and gneeri authored Jan 24, 2025
1 parent 44c3ad2 commit 45012bc
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 0 deletions.
98 changes: 98 additions & 0 deletions registry/hasura/trino/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Trino Connector

[![Docs](https://img.shields.io/badge/docs-v3.x-brightgreen.svg?style=flat)](https://hasura.io/docs/3.0/getting-started/overview/)
[![ndc-hub](https://img.shields.io/badge/ndc--hub-snowflake-blue.svg?style=flat)](https://hasura.io/connectors/trino)
[![License](https://img.shields.io/badge/license-Apache--2.0-purple.svg?style=flat)](LICENSE.txt)
[![Status](https://img.shields.io/badge/status-alpha-yellow.svg?style=flat)](./readme.md)

With this connector, Hasura allows you to instantly create a real-time GraphQL API on top of your data models in
Trino. This connector supports Trino's functionalities listed in the table below, allowing for efficient and
scalable data operations. Additionally, users benefit from all the powerful features of Hasura’s Data Delivery Network
(DDN) platform, including query pushdown capabilities that delegate query operations to the database, thereby enhancing
query optimization and performance.

This connector implements the [Data Connector Spec](https://github.com/hasura/ndc-spec).

- [Connector information in the Hasura Hub](https://hasura.io/connectors/trino)
- [Hasura V3 Documentation](https://hasura.io/docs/3.0)

## Features

Below, you'll find a matrix of all supported features for the Trino connector:

| Feature | Supported | Notes |
| ------------------------------- | --------- | ----- |
| Native Queries + Logical Models || |
| Native Mutations || |
| Simple Object Query || |
| Filter / Search || |
| Simple Aggregation || |
| Sort || |
| Paginate || |
| Table Relationships || |
| Views || |
| Remote Relationships || |
| Custom Fields || |
| Mutations || |
| Distinct || |
| Enums || |
| Naming Conventions || |
| Default Values || |
| User-defined Functions || |

## Prerequisites

1. Create a [Hasura Cloud account](https://console.hasura.io)
2. Please ensure you have the [DDN CLI](https://hasura.io/docs/3.0/cli/installation) and
[Docker](https://docs.docker.com/engine/install/) installed
3. [Create a supergraph](https://hasura.io/docs/3.0/getting-started/init-supergraph)
4. [Create a subgraph](https://hasura.io/docs/3.0/getting-started/init-subgraph)

The steps below explain how to initialize and configure a connector on your local machine (typically for development
purposes).You can learn how to deploy a connector to Hasura DDN — after it's been configured —
[here](https://hasura.io/docs/3.0/getting-started/deployment/deploy-a-connector).

## Using the Trino connector

With the [context set](https://hasura.io/docs/3.0/cli/commands/ddn_context_set/) for an existing subgraph, initialize
the connector:

```sh
ddn connector init -i
```

When the wizard runs, you'll be prompted to enter the following env vars necessary for your connector to function:

| Name | Description | Required |
| -------- | --------------------------------------- | -------- |
| JDBC_URL | The JDBC URL to connect to the database | Yes |

After the CLI initializes the connector, you'll need to:

- [Introspect](https://hasura.io/docs/3.0/cli/commands/ddn_connector_introspect) the source.
- Add your [models](https://hasura.io/docs/3.0/cli/commands/ddn_model_add),
[commands](https://hasura.io/docs/3.0/cli/commands/ddn_command_add), and
[relationships](https://hasura.io/docs/3.0/cli/commands/ddn_relationship_add).
- Create a [new build](https://hasura.io/docs/3.0/cli/commands/ddn_supergraph_build_local).
- Test it by [running your project along with the connector](https://hasura.io/docs/3.0/cli/commands/ddn_run#examples).

## Example JDBC Configuration

Supposing you have a MySQL datasource `example_mysql` in your Trino instance's catalog, and a database named `chinook`, you might use a JDBC URL of the format:
- `jdbc:trino://localhost:8080/example_mysql/chinook?user=trino`

Ensure that your MySQL instance in the Trino catalog is configured with `case-insensitive-name-matching=true` for proper SQL query functionalty.

A full example might be:
```ini
connector.name=mysql
connection-url=jdbc:mysql://host.docker.internal:3306
connection-user=root
connection-password=Password123
unsupported-type-handling=convert-to-varchar
case-insensitive-name-matching=true
```

## License

The Hasura Snowflake connector is available under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
1 change: 1 addition & 0 deletions registry/hasura/trino/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions registry/hasura/trino/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"overview": {
"namespace": "hasura",
"description": "Connect to a Trino database and expose it to Hasura v3 Project",
"title": "Trino Connector",
"logo": "logo.svg",
"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": true,
"source_code": {
"is_open_source": true,
"repository": "https://github.com/hasura/ndc-jvm-mono",
"version": [
{
"tag": "trino/v1.0.0",
"hash": "65568833a32fb8862201acd45bd0b11e9d7b0fdc",
"is_verified": true
}
]
}
}
11 changes: 11 additions & 0 deletions registry/hasura/trino/releases/v1.0.0/connector-packaging.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "v1.0.0",
"uri": "https://github.com/hasura/ndc-jvm-mono/releases/download/trino%2Fv1.0.0/package.tar.gz",
"checksum": {
"type": "sha256",
"value": "5b009509676e97f1a5adfe6db9eeeb9da2aa7e287c60fa23670917710f0ac574"
},
"source": {
"hash": "65568833a32fb8862201acd45bd0b11e9d7b0fdc"
}
}

0 comments on commit 45012bc

Please sign in to comment.