SpiceAI 0.2.0
See the version list below for details.
dotnet add package SpiceAI --version 0.2.0
NuGet\Install-Package SpiceAI -Version 0.2.0
<PackageReference Include="SpiceAI" Version="0.2.0" />
<PackageVersion Include="SpiceAI" Version="0.2.0" />
<PackageReference Include="SpiceAI" />
paket add SpiceAI --version 0.2.0
#r "nuget: SpiceAI, 0.2.0"
#:package SpiceAI@0.2.0
#addin nuget:?package=SpiceAI&version=0.2.0
#tool nuget:?package=SpiceAI&version=0.2.0
Dotnet Spice SDK
Dotnet SDK for Spice.ai.
- Minimum supported version: .NET 8.0
- Supports .NET Standard 2.0+, .NET 8.0, .NET 9.0, and .NET 10.0.
- Asynchronous I/O.
Install
dotnet add package spiceai
Usage
Self-Hosted Spice Runtime
Follow the quickstart guide to install and run Spice locally.
Initialize Client
using Spice;
using var client = new SpiceClientBuilder().Build();
Query
using Spice;
using var client = new SpiceClientBuilder().Build();
var data = await client.Query("SELECT * FROM my_table LIMIT 10;");
Parameterized Queries
Use parameterized queries to prevent SQL injection and improve performance:
using Spice;
using var client = new SpiceClientBuilder().Build();
var parameters = new Dictionary<string, object>
{
{ "product_id", 42 },
{ "min_price", 10.0 }
};
var data = await client.Query(
"SELECT * FROM products WHERE id = :product_id AND price >= :min_price",
parameters);
Refresh Dataset
Trigger a refresh of an accelerated dataset:
using Spice;
using var client = new SpiceClientBuilder().Build();
await client.RefreshDatasetAsync("my_dataset");
Custom Connection Settings
using Spice;
// Connect to Spice on a custom host/port
using var client = new SpiceClientBuilder()
.WithFlightAddress("grpc://my-server:50051")
.WithHttpAddress("http://my-server:8090")
.Build();
// Enable TLS for self-hosted Spice
using var tlsClient = new SpiceClientBuilder()
.WithFlightAddress("grpc+tls://my-server:50051")
.WithHttpAddress("https://my-server:8090")
.WithTls(true)
.Build();
Spice.ai Cloud
Initialize Client
using Spice;
using var client = new SpiceClientBuilder()
.WithSpiceCloud("API_KEY") // Automatically configures endpoints and enables TLS
.Build();
Query
using Spice;
using var client = new SpiceClientBuilder()
.WithSpiceCloud("API_KEY")
.Build();
var data = await client.Query("SELECT * FROM eth.recent_blocks LIMIT 10;");
Parameterized Queries
using Spice;
using var client = new SpiceClientBuilder()
.WithSpiceCloud("API_KEY")
.Build();
var parameters = new Dictionary<string, object>
{
{ "nation_name", "CHINA" },
{ "min_key", 0 }
};
var data = await client.Query(
"SELECT * FROM tpch.nation WHERE n_name = :nation_name AND n_nationkey >= :min_key",
parameters);
Refresh Dataset
using Spice;
using var client = new SpiceClientBuilder()
.WithSpiceCloud("API_KEY")
.Build();
await client.RefreshDatasetAsync("my_dataset");
Memory Management
The SpiceClient implements IDisposable and should be properly disposed to release network resources (gRPC channels, HTTP clients). Use the using statement or using declaration for automatic disposal:
// Using statement (automatically disposes when scope exits)
using (var client = new SpiceClientBuilder().WithSpiceCloud("API_KEY").Build())
{
var data = await client.Query("SELECT * FROM tpch.customer LIMIT 10;");
// Process data...
} // Client is disposed here
// Or using declaration (C# 8.0+)
using var client = new SpiceClientBuilder().WithSpiceCloud("API_KEY").Build();
var data = await client.Query("SELECT * FROM tpch.customer LIMIT 10;");
// Client is disposed at end of scope
Important: Always dispose of SpiceClient instances to prevent resource leaks, especially in long-running applications or when creating multiple client instances.
Documentation
Check out our Documentation to learn more about how to use the Dotnet SDK.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 is compatible. 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 is compatible. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Apache.Arrow (>= 18.0.0)
- Apache.Arrow.Flight (>= 18.0.0)
- Grpc.Core.Api (>= 2.70.0)
- Grpc.Net.Client (>= 2.70.0)
- Grpc.Net.Common (>= 2.70.0)
- Polly (>= 8.5.0)
-
net10.0
- Apache.Arrow (>= 18.0.0)
- Apache.Arrow.Flight (>= 18.0.0)
- Grpc.Core.Api (>= 2.70.0)
- Grpc.Net.Client (>= 2.70.0)
- Grpc.Net.Common (>= 2.70.0)
- Polly (>= 8.5.0)
-
net8.0
- Apache.Arrow (>= 18.0.0)
- Apache.Arrow.Flight (>= 18.0.0)
- Grpc.Core.Api (>= 2.70.0)
- Grpc.Net.Client (>= 2.70.0)
- Grpc.Net.Common (>= 2.70.0)
- Polly (>= 8.5.0)
-
net9.0
- Apache.Arrow (>= 18.0.0)
- Apache.Arrow.Flight (>= 18.0.0)
- Grpc.Core.Api (>= 2.70.0)
- Grpc.Net.Client (>= 2.70.0)
- Grpc.Net.Common (>= 2.70.0)
- Polly (>= 8.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.