NLQueries GitHub

Blog  / 

SaaS vs. Private Cloud vs. Self-Hosted NL2SQL: Cost, Data Flow, and Licensing

Published . Written for nlqueries-core 0.4.

self-hosted licensing cost

Picture a planning meeting for a natural-language-to-SQL (NL2SQL) feature. Security has given a clear answer: a model provider may see schema, meaning table names, column names and descriptions, but no customer row may ever reach one. Finance has asked a different question: what will this cost per month, and what happens if usage doubles? Three options are on the whiteboard. One is a vendor-managed assistant inside the warehouse. Another is a "private cloud" deal a vendor has offered. The third is to run a source-available engine such as NLQueries Core on your own infrastructure.

It's tempting to sort those three by how private they sound, and that's the mistake to avoid. The hosting label tells you where the engine runs. It doesn't tell you who receives your schema, your sample values, your result rows, your error messages or your logs. A free source download doesn't mean free operation either, because every option has model calls, warehouse compute, people and license terms that someone pays for. What follows is a way to compare the three that holds up when security and finance both review it: a data-flow map, a cost worksheet that keeps known inputs apart from guesses, and a short list of rights and ownership questions that can veto an option whatever it costs.

Everything here comes from vendor documentation and from source at pinned versions. This comparison has no price quotes, deployments or payload captures for any of the three options, so you'll see formulas and placeholders rather than dollar figures.

What the three labels actually mean

SaaS, or vendor-managed, means the vendor runs the NL2SQL engine inside its own platform. Snowflake's Cortex Analyst and Databricks' Genie both work this way. The query features you care about live inside the vendor's platform. You configure them; you don't operate them. Both are moving targets, too. Snowflake's documentation now recommends Semantic Views and points to a transition toward Cortex Agents, so a plan built around older YAML-only semantic models may already be out of date. Genie's documentation says Unity Catalog foreign tables are eligible data, and it separates the identity used for user data access from the compute credentials. That distinction matters a lot for who sees what.

Private cloud is the slippery one. It isn't a standard product category. It describes a specific arrangement. Who runs the software? Whose account does it run in? Which managed services does it still call, and what does the contract allow? Until you have the terms in front of you, treat "private cloud" as a question rather than an answer. Here it's a placeholder for whatever arrangement you've actually been offered, with no assumption that any particular vendor sells one.

Self-hosted means you run the engine on infrastructure you control. With NLQueries Core 0.4.1, that's the Python engine, its connectors and its caches. It doesn't automatically mean everything stays local. The LLM providers guide describes two model tiers, a main model and a fast model, and both have to be configured. If either one points at a hosted API, your prompts leave your network even though the engine doesn't. The same guide notes that other LiteLLM routes aren't claimed as tested, so pointing a tier at a local model is a configuration you'd have to verify yourself.

So the useful question isn't "which option is private?" It's "for each kind of data, who receives it under each option?"

Map every piece of data across every boundary

Start with a recipient matrix. The rows are the kinds of data an NL2SQL request touches, and the columns are your options. Each cell names who receives that data and whether your policy allows it. Here's a starting version, filled in only where documentation says something concrete:

Data Vendor-managed (Cortex / Genie) Private-cloud arrangement Self-hosted NLQueries Core 0.4.1
Question text Inside vendor platform; recipients per contract Per contract — UNKNOWN until terms supplied Configured main/fast model providers
Schema and descriptions Inside vendor platform; recipients per contract UNKNOWN Sent in the prompt payload to the configured provider
Sampled column values Per vendor config — verify UNKNOWN Optional; documented as configurable
Result rows Per vendor config — verify UNKNOWN Differ by route; hybrid row sending controlled by NLQ_SEND_RESULT_ROWS_TO_LLM (default true)
Database error text Per vendor — verify UNKNOWN Up to 1,000 characters go to the model when it corrects a failed statement
Nearby stored values (literal-grounding repair) Per vendor — verify UNKNOWN Can be sent to the repair step; see NLQ_LITERAL_GROUNDING_REPAIR
Logs and event records Vendor platform; retention per contract UNKNOWN Wherever you ship them
Embeddings / example stores Per vendor — verify UNKNOWN Local embedding runtime; configured Qdrant endpoint stores vectors and payloads. Review that endpoint and any custom integration separately
Embedding model download Per vendor — verify UNKNOWN One-time download of the model named by NLQ_EMBED_MODEL from the Hugging Face hub, unless it's set to a local path

