mysql
graphql
MySQL Support
Excalibase GraphQL supports MySQL 8.4+ with full CRUD, ENUM/JSON types, views, and stored procedures.
Start with MySQL
git clone https://github.com/excalibase/excalibase-graphql.git
cd excalibase-graphql
docker-compose -f docker-compose.mysql.yml up -d
API runs on port 10001 by default.
Configuration
spring:
datasource:
url: jdbc:mysql://localhost:3306/yourdb
username: youruser
password: yourpass
driver-class-name: com.mysql.cj.jdbc.Driver
app:
allowed-schema: yourdb
database-type: mysql
Feature comparison
| Feature | PostgreSQL | MySQL |
|---|---|---|
| Queries (list, filter, paginate) | ✅ | ✅ |
| Mutations (create, update, delete) | ✅ | ✅ |
| Bulk create | ✅ | ✅ |
| Relationships (foreign keys) | ✅ | ✅ |
| ENUM types | ✅ | ✅ |
| JSON / JSONB | ✅ | ✅ (JSON) |
| Views | ✅ | ✅ |
| Stored procedures | ✅ | ✅ |
| Subscriptions (CDC) | ✅ | ✅ (via watcher) |
| Row-Level Security | ✅ | ❌ Not applicable |
| Computed fields | ✅ | ❌ |
| GraalVM native binary | ✅ | ✅ |
ENUM support
MySQL ENUMs are automatically mapped to GraphQL enum types. Given:
CREATE TABLE film (
film_id SERIAL PRIMARY KEY,
rating ENUM('G', 'PG', 'PG-13', 'R', 'NC-17')
);
Excalibase generates:
enum FilmRating {
G
PG
PG_13
R
NC_17
}
You can then filter using the enum directly:
{
film(where: { rating: { eq: PG } }) {
title
rating
}
}
JSON support
JSON columns are exposed as a custom JSON scalar and can be filtered with haskey and jsoncontains:
{
product(where: { metadata: { haskey: "color" } }) {
name
metadata
}
}
Stored procedures
Define a stored procedure in MySQL:
DELIMITER //
CREATE PROCEDURE get_top_rentals(IN limit_count INT)
BEGIN
SELECT film_id, title, COUNT(*) as rental_count
FROM film JOIN inventory USING (film_id)
JOIN rental USING (inventory_id)
GROUP BY film_id
ORDER BY rental_count DESC
LIMIT limit_count;
END //
Call it via GraphQL mutation:
mutation {
callGetTopRentals(limit_count: 10)
}
Views
Database views are exposed as read-only types — queries work normally, mutations are disabled. This is useful for exposing pre-joined or pre-aggregated data without extra API work.