Querying Data
Deeplake provides a powerful query language called TQL (Table Query Language) that allows you to query datasets in a SQL-like manner.
Full documentation on TQL syntax can be found here.
Single-Dataset Query
deeplake.Dataset.query
query(query: str) -> DatasetView
Executes the given TQL query against the dataset and return the results as a deeplake.DatasetView.
Examples:
deeplake.Dataset.query_async
query_async(query: str) -> Future
Asynchronously executes the given TQL query against the dataset and return a future that will resolve into deeplake.DatasetView.
Examples:
Cross-Dataset Query
deeplake.query
query(query: str, token: str | None = None) -> DatasetView
Executes the given TQL query and returns a DatasetView.
Compared to deeplake.Dataset.query, this version of query can join multiple datasets together or query a single dataset without opening it first.
Examples:
deeplake.query_async
query_async(query: str, token: str | None = None) -> Future
Custom TQL Functions
deeplake.tql.register_function
Registers the given function in TQL, to be used in queries.
TQL interacts with Python functions through numpy.ndarray
. The Python function
to be used in TQL should accept input arguments as numpy arrays and return numpy array.
Examples: