DataQL.Sqlite
1.0.0-preview.4
dotnet add package DataQL.Sqlite --version 1.0.0-preview.4
NuGet\Install-Package DataQL.Sqlite -Version 1.0.0-preview.4
<PackageReference Include="DataQL.Sqlite" Version="1.0.0-preview.4" />
<PackageVersion Include="DataQL.Sqlite" Version="1.0.0-preview.4" />
<PackageReference Include="DataQL.Sqlite" />
paket add DataQL.Sqlite --version 1.0.0-preview.4
#r "nuget: DataQL.Sqlite, 1.0.0-preview.4"
#:package DataQL.Sqlite@1.0.0-preview.4
#addin nuget:?package=DataQL.Sqlite&version=1.0.0-preview.4&prerelease
#tool nuget:?package=DataQL.Sqlite&version=1.0.0-preview.4&prerelease
DataQL
DataQL is a provider-independent JSON query DSL for .NET. Clients express query intent once — filters, projection, ordering, grouping, and cursor pagination — and DataQL validates, translates, and executes against the registered backend.
Use it when you want a single query contract across relational and document stores, without exposing SQL or provider-specific syntax to API consumers.
Client → JSON Query DSL → Validate / AST → Provider Translator → Native Query → Results
| Target | .NET 8 |
| License | MIT |
| Packages | NuGet (DataQL, DataQL.AspNetCore, provider packages) |
| Spec | Generic Query DSL v1.0 |
Packages
| Package | Role |
|---|---|
DataQL |
Core DSL, validation, AST, hosting (IDataQLService) |
DataQL.AspNetCore |
HTTP endpoints, OpenAPI metadata |
DataQL.Sqlite |
SQLite provider |
DataQL.SqlServer |
SQL Server provider |
DataQL.Cosmos |
Azure Cosmos DB provider |
Providers and compatibility
Capabilities are advertised per provider and enforced at validation time. Unsupported operators or features return structured capability errors (for example Capability.OperatorNotSupported).
Feature matrix
| Feature | SQLite | SQL Server | Cosmos DB |
|---|---|---|---|
| Select (projection) | Yes | Yes | Yes |
| Exclude | Yes | Yes | No |
| Distinct | Yes | Yes | No |
Nested fields (a.b) |
No | Yes | Yes |
| Grouping | Yes | Yes | Yes* |
| Having | Yes | Yes | No |
| Include count | Yes | Yes | Yes† |
| Cursor pagination | Seek / keyset | Seek / keyset | Feed token‡ |
* Cosmos grouped queries return the full aggregate set: limit is ignored and continuation is not supported.
† Cosmos includeCount runs a separate COUNT query (extra RU cost).
‡ On Cosmos, order is optional unless a continuation token is supplied. On SQLite and SQL Server, order is required on every query for deterministic paging.
Filter operators
| Operator | SQLite | SQL Server | Cosmos DB |
|---|---|---|---|
$eq $ne $gt $gte $lt $lte |
Yes | Yes | Yes |
$in $nin |
Yes | Yes | Yes |
$contains $startsWith $endsWith |
Yes | Yes | Yes |
$regex |
No | No | Yes |
$exists $isNull |
Yes | Yes | Yes |
$and $or $not |
Yes | Yes | Yes |
$containsAny $containsAll $size $isEmpty $any |
No | Yes | Yes |
Group metric operations
| Operation | SQLite | SQL Server | Cosmos DB |
|---|---|---|---|
count sum avg min max |
Yes | Yes | Yes |
first last |
No | No | No |
Provider notes
| Provider | Highlights |
|---|---|
| SQLite | Relational tables; seek paging; grouping + having; no nested field paths |
| SQL Server | Nested fields and array operators; seek paging; grouping + having |
| Cosmos DB | Document model + nested fields; feed-token paging; no exclude / distinct / having |
At runtime you can also inspect capabilities via meta endpoints (see How to use).
How to use
1. Install packages
dotnet add package DataQL
dotnet add package DataQL.AspNetCore
dotnet add package DataQL.Sqlite # and/or SqlServer / Cosmos
2. Register sources
using DataQL;
using DataQL.AspNetCore;
using DataQL.Sqlite.DependencyInjection;
using Microsoft.Data.Sqlite;
builder.Services
.AddDataQL(options =>
{
options.AddSqliteSource("employees", _ =>
new SqliteConnection("Data Source=app.db"));
// options.AddSqlServerSource("hr", _ => new SqlConnection(cs));
// options.AddCosmosSource("docs", endpoint, key, databaseId);
})
.AddDataQLOpenApi();
3. Map endpoints (ASP.NET Core)
var app = builder.Build();
app.MapDataQL("/dataql");
app.Run();
This exposes:
| Method | Route | Purpose |
|---|---|---|
POST |
/dataql/query/{sourceKey}/{table} |
Execute a query |
GET |
/dataql/meta/sources |
List registered sources |
GET |
/dataql/meta/sources/{sourceKey}/tables |
List tables / containers |
GET |
/dataql/meta/sources/{sourceKey}/tables/{table}/schema |
Table schema |
GET |
/dataql/meta/openapi.json |
Generated OpenAPI document |
4. Call the query API
Request — POST /dataql/query/employees/Employees
{
"where": {
"$and": [
{ "City": "Delhi" },
{ "Age": { "$gte": 18 } }
]
},
"order": [
{ "field": "Id", "direction": "asc" }
],
"select": ["Id", "Name", "Age", "City"],
"limit": 50,
"includeCount": false
}
Response
{
"results": [ /* rows */ ],
"hasMore": true,
"continuationToken": "...",
"count": null
}
Pass continuationToken on the next request (same filter/order/select shape) to page forward. Offset/skip pagination is not supported.
5. Execute from code
var response = await dataQLService.ExecuteAsync<object>(
sourceKey: "employees",
table: "Employees",
request: queryRequest,
cancellationToken);
You can also harden queries before execution — for example force IsActive = true with QueryFilterBuilder — as shown in DataQL.ExampleApi.
Query shape (reference)
| Field | Description |
|---|---|
where |
Filter tree (equality shorthand or $ operators) |
order |
Sort clauses (field + asc / desc) |
select / exclude |
Projection |
distinct |
Distinct field list (provider-dependent) |
limit |
Page size |
continuationToken |
Opaque cursor from a previous page |
includeCount |
Optionally return total matching count |
group |
groupBy, metrics, optional having |
Full grammar and examples: specs/Generic-Query-DSL-Specification-v1.0.md.
Example API
The solution includes DataQL.ExampleApi, a runnable sample with SQLite seed data and optional SQL Server / Cosmos wiring:
dotnet run --project DataQL.ExampleApi
License
MIT — see LICENSE.
Versioning and release process: docs/release-process.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Dapper (>= 2.1.35)
- DataQL (>= 1.0.0-preview.4)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview.4 | 73 | 8/9/2026 |
| 1.0.0-preview.3 | 67 | 8/9/2026 |
| 1.0.0-preview.2 | 66 | 8/9/2026 |
| 1.0.0-preview.1 | 71 | 8/8/2026 |