Transform Manager
The Transform Manager produces data transforms that convert Infrahub data into other formats — device configurations, JSON exports, CSV reports, and more. Transforms can be implemented as Python classes, Jinja2 templates, or a hybrid of both. The skill generates the transform code, GraphQL query, optional Jinja2 templates, and .infrahub.yml registration.
When to use
- Generating device configuration files from Infrahub data
- Exporting infrastructure data to JSON, CSV, or other formats
- Producing human-readable reports from graph data
- Any scenario where Infrahub data needs to be rendered into a different representation
Transform types
Python transform
Use when the output requires logic: conditional rendering, calculations, data reshaping.
- Implements
InfrahubTransformclass with atransform()method - Returns a
dictfor JSON output or astrfor text output
Jinja2 transform
Use when the output is primarily a template with variable substitution: device configs, structured text files.
- Template file receives the GraphQL query response in a
datavariable - Supports
netutilsfilters for network-specific operations (IP address manipulation, interface normalization)
Hybrid (Python + Jinja2)
Use when data needs preprocessing before rendering.
- Python class prepares and reshapes the data, Jinja2 template handles rendering
- Supports platform-specific templates (e.g., different configs per vendor) using
FileSystemLoader
What it produces
- GraphQL query file (
.gql) — fetches the data the transform needs - Python transform class and/or Jinja2 template file(s)
.infrahub.ymlentry underpython_transformsorjinja2_transformsartifact_definitionsentry if the transform produces versioned artifacts
Example prompts
- "Create a Jinja2 transform that produces Cisco IOS configuration for each device, pulling interface and BGP data from Infrahub"
- "Write a Python transform that exports all IP addresses to a CSV file"
- "Build a hybrid transform that generates vendor-specific configs — Cisco IOS for routers, Juniper JunOS for switches"
Key rules enforced
- Return type — Python transform must return
dictfor JSON output orstrfor text; wrong return type causes rendering failure datavariable — Jinja2 templates always receive the GraphQL response asdata; accessing the wrong key is a common mistake- Artifact definitions — if the transform output should be stored as a versioned artifact in Infrahub, an
artifact_definitionsentry is required in.infrahub.yml; the skill generates this when appropriate netutilsavailability —netutilsfilters are available in Jinja2 templates; the skill uses them where appropriate for IP and interface operations
Running transforms
Transforms run as part of the artifact generation pipeline or on demand:
infrahubctl transform run <transform-name>