Skip to main content

fw-dataset

fw-dataset provides the classes and functions used to create, manage, and serve Flywheel Datasets — a way to organize, share, and query data derived from the Flywheel Data Model.

[!WARNING] This package is under active development and should be considered unstable. It is provided as-is, with no guarantee of support or maintenance at this stage. Features may be incomplete, change without notice, or be removed in future versions. Use it at your own risk, for experimental or development purposes only.

Overview

A Flywheel Dataset is a versioned, columnar snapshot of a Flywheel project's data, stored in cloud or local object storage and queryable with standard tabular tools. The package exposes three primary entry points:

  • DatasetBuilder — renders a dataset from a Flywheel project snapshot.
  • FWDatasetClient — accesses, queries, and manages existing datasets.
  • Dataset / Table — object models representing a dataset and its tables.

Documentation

The Dataset Definition document is the authoritative reference for the dataset format. It covers:

Installation

fw-dataset requires Python 3.12 or later. Install it with pip:

pip install fw-dataset

Usage

Rendering datasets

Use DatasetBuilder to render a Flywheel dataset from a project. See notebooks/quickstart_dataset_creation.ipynb for a complete walkthrough.

Accessing and managing datasets

Use FWDatasetClient to access and query an existing dataset. See notebooks/quickstart_dataset_management.ipynb for a complete walkthrough.

Working with unassociated datasets

A valid dataset that is not associated with a Flywheel project can still be accessed directly. Provide the type, bucket, prefix, and credentials of the cloud or local filesystem to instantiate and query it — no API key or client instantiation required:

from fw_dataset import FWDatasetClient

fs_type = "s3"  # or "gcs", "azure", "fs", "local"
bucket = "your-bucket"
prefix = "your-prefix"
credentials = {"url": "{bucket-specific-credential-string}"}

dataset = FWDatasetClient.get_dataset_from_filesystem(fs_type, bucket, prefix, credentials)

Merging related datasets

Multiple datasets with related tables can be merged into a single dataset so their tables can be queried together.

[!NOTE] Federated querying across datasets is not yet enabled; this is a work in progress.

Merging requires that both datasets satisfy the following:

  1. A valid tables directory structure.

  2. A valid schemas directory structure, where:

    • every table in tables has a corresponding schema file in schemas;

    • each schema file is named {table_name}.schema.json; and

    • each schema file is valid JSON with at least the following structure:

      {
          "schema": "http://json-schema.org/draft-07/schema#",
          "id": "{table_name}",
          "description": "",
          "properties": {},
          "required": [],
          "type": "object"
      }
      
  3. Tables and schemas selected from the source must not share names with existing tables or schemas in the destination.

Once these requirements are met, merge the datasets by copying or moving the selected tables and schemas from the source dataset into the destination dataset.

Flywheel project requirements

For the Flywheel Dataset client and the Dataset objects to function, a project must provide valid custom-information metadata and a well-formed storage layout.

Project metadata

The Flywheel project must carry the following custom information:

{
    "dataset": {
        "type": "s3",
        "bucket": "{bucket-name}",
        "prefix": "{path/to/dataset}",
        "storage_id": "storage-id-of-fw-storage-object"
    }
}
Field Description
type Storage backend: s3, gcs, azure, or fs/local.
bucket Name of the bucket or container holding the dataset.
prefix Path to the dataset within the bucket or container.
storage_id Flywheel ID of the storage record for the bucket or filesystem.

The directory structure beneath prefix must follow the Dataset structure described below.

Dataset structure

A dataset is stored beneath its prefix with the following layout:

{bucket}/{prefix}/
└── versions/
    └── {version}/
        ├── provenance/
        │   ├── dataset_description.json
        │   ├── snapshot.db.gz
        │   ├── snapshot_info.json
        │   └── project.json
        ├── tables/
        │   └── {table_name}/
        │       └── {hash}.parquet
        └── schemas/
            └── {table_name}.schema.json

Each version lives in its own subdirectory, named with its version identifier (typically a BSON ID such as 66cf6701af1c6f3855f1ee61). The "latest" version is determined dynamically by comparing the creation dates recorded in each version's dataset_description.json.

This layout is described more completely in the Dataset definition document.

Schema files

Schema files describe the schema of each table and live in the schemas directory. Each is named {table_name}.schema.json. Schemas should ideally be fully descriptive, but a minimal schema is sufficient to make a table queryable:

{
    "schema": "http://json-schema.org/draft-07/schema#",
    "id": "{table_name}",
    "description": "Table derived from tabular data file: conditions.csv",
    "properties": {},
    "required": [],
    "type": "object"
}

Metadata

Release files for fw-dataset 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for fw-dataset 0.4.3
File Interpreter ABI Platform
fw_dataset-0.4.3-py3-none-any.whl Python 3 none any Details

Release files / fw_dataset-0.4.3-py3-none-any.whl

Download URL fw_dataset-0.4.3-py3-none-any.whl
Size 59.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43a5477be30f9c7d927278910e8ac70049e6715d54ba649d319f56319460a835
BLAKE2b-256 checksum
How to use checksums
35ca6aab61cf883408103d34d5181547922748f6273a55175c8b85428260a8d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.25.0_alpha20260805","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.4.3 This release

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.3

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page