- Retrieve database credentials
- Install the libSQL crate
- Connect to a remote Bunny Database
- Execute a query using SQL
Quickstart
1
Retrieve database credentials
You will need an existing database to continue. If you don’t have one, create one.Navigate to Dashboard > Edge Platform > Database > [Select Database] > Access to find your database URL and generate an access token.
You should store these as environment variables to keep them secure.
2
Install libsql
Install the libSQL crate:
3
Initialize a new client
Create a database connection with your database URL and auth token:
4
Execute a query using SQL
You can execute a SQL query against your database using If you need to use placeholders for values, you can do that:
query() for reads or execute() for writes:Placeholders
libSQL supports the use of positional and named placeholders within SQL statements:libSQL supports the same named placeholder characters as SQLite —
:, @ and
$.Executing Writes
Useexecute() for INSERT, UPDATE, and DELETE statements: