This guide explains the fundamental concepts behind Quiltโs data management system. Think of it as your roadmap to understanding how Quilt organizes, versions, and manages data.
Quilt treats data like code - with versioning, immutability, and collaboration built-in. Instead of managing individual files scattered across storage systems, you work with packages that bundle related data together with metadata and provenance.
Traditional Approach โ Quilt Approach
โโโ file1.csv ๐ฆ myteam/customer-data
โโโ file2.json โโโ ๐ customers.csv
โโโ file3.parquet โโโ ๐ transactions.json
โโโ README.txt โโโ ๐ analytics.parquet
โโโ ๐ README.md
โโโ ๐ท๏ธ metadata + version hash
A package is Quiltโs fundamental unit of data organization. Think of it as a versioned, immutable collection of related files with a clear identity and history.
Key Properties:
myteam/customer-analyticsEvery package consists of:
๐ฆ Package: myteam/customer-data
โโโ ๐ท๏ธ Name: "myteam/customer-data"
โโโ ๐ Hash: "a1b2c3d4..." (unique version identifier)
โโโ ๐ Manifest: (maps logical โ physical locations)
โโโ ๐ Files:
โ โโโ customers.csv
โ โโโ transactions.json
โ โโโ README.md
โโโ ๐ Metadata: {"description": "Q3 customer analysis", "version": "2.1"}
import quilt3
# Load a package (using public example)
pkg = quilt3.Package.browse("examples/hurdat", "s3://quilt-example")
# Package info
print(f"Package hash: {pkg.top_hash}") # Unique version identifier
print(f"Files: {len(pkg)}") # Number of files in package
# List available files
for key in pkg:
print(f"File: {key}")
The manifest is Quiltโs โtable of contentsโ - it maps user-friendly names to actual file locations and includes integrity information.
Manifest Entry Structure:
(LOGICAL_KEY, PHYSICAL_KEYS, HASH, METADATA)
| Aspect | Logical Key | Physical Key |
|---|---|---|
| Purpose | User-friendly name | Actual storage location |
| Example | "data/customers.csv" |
"s3://bucket/a1b2c3/customers.csv?versionId=xyz" |
| Stability | Stable across versions | Changes with storage |
| Usage | Code references | Internal system use |
{
"logical_key": "data/customers.csv",
"physical_keys": [
"s3://company-data/datasets/customers_v2.csv?versionId=abc123"
],
"size": 1048576,
"hash": {
"type": "SHA256",
"value": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"meta": {
"schema_version": "2.1",
"last_updated": "2024-08-26",
"data_quality": "validated"
}
}
Why This Matters:
A registry is where Quilt stores package manifests and optionally the data itself. Think of it as a โdatabaseโ of packages.
Supported Registry Types:
import quilt3
# Different registry types
local_packages = quilt3.list_packages() # Local registry
cloud_packages = quilt3.list_packages("s3://my-bucket") # S3 registry
public_data = quilt3.list_packages("s3://quilt-example") # Public registry
In Quilt, S3 buckets function like Git branches - each represents a different stage or environment in your data lifecycle.
Git Workflow โ Quilt Workflow
โโโ feature-branch โโโ s3://dev-bucket
โโโ develop โโโ s3://staging-bucket
โโโ staging โโโ s3://prod-bucket
โโโ main โโโ s3://archive-bucket
graph LR
A[Raw Data] --> B[s3://company-raw]
B --> C[s3://company-staging]
C --> D[s3://company-prod]
D --> E[s3://company-archive]
B -.-> F[Data Validation]
C -.-> G[Quality Assurance]
D -.-> H[Production Use]
Three-Bucket Minimum:
s3://company-raw)
s3://company-staging)
s3://company-prod)
# Promote a package through environments
import quilt3
# 1. Start in raw environment
raw_pkg = quilt3.Package()
raw_pkg.set("data.csv", "raw_data.csv")
raw_pkg.push("myteam/dataset", registry="s3://company-raw")
# 2. Validate and promote to staging
staging_pkg = quilt3.Package.browse("myteam/dataset", registry="s3://company-raw")
# ... perform validation ...
staging_pkg.push("myteam/dataset", registry="s3://company-staging")
# 3. Final promotion to production
prod_pkg = quilt3.Package.browse("myteam/dataset", registry="s3://company-staging")
# ... final checks ...
prod_pkg.push("myteam/dataset", registry="s3://company-prod")
Immutable packages mean that once created, a package version never changes. This provides:
# Working with package versions
import quilt3
# Get latest version (using public example)
latest = quilt3.Package.browse("examples/hurdat", "s3://quilt-example")
print(f"Latest hash: {latest.top_hash}")
# Get specific version
specific = quilt3.Package.browse("examples/hurdat", "s3://quilt-example", top_hash=latest.top_hash)
print(f"Specific version")
# Compare versions
if latest.top_hash == specific.top_hash:
print("Same version")
| If youโre familiar withโฆ | Think of Quilt asโฆ |
|---|---|
| Git | Git for data - versioning, branching (buckets), immutable commits (packages) |
| Docker | Container images for data - immutable, portable, with manifests |
| Package Managers | npm/pip for datasets - named packages, versions, dependencies |
| Databases | Schema-aware data warehouse with built-in versioning and lineage |
Now that you understand Quiltโs mental model:
Remember: Quilt transforms chaotic data management into organized, versioned, collaborative workflows. The mental model is simple - treat your data like code, and Quilt handles the complexity!