Tables

Pixeltable is built around tables, but with a twist. Instead of solely storing your data, Pixeltable tables act as paltform for your entire AI workflow.

In Pixeltable, the table takes on a new role - it becomes the center for your entire AI development process. This data-centric approach simplifies how you manage, manipulate, and interact with raw data to trained models and everything in between.

What are Tables?

A Pixeltable table is a structured data container, similar to a traditional database table. However, Pixeltable tables are designed specifically for AI workloads, offering unique advantages:

  • Flexible Storage: Tables can store a variety of data types, from standard database types (integers, floats, strings) to AI-specific types like image references, embeddings, and JSON-structured annotations.
  • Computed Columns: These columns allow you to define transformations, feature engineering, model inference, or any custom logic directly within the table. Pixeltable automatically computes and caches the results, making data updates and iteration much faster.
  • Lineage Tracking: Every operation performed on a table is recorded automatically, creating a transparent audit trail of how your data and models evolved. This is invaluable for debugging, reproducibility, and collaboration.

Key Operations:

Pixeltable provides a familiar DataFrame-like API for interacting with your tables. Here's a quick overview of common operations:

ActionDescriptionExample
Create a tableDefine the table schema with named columns and their data types.pxt.create_table('animals', {'name': pxt.StringType(), 'num_legs': pxt.IntType()})
Insert rowsAdd one or more rows of data to the table.table.insert([{'name': 'cat', 'num_legs': 4}, {'name': 'bird', 'num_legs': 2}])
Query a table (select)Retrieve specific columns based on filter conditions.table.select(table.name).where(table.num_legs > 2)
Update a tableModify specific values in existing rows based on filter conditions.table.update({'num_legs': 0}).where(table.name == 'snake')
Add/drop columnsModify the structure of the table by adding or removing columns.table.add_column('num_wings', pxt.IntType())
Describe tableShow summary statistics for all columns in the table.table.describe()

See the Table class API Reference for more information: https://pixeltable.github.io/pixeltable/api/table/ and our API Cheat Sheet: https://pixeltable.github.io/pixeltable/api-cheat-sheet/

Example

# Create a table with animal data
animals_table = pxt.create_table('animals', {'species': pxt.StringType(), 'weight': pxt.FloatType()})

# Insert some rows
animals_table.insert([{'species': 'dog', 'weight': 15.5}, {'species': 'elephant', 'weight': 5000}])

# Show the table
animals_table.show()

Explore more ways to work with Pixeltable: https://pixeltable.readme.io/docs/pixeltable-basics

Key Takeaways

  • Pixeltable tables provide a flexible, unified interface for working with your AI data.
  • You can easily create and modify tables, insert and query data, and build complex workflows within this structure.
  • Pixeltable's automatic lineage and versioning ensure reproducibility and transparency throughout your experimentation process.