This documentation page is also available as an interactive notebook. You can launch the notebook in
Kaggle or Colab, or download it for use with an IDE or local Jupyter installation, by clicking one of the
above links.
This tutorial demonstrates how to configure Pixeltable to use
Tigris for storage. This lets you store
unlimited amounts of images in Tigris’ global data plane, allowing your
images to load fast everywhere.
Prerequisites
Important notes
- Tigris usage may incur costs based on your plan.
- Be mindful of sensitive data and consider security measures when
integrating with external services.
First you need to install required libraries and enter a Tigris access
keypair obtained via the Tigris Admin Console.
Set up environment
First, let’s install Pixeltable:
These steps will have you enter in your Tigris credentials:
Create a table for images
Now let’s create a table that will contain images from the
XeIaso/botw-screenshots-captioned
dataset:
Created directory ‘tigris’.
Created table ‘screenshots’.
Inserting rows into `screenshots`: 100 rows [00:01, 51.72 rows/s]
Inserting rows into `screenshots`: 100 rows [00:01, 55.57 rows/s]
Inserting rows into `screenshots`: 100 rows [00:01, 52.74 rows/s]
Inserting rows into `screenshots`: 100 rows [00:02, 33.96 rows/s]
Inserting rows into `screenshots`: 100 rows [00:02, 42.64 rows/s]
Inserting rows into `screenshots`: 100 rows [00:02, 39.65 rows/s]
Inserting rows into `screenshots`: 100 rows [00:02, 47.36 rows/s]
Inserting rows into `screenshots`: 28 rows [00:00, 6786.12 rows/s]
Inserted 728 rows with 0 errors.
Once the import is done, you can create thumbnails with a computed
column:
Added 728 column values with 0 errors.
728 rows updated, 728 values computed.
And then inspect that with the collect method:
Getting URLs for your files
When your files are in object storage, you can get URLs that point
directly to them. These URLs work in HTML, APIs, or any application you
need to serve media with. Fetch them with the .fileurl property:
Generating Presigned URLs
For private buckets or when you need time-limited access to files, use
presigned URLs. These are temporary, authenticated URLs that allow
anyone to access your files for a limited time without needing
credentials.
Use the presigned_url function from pixeltable.functions.net:
Common expiration times
What you learned
- When you configure Pixeltable to use Tigris to store images, adding
images transparently uploads them into Tigris for global distribution.
- You can override where images are stored in Tigris using the
destination= kwarg when creating computed columns.
- Use the
.fileurl property in queries to get URLs for your stored
files.
- Use
net.presigned_url() to generate time-limited, authenticated URLs
for private bucket access.
Pixeltable handles everything else for you.
Next steps
Additional Resources