Skip to content

Database Schema

Sergio Soto edited this page Apr 8, 2026 · 2 revisions

Database Schema

One table auto-created in VAST DataBase on first invocation, in the same schema as exr-inspector.

Location: sergio-db bucket / exr_metadata_2 schema / proxy_outputs table

proxy_outputs

Column Type Description
proxy_id STRING UUID for this proxy record
file_id STRING FK to exr-inspector files.file_id (same computation)
s3_key STRING Source S3 object key
s3_bucket STRING Source S3 bucket
asset_id STRING Derived asset identifier (MD5 of s3_key, 16 chars)
thumbnail_s3_key STRING S3 key for generated thumbnail (.proxies/ prefix)
proxy_s3_key STRING S3 key for generated proxy (.proxies/ prefix)
thumbnail_size_bytes INT64 Thumbnail file size
proxy_size_bytes INT64 Proxy file size
source_size_bytes INT64 Original source file size
source_colorspace STRING Detected source color space (e.g., linear, sRGB)
thumb_colorspace STRING Target: sRGB
proxy_colorspace STRING Target: Rec709
thumb_resolution STRING "256x256"
proxy_resolution STRING "1920x1080"
processing_time_seconds FLOAT64 Total processing time
generated_timestamp STRING ISO 8601 UTC
generator_version STRING oiio-proxy-generator version

file_id Computation

Must match exr-inspector exactly for JOINs:

file_id = SHA256(s3_key + mtime + MD5(s3_key))[:16]

Both functions compute the same file_id independently from the same source file. No coordination needed.

Relationship to exr-inspector

exr_metadata_2 schema
  |
  +-- files          (exr-inspector)   <-- file_id PK
  +-- parts          (exr-inspector)   <-- file_id FK
  +-- channels       (exr-inspector)   <-- file_id FK
  +-- attributes     (exr-inspector)   <-- file_id FK
  +-- proxy_outputs  (this function)   <-- file_id FK

Example Queries (VastDB SDK)

Get proxy info for a file

with session.transaction() as tx:
    table = tx.bucket("sergio-db").schema("exr_metadata_2").table("proxy_outputs")
    reader = table.select(
        columns=["proxy_s3_key", "proxy_size_bytes", "source_colorspace"],
        predicate=ibis.literal("renders/shot_010/beauty.0001.exr") == ibis._["s3_key"],
    )
    print(reader.read_all())

Generate presigned URL for SpaceHarbor (Fastify backend)

# After querying proxy_s3_key from VastDB:
proxy_key = "renders/shot_010/.proxies/beauty.0001_proxy.mp4"
presigned_url = s3_client.generate_presigned_url(
    "get_object",
    Params={"Bucket": "sergio-spaceharbor", "Key": proxy_key},
    ExpiresIn=3600,
)

JOIN proxy with exr-inspector metadata

with session.transaction() as tx:
    schema = tx.bucket("sergio-db").schema("exr_metadata_2")
    files = schema.table("files")
    proxies = schema.table("proxy_outputs")

    file_reader = files.select(
        columns=["file_id", "file_path", "size_bytes"],
        predicate=ibis.literal("renders/shot_010/beauty.0001.exr") == ibis._["file_path"],
    )
    file_row = file_reader.read_all()
    fid = file_row.column("file_id")[0].as_py()

    proxy_reader = proxies.select(
        columns=["proxy_s3_key", "thumbnail_s3_key", "processing_time_seconds"],
        predicate=ibis.literal(fid) == ibis._["file_id"],
    )
    print(proxy_reader.read_all())

Auto-Provisioning

Table is created on first init() call using get-or-create pattern. Safe to call from multiple pods concurrently. Only creates proxy_outputs -- does not touch exr-inspector's tables.

Clone this wiki locally