tiled.adapters.excel.ExcelAdapter

class tiled.adapters.excel.ExcelAdapter(mapping, *, metadata=None, specs=None, sorting=None, access_policy=None, principal=None, entries_stale_after=None, metadata_stale_after=None, must_revalidate=True)[source]

Read the sheets in an Excel file.

This maps the Excel file, which may contain one of more spreadsheets, onto a tree of tabular structures.

Examples

Given a file path

>>> ExcelAdapter.from_file("path/to/excel_file.xlsx")

Given a file object

>>> file = open("path/to/excel_file.xlsx")
>>> ExcelAdapter.from_file(file)

Given a pandas.ExcelFile object

>>> import pandas
>>> ef = pandas.ExcelFile(file)
>>> ExcelAdapter.from_file(ef)
__init__(mapping, *, metadata=None, specs=None, sorting=None, access_policy=None, principal=None, entries_stale_after=None, metadata_stale_after=None, must_revalidate=True)

Create a simple Adapter from any mapping (e.g. dict, OneShotCachedMap).

Parameters
mappingdict-like
metadatadict, optional
specsList[str], optional
sortingList[Tuple[str, int]], optional
access_policyAccessPolicy, optional
principalstr, optional
entries_stale_after: timedelta

This server uses this to communite to the client how long it should rely on a local cache before checking back for changes.

metadata_stale_after: timedelta

This server uses this to communite to the client how long it should rely on a local cache before checking back for changes.

must_revalidatebool

Whether the client should strictly refresh stale cache items.

Methods

__init__(mapping, *[, metadata, specs, ...])

Create a simple Adapter from any mapping (e.g.

authenticated_as(principal)

from_file(file[, specs])

get(k[,d])

get_distinct(metadata, structure_families, ...)

items()

keys()

new_variation(*args[, mapping, metadata, ...])

read([fields])

register_query(class_, translator)

register_query_lazy(toplevel, register)

Register a registration function which will be called if the toplevel module (e.g.

search(query)

Return a Adapter with a subset of the mapping.

sort(sorting)

values()

Attributes

background_tasks

entries_stale_after

include_routers

metadata_stale_after

specs

access_policy

entries_stale_at

items_indexer

keys_indexer

metadata

Metadata about this Adapter.

metadata_stale_at

must_revalidate

principal

query_registry

sorting

structure_family

values_indexer