TursoDB

Connecting Your Turso DB (SQLite) Database to Sequel

Welcome to Sequel! This guide will help you connect your Turso DB (SQLite) database to Sequel, enabling you to run SQL queries using natural language and visualize results with charts and graphs.

Prerequisites

Before you begin, ensure you have the following:

  • Turso DB (SQLite) Database: Make sure your Turso database is set up and running.
  • Connection Details: You will need the following details:
    • Host URL (e.g., libsql://your-database-name.turso.io)
    • Auth Token (Generated from the Turso dashboard)
  • Sequel Account: You must have a Sequel account. If you haven’t signed up yet, you can create an account at Sequel.

Step 1: Get Your Connection Details from Turso

To connect your Turso DB database to Sequel, you’ll first need to retrieve your connection details from the Turso dashboard:

  1. Log in to your Turso account and navigate to the database you want to connect.
  2. Copy the Host URL for your database, which should look like libsql://your-database-name.turso.io.
  3. Generate an Auth Token:
    • Click on your database, and select the option to Create Token.
    • Set the permissions (e.g., Read/Write) and expiration duration.
    • Copy the generated Auth Token.

For more information, see the Turso documentation on auth tokens.

Step 2: Navigate to Database Connections in Sequel

  1. On the Sequel dashboard, locate the menu on the left-hand side.
  2. Click on Database Connections to open the database management page.

Step 3: Add a New Connection

  1. In the Databases section, click the New Connection button.
  2. From the list of available database types, select Turso DB (SQLite).

Step 4: Enter Connection Details

You will now need to enter the required information to connect your Turso DB database:

  1. Display Name: Give your connection a meaningful name (e.g., "Turso Production DB" or "Turso Analytics DB").
  2. Host URL: Paste the Host URL you copied from the Turso dashboard (e.g., libsql://your-database-name.turso.io).
  3. Auth Token: Enter the Auth Token you generated for your database.

Step 5: Test and Save the Connection

Click on the Test and Save Connection button to verify your connection details. Once the test is successful, Sequel will open the explorer view for your connected database. You can now begin asking your database questions or executing SQL queries.

Step 6: Query Your Database

Now that your Turso DB is connected, you can start querying it using natural language:

  1. Return to the Sequel dashboard.
  2. In the query input box, type a question or request, such as “Show me the list of customers added in the last week” or “What is the total revenue for last month?”.
  3. Sequel will convert your request into an SQL query, execute it against your Turso DB, and display the results.

Step 7: Visualize Data with Charts and Graphs

Sequel also allows you to create visualizations simply by asking it to visualize the data as a bar chart, line chart, or pie chart.

For example:

  1. Show me the total sales in the last 30 days as a line chart.
  2. Show me a bar graph of the top 5 products sold.
  3. Show me a pie chart of user distribution by country.

Troubleshooting

If you encounter any issues during the connection process:

  1. Connection Errors: Ensure your Host URL and Auth Token are correctly entered. Double-check that the token hasn’t expired.
  2. Database Access: Ensure your database permissions allow access to Sequel, and that the Auth Token provides the necessary read/write access.
  3. Firewall/Network Issues: Ensure your database server allows connections from Sequel or from your local network if applicable.

Conclusion

You’ve successfully connected your Turso DB (SQLite) database to Sequel! Now, you can take advantage of Sequel’s natural language processing to query your database and generate insightful visualizations.

If you need further assistance, feel free to contact our support team or refer to the Sequel documentation.

Happy querying!


Additional Resources