Skip to main content

Crate omnia_azure_table

Crate omnia_azure_table 

Source
Expand description

§omnia-azure-table

crates.io docs.rs

Azure Table Storage backend for the Omnia WASI runtime, implementing the wasi-jsondb interface.

Azure Table Storage is a NoSQL key-value store. This crate maps the jsondb document model onto Azure Table entities: top-level JSON fields are flattened into entity properties so that server-side OData $filter queries work, while nested objects are serialized as JSON string properties.

MSRV: Rust 1.93

§Key Mapping

The collection string encodes {table}/{partitionKey} (split on the first /). The document id maps to the Azure Table RowKey.

jsondb conceptAzure Table equivalent
collection{table}/{PartitionKey}
idRowKey
document.dataFlattened entity properties

Example: get("users/tenant-a", "user-123") → table=users, PK=tenant-a, RK=user-123.

A table-only collection ("users" without a /) is allowed for query() (cross-partition scan) but rejected for point operations (get, insert, put, delete).

§OData Type Mapping

Top-level JSON fields are flattened into typed entity properties. The crate automatically adds @odata.type annotations where Azure Table cannot infer the type from the JSON representation alone.

JSON valueAzure OData typeAnnotation added?
true / falseEdm.BooleanNo (inferred)
integer ≤ i32 rangeEdm.Int32No (inferred)
integer > i32 rangeEdm.Int64Yes
floating pointEdm.DoubleYes
stringEdm.StringNo (inferred)
null(skipped)N/A
array / objectEdm.String (JSON-serialized)No

Edm.DateTime, Edm.Guid, and Edm.Binary require the document to include explicit @odata.type annotations — the crate does not attempt to guess these from string values.

§Supported Operations

OperationDescription
getPoint read by PartitionKey + RowKey
insertInsert new entity (fails if exists)
putUpsert entity
deleteDelete entity (returns whether it existed)
queryFiltered listing with OData $filter and pagination
ensure_tableCreates a table if it does not exist (admin helper)

§Filter Support

FilterSupportedNotes
Compare (eq/ne/gt/gte/lt/lte)YesTranslated to OData operators
InList / NotInListYesExpanded to OR chains
And / Or / NotYesSupported when all children are supported
Contains / StartsWith / EndsWithNoRejected with error
IsNull / IsNotNullNoRejected with error
offsetNoRejected with error — use continuation tokens
continuationYesNative Azure Table continuation tokens

Unsupported filters and query options return an error rather than silently falling back to client-side evaluation, which could pull unbounded data from the table service. Azure Table’s OData $filter does not support string functions or null checks, and there is no $skip — see Querying tables and entities.

Note: order_by is ignored. Azure Table returns results in PartitionKey / RowKey order; there is no server-side $orderby. Callers that need a different sort order should sort after retrieval.

§Why not azure_data_tables?

The azure_data_tables crate is on a legacy branch with no official replacement planned. This crate calls the REST API directly and leaves business object mapping to the WebAssembly guest.

§Configuration

VariableRequiredDefaultDescription
AZURE_STORAGE_ACCOUNTyesStorage account name
AZURE_STORAGE_KEYyesStorage account access key
AZURE_TABLE_ENDPOINTnohttps://{account}.table.core.windows.netTable service endpoint URL

Set AZURE_TABLE_ENDPOINT to override the default public-cloud URL. Common values:

  • Azurite: http://127.0.0.1:10002/{account}
  • Azure sovereign cloud: the appropriate table.core.* URL for your region

§Usage

use omnia::Backend;
use omnia_azure_table::Client;

let options = omnia_azure_table::ConnectOptions::from_env()?;
let client = Client::connect_with(options).await?;

// Create the table if needed (admin helper, not part of wasi-jsondb)
client.ensure_table("my_table").await?;

§License

MIT OR Apache-2.0

Modules§

store
wasi-jsondb implementation for Azure Table Storage.

Structs§

Client
Backend client for Azure Table storage.
ConnectOptions
Azure Table connection options.