Import/Export from SQL Databases

Send and receive data from PostgreSQL, SQLite, MySQL, TigerData, or Snowflake for use in external applications.

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.

What it covers

  • Export entire tables or filtered queries to any SQL database
  • Importing exported data back into Pixeltable
  • Select specific columns for export
  • Handle existing tables with replace or append options
  • Connect to cloud PostgreSQL services (e.g. TigerData)

What it uses

Install
terminal
pip install pixeltable snowflake-sqlalchemy
Pixeltable calls
pxt.create_table()insert()add_computed_column()

A look at the code

data-export-sql.ipynb
# Create a table with images
images = pxt.create_table(
'sql_export_demo/images', {'image': pxt.Image, 'label': pxt.String}
)
# Add computed columns for metadata
images.add_computed_column(width=images.image.width)
images.add_computed_column(height=images.image.height)
images.add_computed_column(mode=images.image.mode)

One cell of the notebook, copied as it is. Open it in Colab for the rest.

Browse all 103