Airsequel automatically generates a full fledged GraphQL API endpoint including introspection capabilities for every database at airsequel.com/dbs/<db-id>/graphql
.
It also provides a GraphiQL playground where you can test your GraphQL queries at airsequel.com/dbs/<db-id>/graphiql
. For example: airsequel.com/dbs/avatar_the_last_airbender/graphiql.
Following examples apply to this example database with users and songs:
The queries are also available as an Insomnia collection:
insomnia_collection_for_airsequel.json
SQLite’s types are mapped to GraphQL types in following way (both are per default nullable):
SQLite Type | GraphQL Type |
---|---|
INTEGER |
Int |
REAL |
Float |
TEXT |
String |
BLOB |
String |
NULL |
null |
ANY |
String |
BOOL / BOOLEAN |
|
(Not an official SQLite type, since it simply uses the integers 0 / 1 under the hood) |
Boolean |
x TEXT CHECK (color IN ('a', 'b', 'c')) |
Custom Type x_String with allowed values "a" , "b" , or "c" |
Since SQLite is dynamically typed, and GraphQL is strongly typed, it’s possible to create data in a SQLite database which can not faithfully be transmitted via GraphQL.
If a table column has values of another type than the specified schema type, the values will coerced to the specified type for the GraphQL API. If the values can not be coerced the GraphQL result will have an errors
field with the error Unable to coerce result to x.
and the values which could not be coerced will be null
.