What Is NQL? Narrative Query Language Explained

Blog

•

5

Mins

Nick Jordan
Founder

You know there's more data out there than what sits in your own tables. Your other teams have it. Your partners have it. A data marketplace has it. Some of it lives in another cloud entirely.

Bringing any of it into a single query usually turns into a project: a new pipeline, a schema mapping exercise, a legal review, a round of reformatting. So the queries most worth writing often never get written.

Narrative Query Language (NQL) is built to change that. It's the SQL you already know, with a few things SQL never had. We first introduced NQL in 2023. A lot has changed since then, so here's what NQL is and what it can do today.

What is NQL?

NQL (Narrative Query Language) is a SQL-based query language built for data collaboration. You write familiar SQL. Narrative checks your permissions, resolves every field to a common standard with Rosetta Stone, and translates the query into the SQL your data platform speaks, such as Snowflake SQL or Spark SQL. The query then runs where the data lives.

That means one query can read your own tables, data your partners share with you and data you buy from the Narrative Data Marketplace, without you building a pipeline for each source.

Why plain SQL stops working once data leaves one database

SQL was designed to query a single database. Data collaboration breaks that assumption in four ways.

  • Every platform speaks a different dialect. Snowflake, Spark and BigQuery each handle dates, strings and NULLs a little differently. A query written for one won't run on another without rework.
  • SQL has no idea who's allowed to see what. When a query touches another company's data, permissions have to be checked before it runs. Standard SQL has no concept of cross-company access rules or field-level controls.
  • No two sources agree on a schema. One dataset calls it "email," another "email address," and a third stores it hashed. Even your own tables disagree on what a field is called, how it's written or what it means.
  • The data isn't all in one place. Partner data and purchased data live in someone else's environment, and moving it into yours is slow, expensive and often not allowed.

Teams usually work around these gaps with custom pipelines, hand-written mappings and a lot of back-and-forth. NQL keeps SQL and handles all four for you.

What NQL adds to SQL

Query Rosetta Stone, not column names

Instead of learning every dataset's schema, you ask for standard fields, like gender or email. Rosetta Stone, Narrative's universal translator for data, translates that request for every dataset you can use and returns the results in one consistent format.

It works whether a source writes gender as "M" or "male." See how Rosetta Stone works in our documentation.

Partner data, with permissions built into the language

Add the data partners share with you and query it like any other table. Permission is part of the language, so your query sees only what each partner allows.

That control comes in two layers. An access rule decides which records and columns a partner can reach. A query policy decides what they can do with them. For example, a partner can count the email addresses in your segments, or match them against their own CRM, without ever seeing a single address. The data owner sets the rules once, and NQL enforces them on every query.

Enrich with the Narrative Data Marketplace

Need data you don't have? It's on the Narrative Data Marketplace. Marketplace data is normalized by Rosetta Stone too, so you can filter it to your own customers and pay only for the records that match. Before you buy, a match report shows what you'll get.

Runs where your data lives

NQL doesn't ask you to move your data. With Narrative Anywhere, a small piece of Narrative called the operator runs inside your own infrastructure, such as your Snowflake environment. It runs each query next to your data, and Narrative coordinates the work without ever seeing your raw data.

We're also working on letting a single query reach across even more of the places your data lives. More on that soon.

Results come back as a new dataset

Query results land as a new dataset, with every record harmonized. You can keep it as a materialized view and refresh it on a schedule, so an audience, a report or a training set stays current without anyone rerunning the query by hand.

NQL and AI agents

NQL isn't just for people. AI agents can work in it too.

With the Narrative MCP server, an AI assistant like Claude can find datasets, write NQL from a plain-English request, check it and run it. The same access rules and query policies apply to every query an agent runs, just as they do for a person.

NQL vs. SQL at a glance

NQL keeps SQL's syntax and adds what data collaboration needs. Our docs cover the details in a full NQL and SQL comparison. Standard SQL changes from one database to the next. With NQL, you write familiar SQL once, and Narrative translates it to Snowflake SQL, Spark SQL and more.

With standard SQL, you map every source's schema by hand, and permissions stop at the edge of one database. With NQL, Rosetta Stone resolves every source to one standard, and access rules and query policies are enforced across companies.

Standard SQL reaches the tables in one database and hands back a result set. NQL reaches your tables, your partners' data and Data Marketplace data, runs where that data lives and returns a new harmonized dataset you can refresh on a schedule. AI agents can write and run it too, through the MCP server.

Getting started with NQL

If you write SQL, you can write NQL today. Start with your first NQL query, then use the NQL reference for syntax, functions and operators.

Not everyone on your team writes SQL, and they don't have to. Query Builder lets anyone build a query visually, and it writes the NQL for them.

It's still the SQL you know. It just reaches a lot more data. Talk to our team to learn more.

Explore related

Insights, stories, & resources for the teams building modern data infrastructure.

Blog

•

2

Mins

Identity Orchestrator: Own Your Identity Graph

Identity Orchestrator

Blog

•

3

Mins

Easily Turn Any Snowflake Table Into a Narrative Dataset

Easily Turn Any Snowflake Table Into a Narrative Dataset

Blog

•

5

Mins

Map It Once, Use It Everywhere: Attribute Derivations in Rosetta Stone

Map It Once, Use It Everywhere: Attribute Derivations in Rosetta Stone