The NLQueries column is the most filled in, but not because self-hosting is automatically better. It's because the project documents its outbound traffic in one place. The configuration reference has a section on what leaves the machine. It lists the question, the schema and context in the prompt payload, sampled values, document excerpts, and result data shared with the model on hybrid answers, which combine database results with retrieved documents. Just below that table it adds two quieter channels: up to 1,000 characters of a database error go back to the model when it corrects a failed statement, and literal grounding can send nearby stored values to its repair step. The architecture doc describes how requests are routed between SQL and document paths, and that route decides whether rows go to a model at all.

Now apply the security rule from the meeting: schema may leave, rows may not. The obvious move is to switch off the two settings that look like row exposure. Disabling KB value sampling and hybrid result-row sending narrows two payload paths; it doesn't establish schema-only egress. Review literal-grounding repair, database-error repair, descriptions, examples, documents and logs separately. Defaults matter here as well. The configuration reference lists NLQ_SEND_RESULT_ROWS_TO_LLM as true by default in 0.4.1, so a deployment that never touches it keeps sending hybrid rows. Keep this deployment's schema-only claim unverified until captures of every enabled path show that the approved data boundary holds.

In practice, that means planting a distinct synthetic canary for each path: a stored value that grounding repair might offer, a string that a forced database error will quote, a phrase inside a document excerpt, a detail in a follow-up turn. Then capture redacted provider payloads for generation, grounding repair, database-error repair, follow-ups and any document or hybrid calls. A canary that fails to appear in one probe covers only the path that probe exercised. It's not evidence that the other paths are clean.

For the managed services, the same cells need the vendor's own documentation and contract terms for your account and region. The answer may be perfectly acceptable. You just can't fill the cell from a product page.

Leave UNKNOWN in the matrix wherever it applies. A blank cell under your preferred option is the most useful thing the exercise can produce, because it tells you exactly what to ask the vendor or what to measure.

To keep the comparison honest, push the same question through every option. A small synthetic dataset works well: customers in two tenants, six orders, one cancelled order, one order with a NULL amount, and one order with two line items so a careless join double-counts it. Then ask: "For tenant A, what were paid-order revenue and paid-order count in October 2026?"

-- Synthetic fixture (SQLite). Reference answer only; not an NL2SQL product test.
CREATE TABLE customers(id INTEGER PRIMARY KEY, tenant_id TEXT NOT NULL, region TEXT);
CREATE TABLE orders(id INTEGER PRIMARY KEY, customer_id INTEGER REFERENCES customers(id),
                    order_date TEXT, amount_cents INTEGER, status TEXT);
CREATE TABLE order_items(id INTEGER PRIMARY KEY, order_id INTEGER REFERENCES orders(id), sku TEXT);
INSERT INTO customers VALUES (1,'A','East'),(2,'A','West'),(3,'B','North');
INSERT INTO orders VALUES
 (101,1,'2026-10-01',10000,'PAID'),(102,1,'2026-10-02',5000,'CANCELLED'),
 (103,2,'2026-10-31',20000,'PAID'),(104,3,'2026-10-02',70000,'PAID'),
 (105,1,'2026-11-01',40000,'PAID'),(106,2,'2026-10-15',NULL,'PAID');
INSERT INTO order_items VALUES (1,101,'a'),(2,101,'b'),(3,103,'c');

SELECT SUM(o.amount_cents) AS revenue_cents, COUNT(*) AS paid_order_count
FROM orders AS o JOIN customers AS c ON c.id = o.customer_id
WHERE c.tenant_id = 'A' AND o.status = 'PAID'
  AND o.order_date >= '2026-10-01' AND o.order_date < '2026-11-01';

On SQLite 3.45.3 the reference query returns (30000, 3). Revenue ignores the NULL amount, but that order still counts. Only the reference data and SQL were checked; no NL2SQL product was run against this fixture. Notice that the tenant_id = 'A' filter is part of the expected answer, not a security control. If tenant isolation matters, it has to be enforced by database permissions or the engine's access layer, and tested separately.

A cost worksheet that keeps guesses labelled

Finance wants a number. The honest response is a formula plus clearly labelled inputs, so anyone can see which parts are quotes and which are guesses:

Total cost of ownership = setup + months × (model calls + database compute + infrastructure + operations labor + license and service fees)

Every option has every term, just in different proportions. A managed service rolls model calls and much of the infrastructure into the vendor's billing. You still pay warehouse compute, and someone still owns the semantic model and the rollout. Self-hosting moves infrastructure and operations onto your bill. You also pay whichever model provider you configure, and you may owe license fees depending on how you use the software. A private-cloud arrangement sits somewhere in between, and only its contract tells you where.

Here's the worksheet as a small Python function. It's custom code with placeholder inputs, not part of any product, so it shows the arithmetic and none of the numbers is a price. Its assumptions are deliberately simple. This simplified worksheet assumes every request executes exactly one database query, cache hits skip model calls, and model_calls_per_request describes misses. It excludes additional grounding, retry and schema-query costs. Replace the DB term with measured billed operations when those assumptions don't hold.

# Cost worksheet sketch — custom code, not part of any product. NOT EXECUTED.
# Every input is a placeholder: replace with dated quotes, logs or labelled estimates.
from dataclasses import dataclass

@dataclass
class Scenario:
    name: str
    setup_cost: float              # one-time integration and rollout
    monthly_requests: int          # same demand assumption for every option
    model_calls_per_request: float # include retries; measure, don't guess, when you can
    cost_per_model_call: float     # from provider pricing for your token profile
    cache_hit_rate: float          # 0..1; hits may skip model calls...
    db_cost_per_query: float       # ...but may still execute SQL (see below)
    fixed_infra_monthly: float     # idle capacity counts
    ops_labor_monthly: float       # on-call, upgrades, semantic-model upkeep
    fees_monthly: float            # license, support or platform fees

def monthly_cost(s: Scenario) -> float:
    misses = s.monthly_requests * (1 - s.cache_hit_rate)
    model = misses * s.model_calls_per_request * s.cost_per_model_call
    db = s.monthly_requests * s.db_cost_per_query   # replayed SQL still hits the database
    return model + db + s.fixed_infra_monthly + s.ops_labor_monthly + s.fees_monthly

def tco(s: Scenario, months: int) -> float:
    return s.setup_cost + months * monthly_cost(s)

Run every option through it with the same demand and the same service objective, and produce low, base and high cases for each. Then add a provenance column to the spreadsheet you'll actually share. Every input should be marked as a dated quote, a measured log or an estimate. Without that column, an assumed staffing level ends up looking as solid as a contracted rate, and the option with the most optimistic guesses wins by default.

Where cost models quietly go wrong

Three patterns break naive estimates. The worksheet is shaped around them, and they're also where its simplifications stop matching reality.

Cache hits aren't free, and they aren't uniform. It's natural to assume a cached answer costs nothing. In NLQueries Core, the orchestrator source shows that cache replay can run the stored SQL again, and the execution module shows that this depends on the caller's execution policy. A generate-only hit returns no rows. If replay execution succeeds, the rows reflect the database view visible to that query. So a hit can skip model calls while still costing database compute, or it can cost almost nothing, and the worksheet's one-query-per-request term flattens that difference. If most of your traffic runs in preview, measure it rather than charging every request a query. Whether the cached narrative stays accurate when the underlying data changes is a separate question. The architecture doc also describes cache context scoped to each agent, which affects how you partition and reason about hits. If you're evaluating, change one amount in the fixture and confirm that the replayed answer reflects it, in the prose as well as the rows.

Retries and repairs multiply calls. A validation failure followed by a regenerate counts as two model calls. So do a timeout and a retry. In Core, a failed statement can go back to the model for correction, which adds a model call and can trigger another execution if the replacement SQL passes checks. Literal grounding runs its own value lookups against the database, and its repair step can add a model call. Self-hosted engines with two model tiers can also make more than one call per question by design. Measure calls and billed queries per request from logs where you can, and separate cold starts, warm requests without a cache hit, and cache hits. Don't settle for one average, because the average hides exactly the requests that cost the most.

Idle capacity is real cost. A self-hosted deployment sized for peak load costs money at 3 a.m. too. Managed services shift that risk onto the vendor's pricing model, and you pay for it in another form. Put fixed infrastructure in its own line so the comparison doesn't treat self-hosting as purely usage-based.

Rights, ownership and exit: the gates before the math

Some questions shouldn't be weighted against cost at all, because a bad answer disqualifies the option.

