Skip to content

Connectors overview

Hyperterse supports four database connectors out of the box. Each connector uses the native protocol for optimal performance.

You can use multiple databases in a single Hyperterse configuration. The connectors also support passing database options natively to the connector, and fine-tuning the connection pool size.

adapters:
# Postgres
postgres_main:
connector: postgres
connection_string: 'postgresql://user:pass@postgres:5432/app'
# Postgres read replica
postgres_replica:
connector: postgres
connection_string: 'postgresql://readonly:pass@replica:5432/app'
# MySQL
mysql_legacy:
connector: mysql
connection_string: 'user:pass@tcp(mysql:3306)/legacy'
# Redis
redis_cache:
connector: redis
connection_string: 'redis://redis:6379/0'
# MongoDB
mongodb_main:
connector: mongodb
connection_string: 'mongodb://user:pass@mongo:27017/app'
queries:
# Uses Postgres
create-user:
use: postgres_main
description: 'Create a new user'
statement: 'INSERT INTO users (name) VALUES ({{ inputs.name }}) RETURNING id'
inputs:
name:
type: string
# Uses Postgres read replica
analytics-report:
use: postgres_replica
description: 'Generate analytics report'
statement: 'SELECT * FROM analytics_view'
# Uses MySQL
get-legacy-data:
use: mysql_legacy
description: 'Fetch from legacy system'
statement: 'SELECT * FROM old_table WHERE id = {{ inputs.id }}'
inputs:
id:
type: int
# Uses Redis
get-cache:
use: redis_cache
description: 'Get cached value'
statement: 'GET {{ inputs.key }}'
inputs:
key:
type: string
# Uses MongoDB
get-user-doc:
use: mongodb_main
description: 'Find user by name'
statement: '{"database":"app","collection":"users","operation":"findOne","filter":{"name":"{{ inputs.name }}"}}'
inputs:
name:
type: string