TutorialsAIMySQLSQL

Query PlanetScale Without SQL: Natural Language Database Access

PlanetScale has become one of the most popular databases for fast-growing startups. Built on Vitess, it handles massive scale with automatic sharding, zero-d...

Marcus Chen· Solutions EngineerMarch 24, 20267 min read

PlanetScale has become one of the most popular databases for fast-growing startups. Built on Vitess, it handles massive scale with automatic sharding, zero-downtime schema changes, and a developer-friendly branching workflow. But when it comes to actually querying your data, you still need SQL and that creates a familiar bottleneck: only developers can access the data.

This article covers how to query a PlanetScale database using natural language, so your whole team can get answers without writing a single SQL statement.

What Makes PlanetScale Different

PlanetScale is a MySQL-compatible serverless database. Under the hood, your queries are standard MySQL SELECT, JOIN, GROUP BY, and so on. The difference is in how PlanetScale manages schema changes (via branching) and how it scales (Vitess handles sharding transparently).

From a querying perspective, PlanetScale behaves like MySQL. That means any tool that can connect to MySQL using standard credentials can query PlanetScale including natural language interfaces.

The SQL Bottleneck in PlanetScale Teams

The companies most likely to run PlanetScale are scaling startups and product-focused teams. These companies move fast, and they need data to make decisions.

But here's the typical situation:

  • The product team wants to know conversion rates by signup source
  • The ops team needs churn data broken down by plan tier
  • The founder wants a snapshot of yesterday's revenue
  • Each of these requires SQL. If the engineer who knows the schema is busy, everyone waits. If you ask ChatGPT to write the SQL, you still need to connect to PlanetScale, run the query, and interpret the output yourself.

    The bottleneck isn't knowledge of SQL it's the whole workflow.

    Connecting PlanetScale to a Natural Language Interface

    PlanetScale provides connection credentials you can use with any MySQL-compatible client. To connect AI for Database to your PlanetScale instance:

  • In your PlanetScale dashboard, go to your database → ConnectCreate password
  • Choose the branch you want to query (usually main)
  • Select "Connect with: General" and copy the connection string
  • The connection string looks like this:

    mysql://username:password@host.aws.connect.psdb.cloud/database_name?sslaccept=strict
  • Paste this into AI for Database's connection setup
  • Once connected, AI for Database reads your schema table names, column names, relationships and uses that context to translate your English questions into accurate MySQL queries.

    Asking Questions in Plain English

    With the connection live, you can ask questions like you'd ask a colleague who knows your data:

    "How many new users signed up last week, broken down by referral source?"

    Behind the scenes, this becomes something like:

    SELECT
      referral_source,
      COUNT(*) AS new_users
    FROM users
    WHERE created_at >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
    GROUP BY referral_source
    ORDER BY new_users DESC;

    You don't see the SQL unless you want to. You see the results a table showing referral sources ranked by signups.

    Another example: "What's the average order value for customers who signed up in January versus February?"

    SELECT
      DATE_FORMAT(u.created_at, '%Y-%m') AS signup_month,
      AVG(o.amount) AS avg_order_value
    FROM orders o
    JOIN users u ON o.user_id = u.id
    WHERE DATE_FORMAT(u.created_at, '%Y-%m') IN ('2026-01', '2026-02')
    GROUP BY signup_month;

    The AI handles the JOIN, the date formatting, and the aggregation based purely on your plain-English question.

    Building Dashboards From PlanetScale Data

    Querying on demand is useful, but the real productivity gain comes from dashboards that update automatically.

    With AI for Database, you can turn any natural language query into a dashboard widget. Set it to refresh every hour, every day, or on a custom schedule. The data stays current without anyone remembering to run a query.

    A typical PlanetScale-backed startup dashboard might include:

  • Daily active users (refresh every hour)
  • Revenue by plan tier (refresh daily at 6am)
  • Signups by referral source for the last 30 days (refresh daily)
  • Top 10 features used this week (refresh weekly)
  • These used to require a dedicated analytics engineer to set up and maintain. Now they're natural language queries that run on a schedule.

    Setting Up Automated Alerts on PlanetScale Data

    Beyond dashboards, you can define conditions that trigger automatic notifications.

    For example:

  • "If daily signups drop below 20, send a Slack message to #product"
  • "If any order amount exceeds $5,000, email the finance team"
  • "If failed payment count this hour is more than 10, call our webhook at /alerts"
  • This is AI for Database's action workflows feature. You define the condition in plain English, choose the action (Slack, email, or webhook), and the system checks your PlanetScale database on a schedule and fires when the condition is met.

    No stored procedures. No database triggers. No Lambda functions glued together with duct tape.

    What About PlanetScale Branches?

    PlanetScale's branching model means you might have a main branch (production) and feature branches in development. For data queries and dashboards, you almost always want to query main that's where your live data lives.

    If you're doing development work and want to query a feature branch (for example, to test a new table structure), you can create a separate connection in AI for Database pointing at that branch. Keep your connections separate so production and development don't get mixed up.

    Handling PlanetScale's Foreign Key Constraints

    By default, PlanetScale disables foreign key constraints (because Vitess's sharding model doesn't support them across shards). This means your database might not enforce referential integrity at the database level, relying on application logic instead.

    For natural language queries, this rarely matters you're reading data, not writing it. The AI will still figure out how tables relate to each other from the column names and data patterns.

    If your query involves JOINs across tables (e.g., joining orders to users via user_id), AI for Database handles this correctly even without explicit foreign key definitions. It infers the relationships from the schema structure.

    Common PlanetScale Query Patterns for Business Teams

    Here are questions that real teams commonly ask once they have natural language access to their PlanetScale data:

    Retention analysis:

    "What percentage of users who signed up 30 days ago are still active today?"

    Funnel performance:

    "How many users completed onboarding in the last 7 days? What's the drop-off at each step?"

    Revenue breakdown:

    "Show me monthly recurring revenue by plan for the last 6 months."

    Support and ops:

    "How many support tickets were created this week, grouped by category?"

    Product usage:

    "Which features have been used by fewer than 10 users in the past 30 days?"

    Each of these translates directly into SQL, returns a result, and can be saved as a dashboard tile or alert.

    Ready to try AI for Database?

    Query your database in plain English. No SQL required. Start free today.