DataSQRL compiles a data API that exposes the data processed by your SQRL script.
Currently, DataSQRL can compile GraphQL APIs with REST and gRPC on the roadmap.
Access Data API
DataSQRL compiles standard-compliant data APIs that can be accessed from any programming language or application. To learn more about accessing and querying the data API, click on the API type below:
Design Data API
DataSQRL compiles data APIs according to the provided API specification. If no API specification is provided, DataSQRL generates it based on the tables, fields, and relationships defined in the SQRL script.
We recommend that you start with the API specification generated by DataSQRL and then customize it to your needs. Once your SQRL script is ready to be exposed as an API, run the DataSQRL compiler to generate the API specification:
docker run --rm -v $PWD:/build datasqrl/cmd compile myscript.sqrl -a graphql
The command compiles your script and the
-a option writes the generated API specification to the directory in which you executed the command. In this example, we instruct the compiler to generate the specification for a GraphQL API which is defined by a GraphQL schema. The generated GraphQL schema is written to the file
schema.graphqls in the local directory.
DataSQRL generates API specifications that expose all visible tables, fields, and relationships defined in the SQRL script as well as filters for most fields. That's likely too generic and permissive for your needs.
To customize the API specification, read about API design for:
When you have finished designing the API, use the resulting API specification file as the second argument after the SQRL script when compiling your SQRL project:
docker run --rm -v $PWD:/build datasqrl/cmd compile myscript.sqrl schema.graphqls
API Security and Authorization
You can use any authentication layer with the compiled data API.
JWT-based authorization is on the roadmap.