Database Schema
Importing or adding your database schema makes the generated SQL queries more accurate and easier to build, since AI knows the tables and columns in your database schema. It will also improve explanations and optimizations. Below you can see how to add your database schema in different ways, manually
, via CSV
, via any format
or via URL connection
.
Manual add database schema
You can manually add your database schema using the following format (e.g. table name: column name, column name, column name
):
users: id, name, email, password, created_at, updated_at
posts: id, title, body, created_at, updated_at
comments: id, body, user_id, post_id, created_at, updated_at
...
Simple add the tables and columns you need to build the query and click add.
Import database schema via CSV
If you are working with a larger database schema you can import it via CSV with 1-click. When you click the CSV tab you can see SQL queries below that you can run to generate the CSV:
Depending on your database and setup, you can either copy paste it as CSV
or save it as CSV
. After that you can copy paste the CSV into the field and click Add.
Add database schema in any format
You can import any database schema format that you want. It can be JSON
, HTML
, Plain text
or a custom format like Prisma (opens in a new tab) schema.prisma
(or other ORMs). The only requirement is that the database schema is somehow structured in a way that AI can understands it.
Add database via URL connection
You can connect to your custom database and automatically import the database schema to your browser (we don't store anything on our servers due to privacy). This is the easiest method since you don't have to do anything. This currently works with MySQL, MariaDB and PostgreSQL. The connection URL must have the following format:
<database_engine>://<username>:<password>@<host>:<port>/<database_name>
Example if you are using a database hosted on AWS RDS (using a READ ONLY
user is recommended):
postgresql://user:password@my_database.abc123.us-east-1.rds.amazonaws.com:5432/my_database
The my_database
will be used as database schema name. You can connect as many databases as you like.
When you have connected to your database, you can also run SQL queries directly from the app. This is a powerful data exploration tool that will help you understand your data better.