This guide will help you get started and make your first query to your global SQLite database. It also assumes you have a basic understanding of SQL and how to interact with a database.
You can get started in 3 simple steps:
https://db.dzero.dev
:
These concepts are good to understand but not something you have to worry about when using Dzero, as all replications are automatically managed with zero configurations.
All interactions with your database goes through a secured & fastā” HTTPS REST API, which makes it simple to integrate with any programming language, framework and platform.
You need to pass in your database token in the token
header field to authenticate your requests. Each database has a unique token which you can retrieve from the dashboard.
JS Client
JS Fetch
Curl
PHP
Python
Java
We have a small Javascript/Typescript client written with fetch which is supported in every JS environment/framework. No npm install
required, just copy and paste to your code base. Feel free to write similar clients around your favorite language, reach out and we'll publish it here.
Run the following query in the sql
field and you would have created your first table.
All query responses are in JSON format consisting of root keys, meta
and results
. The meta
key contains metadata about the query execution such as the rows read & written which can be used to estimate performance and cost. The results
key contains the actual query results if any.
Prepared statements allow you to reuse the same query with different parameters, this is useful for improvement in performance. Using the params
field in the request body, you can pass in the parameters that will bind to your quires in oder of the array.
JS Client
JS Fetch
Curl
PHP
Python
Java
By default all queries run in the all
method, you can change this to exec
by passing in the method field in the request body.
"all"
methodJS Client
JS Fetch
Curl
PHP
Python
Java
Returns all rows as an array of objects
"exec"
methodThis allows you to run larger and multiple queries as once which is great for performing migrations or large tasks. It's not recommended to use as it has poorer performance and less safe. Parameters bindings are not supported in this method.
JS Client
JS Fetch
Curl
PHP
Python
Java
Batching allows you to send multiple query statements as a single call and each statement will be executed sequentially, if any statement fails within the sequence, the entire batch will be rolled back.
You can batch simply by passing an array of SQL statements to the sql
param.
JS Client
JS Fetch
Curl
PHP
Python
Java