tiled
0.1.0a65

Tutorials

  • Installation
  • Navigate with the Python Client
  • Load Slices of Data
  • Keep a Local Copy
  • Deliberate Export
  • Log into an Authenticated Tiled Server
  • Serve a Directory of Files
  • Search
    • Search Using the Python Client
    • Roadmap
  • Plot Data in Plotly Chart Studio

How To Guides

  • Use Performance and Debug Logging
  • Serve Data using Configuration Files
  • Add Custom Export Formats
  • Use Profiles to streamline Python client setup
  • Create and Use API Keys
  • Use Tiled in Python without an HTTP server
  • Tune Caches to Balance Speed and Memory Usage
  • Run Tiled using Docker
  • Set up a database for a scaled authenticated deloyment

Explanations

  • Standards Used by Tiled
  • Structures
  • Security
  • Compression
  • Reading and Exporting Specialized Formats
  • Caching Design and Roadmap
  • Access Control
  • Scaling Tiled Down
  • FAQ
  • How Tiled Fits into the Ecosystem

Reference

  • Service-side Components
  • HTTP API
  • Python Client
  • Queries
  • Authentication Details
  • Scopes
  • Command-line tool
  • Service Configuration Reference
  • Client Profiles Reference
  • Release History
  • Minimum Version of Python and NumPy
tiled
  • »
  • Search
  • View page source

Search¶

In this tutorial we will find a dataset in a Node by performing a search over the entries’ metadata.

To follow along, start the Tiled server with example data from a Terminal.

tiled serve pyobject --public tiled.examples.generated:tree

Search Using the Python Client¶

Now, in a Python interpreter, connect with the Python client.

from tiled.client import from_uri

client = from_uri("http://localhost:8000/api")

Tiled has an extensible collection of queries. The client just has to construct the query, and server sorts out how to execute it as efficiently as possible given however the metadata and data are stored.

This example collection of data has several entries with metadata.

>>> client['short_table'].metadata
DictView({'animal': 'dog', 'color': 'red'})

>>> client['long_table'].metadata
DictView({'animal': 'dog', 'color': 'green'})

>>> client['structured_data'].metadata
DictView({'animal': 'cat', 'color': 'green'})

# etc.

We’ll search among them for entries where the term "dog" appears anywhere in the metadata.

>>> from tiled.queries import FullText

>>> client.search(FullText("dog"))
<Node {'short_table', 'long_table'}>

The result is another client, with a subset of the entries or the original. We might next stash it in a variable and drill further down.

>>> results = client.search(FullText("dog"))
>>> results['short_table']
<DataFrameClient>

Searches may be chained:

>>> client.search(FullText("dog")).search(FullText("red"))
<Node {'short_table'}>

If there no matches, the result is an empty Node:

>>> client.search(FullText("something that will not be found"))
<Node {}>

Roadmap¶

Currently, FullText is the only outwardly-useful query supported. More will be added, as well as documentation on how to register user-defined ones.

Previous Next

© Copyright 2021, Bluesky Collaboration.

Built with Sphinx using a theme provided by Read the Docs.