Import/Export from SQL Databases
Send and receive data from PostgreSQL, SQLite, MySQL, TigerData, or Snowflake for use in external applications.
Convert Pixeltable data to PyTorch DataLoader format for model training.
Data Import/Export · Notebook · Updated
Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.
You use query.to_pytorch_dataset() to create an iterable dataset compatible with PyTorch DataLoader.
pip install pixeltable torch torchvision
pxt.create_table()insert()add_computed_column()to_pytorch_dataset()# Add a resize step to ensure all images have the same sizetraining_data.add_computed_column(image_resized=training_data.image.resize((224, 224)))# Convert to PyTorch dataset# 'pt' format returns images as CxHxW tensors with values in [0,1]pytorch_dataset = training_data.select(training_data.image_resized, training_data.label).to_pytorch_dataset(image_format='pt')
One cell of the notebook, copied as it is. Open it in Colab for the rest.
Send and receive data from PostgreSQL, SQLite, MySQL, TigerData, or Snowflake for use in external applications.
Export Pixeltable tables and queries to CSV, JSON, and Apache Iceberg for spreadsheets, scripts, and the lakehouse.
Create training, validation, and test splits with random or stratified sampling.
Load data from CSV and Excel files into Pixeltable tables for processing and analysis.