Guides · Safe AI SQL Safe read-only AI SQL on any database with PII masking.
Ask any SQL database in plain English—read-only, with customer PII masked first.
Read-only transactions · Separate masking gateway · Never trains AI models
| full_name | phone | mrr | |
|---|---|---|---|
| Priya Nair | priya@acme.io | +91-98201-4410 | $149 |
| Daniel Cho | dcho@north.co | +1-415-890-221 | $149 |
| Meera Rao | meera@kora.in | +91-98450-1988 | $49 |
Rows returned to Numling’s isolated query runner over TLS inside a read-only session.
| full_name | phone | mrr | |
|---|---|---|---|
| person_8f2a | mail_8f2a@mask | phone_8f2a | $149 |
| person_3c91 | mail_3c91@mask | phone_3c91 | $149 |
| person_7d04 | mail_7d04@mask | phone_7d04 | $49 |
Same person gets the same token across rows so COUNT(DISTINCT) and joins stay exact.
Team plan added $5,662 in net new MRR (+38 accounts) in November — 74% of total growth, while Pro added $1,960 (+40 accounts).
Ran in 0.28s as numling_reader · 0 personal values sent to model · SQL verified
Defense in depth
Three boundaries between an LLM and production data.
Prompt instructions like “please don’t run DELETE” are not security. Safe AI SQL enforces read-only and PII boundaries outside the model—across every SQL database or warehouse you connect.
Least-privilege reader
A dedicated DB user with SELECT only on chosen schemas (never internal auth or admin tables), enforced read-only sessions, and a query timeout.
Guarded runner + PII masker
Every SQL string is parsed and checked before execution, run in a read-only session, and stripped of names, emails, phones and addresses before results reach the model.
Row-level rules & audit log
Scope what each teammate can see by city, client or team, and keep a full audit trail of every sign-in and every query run.
Step by step
Set up safe AI SQL on your database in 5 minutes.
Pick your SQL provider below—this is the exact least-privilege setup Numling’s connect flow uses.
See all supported data sources →Create a hardened read-only user
Grant SELECT only on the tables or schemas your team needs, lock the session to read-only, and add a timeout so an analytical scan never slows production.
create role numling_reader login password 'choose-a-long-password'; alter role numling_reader set default_transaction_read_only = on; alter role numling_reader set statement_timeout = '30s'; grant connect on database your_db to numling_reader; grant usage on schema public to numling_reader; grant select on all tables in schema public to numling_reader; alter default privileges in schema public grant select on tables to numling_reader;
create role numling_reader login password 'choose-a-long-password'; alter role numling_reader set default_transaction_read_only = on; alter role numling_reader set statement_timeout = '30s'; grant connect on database postgres to numling_reader; grant usage on schema public to numling_reader; grant select on all tables in schema public to numling_reader; alter default privileges in schema public grant select on tables to numling_reader; -- auth.* and storage.* are never granted and stay unreadable
CREATE USER 'numling_reader'@'%' IDENTIFIED BY 'choose-a-long-password'; GRANT SELECT ON your_db.* TO 'numling_reader'@'%'; ALTER USER 'numling_reader'@'%' WITH MAX_USER_CONNECTIONS 5; FLUSH PRIVILEGES;
-- Snowflake: dedicated read-only role create role numling_reader; grant usage on warehouse analytics_wh to role numling_reader; grant usage on database prod to role numling_reader; grant usage on schema prod.analytics to role numling_reader; grant select on all tables in schema prod.analytics to role numling_reader; grant select on future tables in schema prod.analytics to role numling_reader; -- BigQuery: grant roles/bigquery.dataViewer on your analytics dataset -- and roles/bigquery.jobUser on the project (never project-wide editor).
Connect with TLS (or via read replica / SSH bastion)
Paste your connection string (or use Supabase’s pooler URI, Neon’s read-only branch, or a service account for BigQuery/Snowflake). For private VPCs, allow Numling’s fixed IP or connect through a forward-only SSH bastion.
Confirm detected PII columns during the scan
Quill scans table schemas and column summaries (never storing raw personal rows) and flags columns holding names, emails, phone numbers, or addresses. You can mark extra custom columns as masked in one click.
Ask in plain English — inspect the SQL under every answer
Founders and ops teams ask in Numling or Slack; engineers can expand the generated SQL under every answer to verify joins, filters and execution time.
Security checklist
What’s allowed, and what’s refused.
Every check enforced in code and at the database — not just in a system prompt.
- SELECT & CTE queries Allowed
- Read-only analytical queries run inside an explicit read-only transaction with a per-query timeout.
- INSERT, UPDATE, DELETE, DDL Blocked
- Refused by the query gateway parser before hitting your database, and blocked a second time by the database role permissions.
- Private / auth schemas Blocked
- Schemas not granted to numling_reader (such as Supabase’s auth.* or admin tables) stay completely unreadable.
- Raw PII in LLM context Masked
- Emails, phone numbers, names and street addresses are replaced with stable pseudonyms in the runner before the model sees output.
- Model training on your data Never
- Your schema, questions and masked query results are never used to train foundation models.
Doing it by hand: expose an anonymized SQL schema
If you want database-level PII redaction even before a query runner sees a column (or you’re wiring up your own text-to-SQL script), put sanitized views in a dedicated analytics_safe schema and grant the AI role access only to that schema.
create extension if not exists pgcrypto; create schema if not exists analytics_safe; create or replace view analytics_safe.profiles as select id, case when email is not null then encode(hmac(email, 'replace-with-random-secret-salt', 'sha256'), 'hex') end as email_hash, split_part(email, '@', 2) as email_domain, plan, country, created_at from public.profiles; revoke all on all tables in schema public from numling_reader; alter default privileges in schema public revoke select on tables from numling_reader; revoke all on schema public from numling_reader; grant usage on schema analytics_safe to numling_reader; grant select on all tables in schema analytics_safe to numling_reader;
FAQ
Questions engineers ask.
Is there an AI SQL tool safe for production Postgres or MySQL that masks emails and phone numbers?
Yes — Numling connects with a read-only database user across Postgres, MySQL, Supabase, Neon, RDS, Snowflake, BigQuery, Redshift and MongoDB, enforces read-only sessions and timeouts in a guarded query runner, and replaces personal data (names, emails, phones, addresses) with deterministic pseudonyms before any AI model sees query output.
How is this different from a cloud console’s built-in AI SQL editor (like Supabase or Neon)?
Built-in SQL editors are designed for developers working inside the database console with admin privileges. Numling is built for founders, ops, and product teammates to ask questions safely in plain English or Slack — read-only, with PII masked, saved metric definitions, scheduled reports, and anomaly alerts.
Does the read-only role respect Row Level Security (RLS) on Postgres and Supabase?
Yes. A newly created role without BYPASSRLS obeys RLS policies on tables where RLS is enabled, and only reads schemas and tables explicitly granted to it. You can also configure per-user row rules inside Numling.
Can we self-host or run the query runner inside our own VPC?
Yes. Self-hosting Numling in your own cloud is available today — email team@numling.app and we’ll set it up with you.
Ask your production database safely in ten minutes.
Read-only transactions, PII masked before the AI sees a row, on every database you connect.