- Haskell 99.9%
- Makefile 0.1%
Split submitted SQL into individual statements via sqlite3_complete (so semicolons in strings, comments, and BEGIN…END trigger bodies are handled) and execute them sequentially, returning the last statement's rows like the sqlite3 CLI. Rewrite sanitizeSql's keyword handling to use a scanner that skips string literals, quoted identifiers, and comments, and matches keywords at word boundaries. Fixes rules that mangled identifiers (STORED/ VIRTUAL), missed tab/newline boundaries, and rejected unspaced `==`, UPDATE/DELETE RETURNING, upserts, and END-terminated triggers. Adds fallbacks for PRAGMA/VACUUM/ANALYZE/REINDEX/transactions and REPLACE. Restrict executable statements to preserve resource and integrity guards: only read-only PRAGMAs are allowed (settable pragmas are rejected in every form, including the disguised `pragma(value)` write), and VACUUM … INTO is blocked as an arbitrary file-write primitive. |
||
|---|---|---|
| app | ||
| images | ||
| source | ||
| tests | ||
| .gitignore | ||
| makefile | ||
| package.yaml | ||
| readme.md | ||
| Setup.hs | ||
| stack-standalone.yaml | ||
| stack-standalone.yaml.lock | ||
AirGQL
Automatically generate a GraphQL API for an SQLite database.

How It Works
It analyses the database schema and builds the corresponding GraphQL introspection and data resolvers.
The generated API supports all basic CRUD operations and even complex queries and mutations including filters and pagination.
It is designed to be either used a Haskell library for integrating GraphQL support into existing servers or as a standalone CLI app for quickly spinning up a backend.
AirGQL is the core component of Airsequel, which provides a complete solution for building web applications on top of SQLite databases.
Installation
CLI Tool
You can install the CLI app using Stack:
git clone https://github.com/Airsequel/AirGQL
cd AirGQL
make install
Library
You can also use AirGQL in your Haskell project
by adding the Hackage package
as a dependency to your package.yaml or your *.cabal file:
dependencies:
- airgql
- …
Also set the lib-only flag in your stack.yaml file
to avoid irrelevant errors:
flags:
airgql:
lib-only: true
Usage
CLI App
Run following command to start a GraphQL API server for an existing SQLite database:
stack run -- serve tests/example.sqlite
Then you can query the API like this:
http POST http://localhost:4189/graphql \
query='query {
songs(limit: 2) {
id
title
}
}'
It also supports mutations:
http POST http://localhost:4189/graphql \
query='mutation {
insert_songs(objects: [{ title: "New Song" }]) {
returning {
id
title
}
}
}'
Check out the documentation at docs.airsequel.com/graphql-api for more details on how to use all of its GraphQL features.
Library
Check out the code in app/Main.hs file for an example of how to build a simple Servant server leveraging AirGQL.