Learn how to query and transform data in Pixeltable using where() and select()
Learn more about queries and expressions with this in-depth guide.
Queries in Pixeltable allow you to filter, transform, and extract data from tables and views. Using Pixeltable’s expressive query interface, you can build powerful data pipelines without writing complex SQL or using external transformation tools.
Pixeltable queries use a fluent API design where operations can be chained together to:
where()
select()
order_by()
limit()
Queries don’t execute until you call collect()
, making them efficient for complex operations. You can build queries incrementally, adding conditions and transformations as needed.
This guide builds on tables created in previous sections. The movies
table from Tables
Use where()
to filter rows based on basic conditions:
title | year | budget |
---|---|---|
Titanic | 1997 | 200.0 |
Avengers: Endgame | 2019 | 356.0 |
Text Filtering
Work with string data in movie plots:
Multiple Conditions
Combine conditions with &
(and), |
(or):
Sorting Results
Use order_by()
to sort results:
Analyze plot text and titles:
Budget calculations and comparisons:
Combine multiple operations:
Access columns using dot notation (movies.title
).
Combine where()
, select()
, order_by()
, and limit()
in any order.
Use &
(and), |
(or), and ~
(not) for complex conditions.
Transform data during selection with mathematical and string operations.
Build complex queries incrementally by starting with basic filters and adding operations one at a time. This makes debugging easier and helps ensure your query returns the expected results.