Apache.Calcite.Cosmos.Adapter 1.0.0-pre.316

This is a prerelease version of Apache.Calcite.Cosmos.Adapter.
dotnet add package Apache.Calcite.Cosmos.Adapter --version 1.0.0-pre.316
                    
NuGet\Install-Package Apache.Calcite.Cosmos.Adapter -Version 1.0.0-pre.316
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Apache.Calcite.Cosmos.Adapter" Version="1.0.0-pre.316" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Apache.Calcite.Cosmos.Adapter" Version="1.0.0-pre.316" />
                    
Directory.Packages.props
<PackageReference Include="Apache.Calcite.Cosmos.Adapter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Apache.Calcite.Cosmos.Adapter --version 1.0.0-pre.316
                    
#r "nuget: Apache.Calcite.Cosmos.Adapter, 1.0.0-pre.316"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Apache.Calcite.Cosmos.Adapter@1.0.0-pre.316
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Apache.Calcite.Cosmos.Adapter&version=1.0.0-pre.316&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Apache.Calcite.Cosmos.Adapter&version=1.0.0-pre.316&prerelease
                    
Install as a Cake Tool

Apache.Calcite.Cosmos.Adapter

An Apache Calcite adapter for Azure Cosmos DB for NoSQL. Query Cosmos containers with ordinary SQL from .NET: as much of each query as Cosmos can evaluate is translated to Cosmos SQL and run by the service, and the rest — relational joins, set operations, functions Cosmos lacks — is evaluated in process by Calcite, which runs inside your application through IKVM.

User manual · Source

Install

dotnet add package Apache.Calcite.Cosmos.Adapter
dotnet add package Apache.Calcite.Data

Apache.Calcite.Data is the ADO.NET provider your code talks to; this package plugs Cosmos into it.

Register a database

{
  "version": "1.0",
  "defaultSchema": "COSMOS",
  "schemas": [{
    "name": "COSMOS",
    "type": "custom",
    "factory": "Apache.Calcite.Cosmos.Adapter.CosmosSchemaFactory, Apache.Calcite.Cosmos.Adapter",
    "operand": {
      "endpoint": "https://myaccount.documents.azure.com:443/",
      "database": "inventory",
      "containers": [ "products", "orders" ]
    }
  }]
}

Give a key to use an account key, or none to sign in with Microsoft Entra ID. Omit containers to expose every container, or database to expose the whole account.

The factory must be named assembly-qualified, as above, and its assembly loaded before the model is read — _ = new Apache.Calcite.Cosmos.Adapter.CosmosSchemaFactory(); at start-up does it.

Query

await using var connection = new CalciteConnection(new CalciteConnectionStringBuilder
{
    Model = "inline:" + model,
    CaseSensitive = true,
    DefaultNullCollation = "LOW",
}.ConnectionString);

await connection.OpenAsync();

await using var command = connection.CreateCommand();
command.CommandText = """
    SELECT c."id", JSON_VALUE(c."DOC", '$.name') AS "name"
    FROM "products" AS c
    WHERE c."$.category" = 'bikes'
    """;

await using var reader = await command.ExecuteReaderAsync();
while (await reader.ReadAsync())
    Console.WriteLine(reader.GetString(1));

Each container is a table with one column holding the whole document, DOC, reached with JSON_VALUE and JSON_QUERY, plus id, _ts, _etag and the partition key. Set DefaultNullCollation = "LOW" so sorts can run at the service, and read with the asynchronous methods — the Cosmos SDK has no synchronous reads.

Features

  • Filters, projections, sorts, paging, aggregation and array traversal pushed down — partially where a whole operator cannot be
  • Partition routing and point reads recovered from the predicate
  • Lookup joins that fetch only the documents another source's keys match
  • INSERT, UPDATE and DELETE
  • JSON Schema and UNIQUE declarations that let UUIDs, timestamps and numbers stored as text push down
  • Full text search, vector search and geodesic geography
  • Request-unit metrics and traces through System.Diagnostics

Documentation

The user manual covers configuration, the row model, what pushes down and why, writing, declarations, performance, monitoring and troubleshooting.

License

Apache License 2.0.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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-pre.316 0 10/10/2026
1.0.0-pre.312 0 10/10/2026
1.0.0-pre.305 0 10/10/2026
1.0.0-pre.297 0 10/10/2026
1.0.0-pre.291 23 10/9/2026
1.0.0-pre.287 86 9/30/2026
1.0.0-pre.283 103 9/28/2026
1.0.0-pre.278 56 9/26/2026
1.0.0-pre.275 116 9/22/2026
1.0.0-pre.266 82 9/22/2026
1.0.0-pre.257 91 9/21/2026
1.0.0-pre.255 64 9/20/2026
1.0.0-pre.251 63 9/20/2026
1.0.0-pre.249 65 9/20/2026
1.0.0-pre.238 65 9/20/2026
1.0.0-pre.233 83 9/19/2026
1.0.0-pre.2 70 8/31/2026
1.0.0-pre.1 87 8/14/2026