Python Client

Constructors

These are functions for constructing a client object.

tiled.client.from_uri(uri[, ...])

Connect to a Node on a local or remote server.

tiled.client.from_profile(name[, ...])

Build a Node based a 'profile' (a named configuration).

Client Container

The Container interface extends the collections.abc.Mapping (i.e. read-only dict) interface, so it supports these standard “magic methods”:

  • __getitem__ (lookup by key with [])

  • __iter__ (iteration, use in for-loops for example)

  • __len__ (has a length, can be passed to len)

as well as:

tiled.client.container.Container.get(k[,d])

tiled.client.container.Container.keys()

tiled.client.container.Container.items()

tiled.client.container.Container.values()

The views returned by .keys(), .items(), and .values() support efficient random access—e.g.

c.values()[3]
c.values()[-1]
c.values()[:3]

and several convenience methods:

tiled.iterviews.ValuesView.first()

Get the first value.

tiled.iterviews.ValuesView.last()

Get the last value.

tiled.iterviews.ValuesView.head([n])

Get the first N values.

tiled.iterviews.ValuesView.tail([n])

Get the last N values.

Likewise for .keys() and .items().

Beyond the Mapping interface, Container adds the following attributes

tiled.client.container.Container.metadata

Metadata about this data source.

tiled.client.container.Container.sorting

The current sorting of this Node

tiled.client.container.Container.uri

Direct link to this entry

tiled.client.container.Container.specs

List of specifications describing the structure of the metadata and/or data.

It adds these methods, which return a new Container instance.

tiled.client.container.Container.search(query)

Make a Node with a subset of this Node's entries, filtered by query.

tiled.client.container.Container.sort(*sorting)

Make a Node with the same entries but sorted according to sorting.

It adds this method, which returns the unique metadata keys, structure_families, and specs of its children along with their counts.

tiled.client.container.Container.distinct(...)

Get the unique values and optionally counts of metadata_keys, structure_families, and specs in this Node's entries

And, finally, there are convenience methods for writing:

tiled.client.container.Container.create_container([...])

EXPERIMENTAL: Create a new, empty container.

tiled.client.container.Container.write_array(...)

EXPERIMENTAL: Write an array.

tiled.client.container.Container.write_awkward(...)

Write an AwkwardArray.

tiled.client.container.Container.write_dataframe(...)

EXPERIMENTAL: Write a DataFrame.

tiled.client.container.Container.write_sparse(...)

EXPERIMENTAL: Write a sparse array.

and a low-level method for creating a new node to write into:

tiled.client.container.Container.new(...[, ...])

Create a new item within this Node.

Structure Clients

For each structure family (“array”, “table”, etc.) there is a client object that understand how to request and decode chunks/partitions of data for this structure.

In fact, there can be more than one client for a given structure family. Tiled currently includes two clients for each structure family:

  • A client that reads the data into dask-backed objects (dask array, dask DataFrame, xarray objects backed by dask arrays)

  • A client that reads the data into in-memory structures (numpy array, pandas DataFrame, xarray objects backed by numpy arrays)

Base

tiled.client.base.BaseClient(context, *, ...)

tiled.client.base.BaseClient.formats

List formats that the server can export this data as.

tiled.client.base.BaseClient.metadata

Metadata about this data source.

tiled.client.base.BaseClient.metadata_copy()

Generate a mutable copy of metadata and specs for validating metadata (useful with update_metadata())

tiled.client.base.BaseClient.replace_metadata([...])

EXPERIMENTAL: Replace metadata entirely (see update_metadata).

tiled.client.base.BaseClient.update_metadata([...])

EXPERIMENTAL: Update metadata via a dict.update- like interface.

tiled.client.base.BaseClient.patch_metadata([...])

EXPERIMENTAL: Patch metadata using a JSON Patch (RFC6902).

tiled.client.base.BaseClient.build_metadata_patches([...])

Build valid JSON Patches (RFC6902) for metadata and metadata validation specs accepted by patch_metadata.

tiled.client.base.BaseClient.uri

Direct link to this entry

tiled.client.base.BaseClient.structure_family

Quick access to this entry

tiled.client.base.BaseClient.item

JSON payload describing this item.

tiled.client.base.BaseClient.login([...])

Depending on the server's authentication method, this will prompt for username/password:

tiled.client.base.BaseClient.logout([...])

Log out.

tiled.client.base.BaseClient.new_variation([...])

This is intended primarily for internal use and use by subclasses.

tiled.client.base.BaseClient.specs

List of specifications describing the structure of the metadata and/or data.

tiled.client.base.BaseClient.structure()

Return a dataclass describing the structure of the data.

Array

tiled.client.array.DaskArrayClient(*args, ...)

Client-side wrapper around an array-like that returns dask arrays

tiled.client.array.DaskArrayClient.read_block(block)

Access the data for one block of this chunked (dask) array.

tiled.client.array.DaskArrayClient.read([slice])

Access the entire array or a slice.

tiled.client.array.DaskArrayClient.export(...)

