A Hasura Native Data Connector (NDC) implementation for JDBC databases, currently supporting:
- Snowflake
- BigQuery
- Redshift
This connector allows Hasura to connect to various JDBC data sources using a common architecture. It implements the Hasura NDC specification while providing database-specific optimizations and type mappings.
- Common JDBC connection pooling using HikariCP
- Database-specific type mappings and schema generation
- Support for basic queries with:
- Field selection
- Filtering
- Sorting
- Pagination
- Configuration via JSON and environment variables
- Java 21 or higher
- Environment variables
export JDBC_URL="your_jdbc_connection_string"
export JOOQ_PRO_EMAIL="<jooq_pro_email>"
export JOOQ_PRO_LICENSE="<jooq_pro_license>"
- Set the required environment variable to specify your database:
export NDC_JDBC_SOURCE=snowflake
- Create a configuration file (
configuration.json
) with your connection details:
{
"connection_uri": {
"value": "jdbc:snowflake://..." // or use "variable" for env var
},
"schemas": ["public"],
"tables": [...]
}
- Run the connector:
make run-snowflake
The connector is built with a modular architecture:
base/
- Core interfaces and base classesdefault/
- Default implementations for common JDBC functionalitysource/
- Database-specific implementationssnowflake/
bigquery/
redshift/
Each database implementation provides:
- Custom connection configuration
- Type mapping
- Schema generation
- Query optimization (where applicable)
To add support for a new database:
- Create a new package under
source/
- Implement the required components:
- Connection configuration
- Data type mappings
- Schema generator
- Any database-specific optimizations
- Add the new source to the
DatabaseSource
enum - Register the connector in
Main.kt
The repository includes automated testing infrastructure for validating NDC functionality across different database connectors.
Tests automatically run on pull requests targeting the main branch. The workflow:
- Generates connector configuration
- Starts the connector service
- Runs NDC test suite against the running connector
- Collects and uploads logs as artifacts
For local testing, use the provided test script:
./scripts/run-ndc-tests.sh <connector>