Skip to content
Back to skills

Create Datasets

ASecurity

"Routes Petastorm dataset creation, schema design, metadata repair,

  • 247 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 8, 2026
toolsapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill create-datasets --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Create Datasets?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Create Datasets
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-create-datasets/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-create-datasets)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: "create-datasets"
description: "Routes Petastorm dataset creation, schema design, metadata repair,
  copy-and-filter workflows, and row-group indexing from Spark and existing
  Parquet data."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# Create Datasets

Use this route when the task starts from raw rows, a Spark DataFrame, or an existing Parquet store that needs Petastorm metadata,
copying, filtering, schema repair, or row-group indexing.

## Typical triggers

- "How do I create a Petastorm dataset?"
- "How do I define a schema or codec?"
- "How do I copy and filter an existing dataset?"
- "How do I regenerate Petastorm metadata?"
- "How do I build row-group indexes?"
- "How do I use the copy or metadata console tools?"

## What belongs here

- `Unischema` and `UnischemaField`
- `ScalarCodec`, `NdarrayCodec`, `CompressedNdarrayCodec`, `CompressedImageCodec`
- `dict_to_spark_row`
- `materialize_dataset`
- `get_schema` and `get_schema_from_dataset_url`
- `copy_dataset`
- `generate_petastorm_metadata`
- `build_rowgroup_index`
- `SingleFieldIndexer` and `FieldNotNullIndexer`
- filesystem URL resolution used while writing or repairing datasets
- the `petastorm-copy-dataset.py` and `petastorm-generate-metadata.py` commands

## What does not belong here

- consuming an already-created dataset
- TensorFlow and PyTorch adapter details beyond writer-side shape or schema concerns
- Spark DataFrame caching into reusable loaders

Use `sub-skills/read-datasets/` for reader work.
Use `sub-skills/spark-converter/` when the task is caching a Spark DataFrame for later loading.

## Read this first

- `references/workflows.md` for writing, copying, metadata repair, and indexing recipes
- `references/api-reference.md` for verified signatures and behavior
- `references/cli-reference.md` for the dataset copy and metadata commands
- `references/data-formats.md` for the on-disk layout and metadata keys
- `references/troubleshooting.md` for schema, Spark, URL, and metadata failures
- `scripts/smoke_make_minimal_dataset.py` for a tiny write smoke test
- `scripts/smoke_copy_dataset.py` for a copy-and-filter smoke test
- `scripts/smoke_generate_metadata.py` for a metadata-repair smoke test

## How to choose a creation path

1. **Starting from rows or a DataFrame?**
   - Define a `Unischema` and write through `materialize_dataset`.
2. **Need to rewrite an existing dataset?**
   - Use `copy_dataset` for subset/filter/repartition jobs.
3. **Need to restore reader compatibility?**
   - Use `generate_petastorm_metadata`.
4. **Need row-group acceleration?**
   - Use `build_rowgroup_index` with the matching indexer type.

## Boundary reminders

- Non-scalar fields need a codec.
- `materialize_dataset` is the writer-side contract that stamps Petastorm metadata onto the Parquet output.
- `copy_dataset` can narrow columns and drop rows with nulls in selected fields.
- `generate_petastorm_metadata` can infer the schema from the dataset when metadata already exists, or use a supplied unischema class string.
- `build_rowgroup_index` expects compatible indexers and a writable dataset metadata location.

## Common tasks

### Create a new dataset

1. Define a schema with `Unischema`.
2. Convert dictionaries into Spark rows with `dict_to_spark_row`.
3. Wrap the write in `materialize_dataset`.
4. Write to a `file://`, `hdfs://`, `s3://`, or compatible URL.

### Repair or regenerate metadata

1. Open the existing dataset URL.
2. Call `generate_petastorm_metadata` or the CLI wrapper.
3. Reopen the dataset with `make_reader` to confirm the repair.

### Copy or filter a dataset

1. Decide which columns should survive the copy.
2. Decide which fields must remain non-null.
3. Optionally repartition before write.
4. Read the result back to confirm the shape.

### Build a row-group index

1. Create an indexer object for the field you want to accelerate.
2. Call `build_rowgroup_index` from a Spark context.
3. Use the resulting selector on the read side.

## When to stop and switch routes

- If the user only wants to open the data, switch to `read-datasets`.
- If the user wants to convert a Spark DataFrame into a reusable cached loader, switch to `spark-converter`.

Files in this skill

  • SKILL.md4.1 KB
  • references/api-reference.md4.8 KB
  • references/cli-reference.md2.2 KB
  • references/data-formats.md2.3 KB
  • references/troubleshooting.md2.5 KB
  • references/workflows.md4.1 KB
  • scripts/smoke_copy_dataset.py3.6 KB
  • scripts/smoke_generate_metadata.py3.3 KB
  • scripts/smoke_make_minimal_dataset.py3.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.