Download data in some format and write to a file.

tiled.client.array.DaskArrayClient.write(array)

tiled.client.array.DaskArrayClient.write_block(...)

tiled.client.array.DaskArrayClient.patch(...)

Write data into a slice of an array, maybe extending the shape.

tiled.client.array.ArrayClient(*args, item, ...)

Client-side wrapper around an array-like that returns in-memory arrays

tiled.client.array.ArrayClient.read_block(block)

Access the data for one block of this chunked array.

tiled.client.array.ArrayClient.read([slice])

Acess the entire array or a slice.

tiled.client.array.ArrayClient.export(...[, ...])

Download data in some format and write to a file.

tiled.client.array.ArrayClient.write(array)

tiled.client.array.ArrayClient.write_block(...)

Awkward

tiled.client.awkward.AwkwardClient(context, ...)

tiled.client.awkward.AwkwardClient.read([slice])

tiled.client.awkward.AwkwardClient.write(...)

tiled.client.awkward.AwkwardClient.export(...)

Download data in some format and write to a file.

tiled.client.array.ArrayClient(*args, item, ...)

Client-side wrapper around an array-like that returns in-memory arrays

tiled.client.array.ArrayClient.read_block(block)

Access the data for one block of this chunked array.

tiled.client.array.ArrayClient.read([slice])

Acess the entire array or a slice.

tiled.client.array.DaskArrayClient.export(...)

Download data in some format and write to a file.

Sparse Array

tiled.client.sparse.SparseClient(context, *, ...)

tiled.client.sparse.SparseClient.read([slice])

tiled.client.sparse.SparseClient.export(...)

Download data in some format and write to a file.

tiled.client.sparse.SparseClient.write(...)

tiled.client.sparse.SparseClient.write_block(...)

DataFrame

tiled.client.dataframe.DaskDataFrameClient(...)

Client-side wrapper around an dataframe-like that returns dask dataframes

tiled.client.dataframe.DaskDataFrameClient.read_partition(...)

Access one partition in a partitioned (dask) dataframe.

tiled.client.dataframe.DaskDataFrameClient.read([...])

Access the entire DataFrame.

tiled.client.dataframe.DaskDataFrameClient.export(...)

Download data in some format and write to a file.

tiled.client.dataframe.DaskDataFrameClient.write(...)

tiled.client.dataframe.DaskDataFrameClient.write_partition(...)

tiled.client.dataframe.DataFrameClient(...)

Client-side wrapper around a dataframe-like that returns in-memory dataframes

tiled.client.dataframe.DataFrameClient.read_partition(...)

Access one partition of the DataFrame.

tiled.client.dataframe.DataFrameClient.read([...])

Access the entire DataFrame.

tiled.client.dataframe.DataFrameClient.export(...)

Download data in some format and write to a file.

tiled.client.dataframe.DataFrameClient.write(...)

tiled.client.dataframe.DataFrameClient.write_partition(...)

Xarray Dataset

tiled.client.xarray.DaskDatasetClient(...[, ...])

tiled.client.xarray.DaskDatasetClient.read([...])

tiled.client.xarray.DatasetClient(context, ...)

tiled.client.xarray.DatasetClient.read([...])

Context

tiled.client.context.Context(uri, *[, ...])

Wrap an httpx.Client with an optional cache and authentication functionality.

tiled.client.context.Context.from_any_uri(uri, *)

Accept a URI to a specific node.

tiled.client.context.Context.from_app(app, *)

Construct a Context around a FastAPI app.

tiled.client.context.Context.authenticate([...])

See login.

tiled.client.context.Context.cache

tiled.client.context.Context.force_auth_refresh()

Execute refresh flow.

tiled.client.context.Context.login([...])

Depending on the server's authentication method, this will prompt for username/password:

tiled.client.context.Context.logout([...])

Log out of the current session (if any).

tiled.client.context.Context.tokens

A view of the current access and refresh tokens.

Cache

tiled.client.cache.Cache([filepath, ...])

tiled.client.cache.Cache.capacity

Max capacity in bytes.

tiled.client.cache.Cache.clear()

Drop all entries from HTTP response cache.

tiled.client.cache.Cache.close()

Close cache.

tiled.client.cache.Cache.count()

Number of responses cached

tiled.client.cache.Cache.delete(request)

Delete an entry from cache.

tiled.client.cache.Cache.filepath

Filepath of SQLite database storing cache data

tiled.client.cache.Cache.get(request)

Get cached response from Cache.

tiled.client.cache.Cache.max_item_size

Max size of a response body eligible for caching.

tiled.client.cache.Cache.readonly

If True, cache be read but not updated.

tiled.client.cache.Cache.set(*, request, ...)

Set new response entry in cache.

tiled.client.cache.Cache.size()

Size of response bodies in bytes (does not count headers and other auxiliary info)

tiled.client.cache.Cache.write_safe()

Check that it is safe to write.

Sync

tiled.client.sync.copy(source, dest[, ...])

Copy data from one Tiled instance to another.