background

Chat with Supabase PostgreSQL using AI

Chat with Supabase PostgreSQL using AI
Sheldon Niu
Sheldon Niu

Supabase is the state-of-the-art, open-source alternative to Google's Firebase, and its built-in PostgreSQL has a lot of functionalities, such as vector search and authentication, making it a popular choice for PostgreSQL hosting platforms.

If you are using Supabase as your PostgreSQL provider, then AskYourDatabase is a great choice for you to design your schema, query data, and visualize your data without writing SQL.

In this tutorial, we are going to set up a PostgreSQL database running on Supabase and connect it to AskYourDatabase to design schemas & query data in natural language.

Setting up Supabase database

First, head to your Supabase dashboard and click 'New Project':

Supabase dashboard
Supabase dashboard

Give your project a name, select a region (where your PostgreSQL will be hosted), and then click "Create".

Create project in Supabase
Create project in Supabase

Then navigate to "Project Settings" -> "Database". You will see your connection string under "Database Settings".

Connection string in supabase
Connection string in supabase

Downloading AskYourDatabase

Visit here to download the AskYourDatabase Desktop app, and click "Open". You will be directed to the page where you can connect your database.

Download AskYourDatabase
Download AskYourDatabase

Paste the connection string you just copied, replacing the password placeholder with your actual password, and click "Connect".

If the connection is successful, you will be navigated to the chat interface.

Chat with PostgreSQL using AI
Chat with PostgreSQL using AI

Designing schema & inserting data

Creating tables

Since our database is empty at the moment, we need to create some tables and insert some mock data.

We can let AskYourDatabase handle this. First, ask AYD to create "customer", "sales", and "product" tables with appropriate fields:

Create pg tables using plain english
Create pg tables using plain english

And then AYD will begin creating tables for you:

Successfully created tables without writing SQL using AI
Successfully created tables without writing SQL using AI

Now we should have three tables. Let's go to the Supabase Schema Viewer to view them:

View schema in Supabase Schema Visualizer
View schema in Supabase Schema Visualizer

Now you can see that the fields and table relations have all been created properly with a single question! This level of simplicity and efficiency is only possible with AskYourDatabase.

Inserting mockup data

Let's insert some realistic mockup data into these tables by asking questions in AskYourDatabase:

Insert mockup data into PostgreSQL using AI
Insert mockup data into PostgreSQL using AI

Go to the Supabase Table Editor to view the inserted data:

View data in Supabase table editor
View data in Supabase table editor

Getting data insights

Let's ask which customer has contributed the highest sales amount:

get insights
get insights

With a single question, it informs us that John Doe has contributed the most by executing the correct SQL query.

Data Visualization

Let's draw a pie chart to show the contribution to sales amounts by different customers:

data visualization
data visualization

Conclusion

Supabase stands out as one of the most popular PostgreSQL hosting providers, and with AskYourDatabase, designing schemas, and obtaining insights interactively through a chat interface becomes a breeze, all without the need to write SQL.

This is incredibly beneficial for those who aren't proficient in SQL or prefer not to engage with it directly. It also empowers teams without technical backgrounds to gain insights without needing engineering assistance.

Supabase and AskYourDatabase together make a winning combination!


More Blogs

Cover Image for Streamlining ERP Integration and Data Management with AskYourDatabase

Streamlining ERP Integration and Data Management with AskYourDatabase

Learn how Tobias, a PMO leader at the German subsidiary of a major U.S.-based food corporation, successfully integrated multiple ERP systems using AskYourDatabase to streamline data management, reduce errors, and foster collaboration between business and IT teams.

Sheldon Niu
Sheldon Niu
Cover Image for Developing AI-powered Chatbot for Snowflake Data Warehouses: Unique Ideas & Workarounds

Developing AI-powered Chatbot for Snowflake Data Warehouses: Unique Ideas & Workarounds

Explore innovative approaches and tools for creating an AI chatbot that seamlessly interacts with Snowflake data warehouses. Discover various methods, including a rapid, no-code solution using AskYourDatabase, to enhance data accessibility and analysis within your organization.

Sheldon Niu
Sheldon Niu
Cover Image for Building an AI Chatbot for Google BigQuery: Enhancing Data Accessibility

Building an AI Chatbot for Google BigQuery: Enhancing Data Accessibility

Explore innovative approaches to create an AI chatbot for Google BigQuery, including a rapid, no-code solution with AskYourDatabase. Learn how to improve data analysis and accessibility in your organization with these cutting-edge strategies.

Sheldon Niu
Sheldon Niu
Cover Image for Creating an AI Chatbot for Microsoft SQL Server Databases

Creating an AI Chatbot for Microsoft SQL Server Databases

Discover effective strategies and tools for developing an AI chatbot that interacts with Microsoft SQL Server databases. Learn about various approaches, including a quick, code-free implementation using AskYourDatabase, to improve data accessibility and analysis in your organization.

Sheldon Niu
Sheldon Niu
Cover Image for Building an AI Chatbot that queries MySQL Databases

Building an AI Chatbot that queries MySQL Databases

Explore the best practices and solutions for building an AI chatbot for MySQL databases. Learn about different approaches, including using AskYourDatabase for a quick and code-free implementation, to enhance data accessibility and analysis for your organization.

Sheldon Niu
Sheldon Niu
Cover Image for Developing an AI Chatbot that queries PostgreSQL Database

Developing an AI Chatbot that queries PostgreSQL Database

Discover effective strategies and solutions for creating an AI chatbot that interacts with PostgreSQL databases. Learn about various approaches, including the use of AskYourDatabase for rapid, code-free implementation, to improve data accessibility and analysis within your organization.

Sheldon Niu
Sheldon Niu
Query SQL database in natural language

Query SQL database in natural language

The best approach depends on your team and whether you can invest time in building a SQL AI Agent. For technical teams who want more customized solutions, tools like Langchain may be the best choice. For non-tech teams, choosing tools like AskYourDatabase will likely be the lowest-cost option.

Sheldon Niu
Sheldon Niu
How AskYourDatabase has saved 40 hours per week for SmartLead.ai

How AskYourDatabase has saved 40 hours per week for SmartLead.ai

AskYourDatabase has helped the famous cold email SaaS company SmartLead.ai save 40 hours each week between the CS team and the engineering team. More importantly, the tool has taught the CS team the skills crucial for their growth and success.

Sheldon Niu
Sheldon Niu
;