The first is licensing. NLQueries Core is published under the Business Source License 1.1, so the current release is source-available, not Open Source before the applicable conversion. Its Additional Use Grant permits production use that doesn't include offering the software to third parties on a hosted or managed basis. Conversion is version-specific: each version moves to the Apache License 2.0 on its Change Date or on the fourth anniversary of that version's first public distribution, whichever comes first, and the license pinned here lists a Change Date of June 4, 2030. For an internal tool the terms may fit comfortably. If you plan to expose NL2SQL to your own customers, read the grant before you cost anything, because a design that costs less but breaks the license isn't an option. The "private cloud" label doesn't settle this either. Who benefits, who runs it and how it's distributed are what count, and a lawyer should review the specific design. Source availability on its own isn't a hosting grant.

The second is ownership. For each option, write down who handles incidents, upgrades, backups and recovery. Then decide who can export the semantic model, the verified examples and the query history if you leave. With a managed service, much of that sits with the vendor, which is convenient until you want to move. When you self-host, all of it is yours. That's control, and it's also the operations-labor line in the worksheet. A useful exercise is to rehearse a model-provider outage on a synthetic setup and see who actually gets paged.

The third is the data-flow gate from earlier. If any cell in the recipient matrix shows a restricted data type reaching a recipient your policy doesn't allow, that option is out. A lower monthly figure doesn't change that, and neither does a configuration that looks right on paper but hasn't been captured.

So which one should you choose?

Here's how the options fit, conditionally:

  • Vendor-managed fits when your data already lives in that warehouse, your policy can be met by the vendor's documented boundaries and your contract, and you'd rather pay a platform than staff an operations rotation. Check the current product direction before you build. Snowflake's shift toward Semantic Views and Cortex Agents is a good example.
  • Private cloud fits only when there's a concrete contract that names the operator, the account, the remaining external calls and your rights. Until then it's a sales term.
  • Self-hosted NLQueries Core fits when you need to choose the model providers yourself and control row exposure, and you have people to run it. It gives you documented controls such as sampling, NLQ_SEND_RESULT_ROWS_TO_LLM and NLQ_LITERAL_GROUNDING_REPAIR, and a documented account of what leaves the machine. Those controls narrow payloads rather than guarantee a schema-only boundary, so it still needs egress captures on every enabled path, operations effort and a license reading that matches your use.

There's no universal cheapest or most private option here, and anyone who claims one before filling in the matrix is guessing. Your next step is concrete. Copy the recipient matrix, fill in every cell from documentation and contracts for your actual account and region, and mark the rest UNKNOWN. Then take the worst UNKNOWN to the vendor, or plant a canary for it and capture the payload, before anyone opens the cost spreadsheet.

References

  • NLQueries Core 0.4.1 — LLM providers: https://github.com/nlqueries/nlqueries/blob/2fbf276bf299e0b019c41cb62c5e6969d4c33ff9/docs/llm-providers.md
  • NLQueries Core 0.4.1 — Configuration reference: https://github.com/nlqueries/nlqueries/blob/2fbf276bf299e0b019c41cb62c5e6969d4c33ff9/docs/configuration.md
  • NLQueries Core 0.4.1 — Architecture: https://github.com/nlqueries/nlqueries/blob/2fbf276bf299e0b019c41cb62c5e6969d4c33ff9/docs/architecture.md
  • NLQueries Core 0.4.1 — Multi-agent orchestrator source: https://github.com/nlqueries/nlqueries/blob/2fbf276bf299e0b019c41cb62c5e6969d4c33ff9/nlqueries/orchestrator/multi_agent_orchestrator.py
  • NLQueries Core 0.4.1 — Execution policy source: https://github.com/nlqueries/nlqueries/blob/2fbf276bf299e0b019c41cb62c5e6969d4c33ff9/nlqueries/execution.py
  • NLQueries Core — Business Source License 1.1: https://github.com/nlqueries/nlqueries/blob/2fbf276bf299e0b019c41cb62c5e6969d4c33ff9/LICENSE
  • NLQueries documentation (v0.4.1 banner): https://nlqueries.com/docs/
  • Snowflake — Cortex Analyst: https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst
  • Databricks — Genie Agents concepts (AWS): https://docs.databricks.com/aws/en/genie-agents/concepts

All posts · RSS feed · Documentation