This prompt is for ETL developers and data engineers who need to generate a row-by-row field mapping table between a known source extraction schema and a fixed target system schema. The job-to-be-done is automating the documentation of transformation rules before writing pipeline code. You provide two schemas—one from an upstream extraction step and one from a downstream database, API, or event contract—and the prompt produces a mapping that includes source field, target field, transformation logic, default values, and type compatibility warnings. This is a design-time prompt, not a runtime transformation engine. It helps you reason about the mapping, catch mismatches early, and produce a spec that a developer or code-generation tool can implement.
Prompt
Field Mapping Prompt for ETL Transformations

When to Use This Prompt
Understand the ideal job-to-be-done, required context, and boundaries for the field mapping prompt.
Use this prompt when you already have a defined source schema from an extraction step and a fixed target schema that cannot change. The prompt assumes you are mapping known fields to known targets. It does not design schemas, decide which fields to extract, or infer missing target columns. It also does not write the actual transformation code—it produces a mapping table that you can review, adjust, and then implement. If you need to generate extraction logic from raw documents, use a strict schema extraction prompt first. If you need to validate that extraction output matches a registered schema, use a data contract validation prompt. If you need to handle cross-field dependencies or assemble multiple records, use a multi-table record assembly prompt.
Before using this prompt, gather both schemas in a structured format—JSON Schema, SQL DDL, Avro definitions, or a simple field-name-and-type list. The prompt works best when you include type information, nullability constraints, and any target-side default values or required flags. After generating the mapping, review every row for correctness, especially transformation logic that involves type coercion, date formatting, or identifier canonicalization. For high-risk pipelines where incorrect mappings could corrupt downstream data, always have a second engineer review the mapping table before implementation. Do not use this prompt for real-time transformation decisions; it is a planning and documentation tool, not a runtime component.
Use Case Fit
Where the Field Mapping Prompt for ETL Transformations delivers reliable automation and where it introduces unacceptable risk. Use these cards to decide if this prompt belongs in your pipeline or if you need a different approach.
Good Fit: Schema-to-Schema Mapping
Use when: You have a well-defined source extraction schema and a stable target system schema with documented types. Guardrail: Provide both schemas inline and require the model to flag type mismatches rather than silently coercing.
Bad Fit: Undocumented Legacy Systems
Avoid when: The target system lacks a formal schema or the source fields are inconsistently named across documents. Guardrail: Use a schema inference prompt first to stabilize the source contract before attempting field mapping.
Required Inputs
What you need: Source field names with types, target field names with types, sample values for ambiguous fields, and transformation rules for known exceptions. Guardrail: Missing any of these increases hallucination risk—require the model to output a needs_clarification flag for unmappable fields.
Operational Risk: Silent Type Coercion
What to watch: The model maps a string source field to an integer target field by truncating or guessing. Guardrail: Require explicit transformation logic for every type mismatch in the output mapping table and validate with a type-checking harness before ingestion.
Operational Risk: Missing Default Values
What to watch: The mapping omits required target fields that have no source equivalent, causing downstream insertion failures. Guardrail: Include a default_value column in the mapping output and validate that every non-nullable target field has either a source mapping or an explicit default.
When to Escalate
What to watch: The mapping confidence is low for business-critical fields or the transformation logic involves complex business rules. Guardrail: Route mappings with low confidence scores or custom logic to a human review queue before they reach production ingestion pipelines.
Copy-Ready Prompt Template
A copy-ready prompt template for generating ETL field mapping tables from source and target schemas.
The prompt below is designed to be dropped directly into your application or evaluation harness. It expects two schemas—source and target—and produces a structured JSON mapping table with type compatibility warnings, transformation rules, and blocking issue flags. Use it when you need a first-pass field map before writing actual transformation code.
textYou are an ETL field mapping specialist. Your task is to generate a field mapping table from a source extraction schema to a target system schema. ## Source Schema [SOURCE_SCHEMA] ## Target Schema [TARGET_SCHEMA] ## Mapping Rules - For each target field, identify the best matching source field by name similarity, semantic meaning, and data type compatibility. - If no source field maps to a target field, specify a default value or mark it as unmapped. - If a source field has no corresponding target field, note it as unmapped in the target. - Flag any type incompatibilities with a warning level: 'safe' (implicit conversion possible), 'warning' (explicit conversion needed, possible data loss), or 'error' (incompatible types, manual transformation required). - For each mapping row, provide a transformation rule in plain language. If the mapping is direct, state 'direct pass-through'. - If a target field is required but unmapped, flag it as a blocking issue. ## Output Format Return a JSON object with a 'mappings' array. Each element must have these fields: - source_field: string or null - target_field: string - source_type: string or null - target_type: string - type_compatibility: 'safe' | 'warning' | 'error' - transformation_rule: string - default_value: string or null - required_target: boolean - notes: string Also include: - unmapped_source_fields: array of source fields with no target match - unmapped_target_fields: array of target fields with no source match - blocking_issues: array of required target fields with no source mapping ## Constraints [CONSTRAINTS]
To adapt this template, replace [SOURCE_SCHEMA] and [TARGET_SCHEMA] with your actual schema definitions—preferably as JSON Schema, typed field lists, or table DDL. The [CONSTRAINTS] placeholder accepts additional rules such as naming conventions, forbidden transformations, or domain-specific type coercion policies. For high-stakes pipelines, always run the output through a validator that checks for missing required fields and type compatibility errors before feeding the mapping into your transformation engine.
After generating the mapping, review any rows flagged as warning or error manually. Blocking issues in the blocking_issues array must be resolved before the mapping can be used in production. Consider versioning your mapping outputs alongside your schema definitions so you can track how field maps evolve as upstream or downstream systems change.
Prompt Variables
Required and optional inputs for the Field Mapping Prompt. Provide these to generate a reliable source-to-target mapping table with transformation logic and type compatibility warnings.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[SOURCE_SCHEMA] | The extraction output schema to map from. Defines field names, types, and nullability. | {"customer_name": "string", "order_total": "float", "order_date": "string"} | Must be valid JSON. Parse check required. Reject if empty or contains only comments. |
[TARGET_SCHEMA] | The destination system schema to map to. Defines expected field names, types, and constraints. | {"full_name": "string not null", "amount": "decimal(10,2)", "created_at": "timestamp"} | Must be valid JSON. Parse check required. Reject if field count is zero. |
[TARGET_SYSTEM] | Name or type of the destination system. Used to apply system-specific conventions. | PostgreSQL 15 | Must be a non-empty string. Used to select coercion rules and identifier quoting style. |
[NULL_HANDLING] | Policy for how missing source fields map to target fields. | set_default | Must be one of: set_default, set_null, skip_field, raise_error. Enum validation required. |
[DEFAULT_VALUES] | Map of target field names to default values when source field is absent or null. | {"amount": 0.00, "created_at": "CURRENT_TIMESTAMP"} | Must be valid JSON object. Values must match target field types. Null allowed if no defaults. |
[STRICT_MODE] | Whether to reject mappings where source and target types are incompatible without explicit coercion. | Must be boolean. When true, incompatible types without a coercion rule cause a warning in output. | |
[INCLUDE_WARNINGS] | Whether the output mapping table should include a warnings column for type mismatches and precision risks. | Must be boolean. When false, warnings are suppressed and only the mapping is returned. |
Implementation Harness Notes
Wire this prompt into an ETL pipeline generator or schema mapping tool with validation, retries, and human escalation for production reliability.
This prompt is designed to be called programmatically within a data pipeline or schema mapping service. The LLM receives the prompt template populated with parsed source and target schemas, and it returns a JSON response containing a mappings array and a blocking_issues array. The application layer is responsible for validating this response before accepting it as a valid mapping configuration. Treat the LLM output as a proposal, not a final artifact, and always run structural and semantic checks before the mapping rules are applied to real data.
After calling the LLM, parse the JSON response and immediately validate that every field present in the target schema appears in the mappings array. If any target field is missing, reject the output and retry once with a stricter format instruction that explicitly lists the missing fields. Check the blocking_issues array before proceeding: if it is non-empty, route the entire mapping proposal to a human for schema review rather than attempting automated recovery. For type incompatibility warnings in the warnings array, generate a follow-up prompt asking the model to produce specific coercion logic for each flagged field, such as string-to-timestamp parsing patterns or decimal precision rules. Log every mapping run with the source schema version, target schema version, model identifier, and timestamp for auditability. If the output fails JSON parsing entirely, retry once with a stricter format instruction appended to the original prompt. If the second attempt also fails, escalate to a human operator with the raw model output attached and halt the pipeline.
Choose a model that reliably produces structured JSON output and respects schema constraints. Models with native function-calling or structured output modes are preferred because they reduce parsing failures and hallucinated fields. If your pipeline processes schemas that contain sensitive field names or business logic, ensure the model endpoint is deployed in a private environment and that no schema data is logged to external observability tools without redaction. For high-volume ETL workloads, consider caching mapping results keyed by a hash of the source and target schema versions to avoid redundant LLM calls. Before deploying any mapping configuration to production, run it against a representative sample of source records and validate that the transformed output matches the target schema's type constraints, nullability rules, and referential integrity requirements. A mapping that passes structural validation can still produce semantically broken data if coercion logic is lossy or field semantics are misinterpreted.
Expected Output Contract
Validate every field in the generated mapping table before passing it to the ETL orchestrator. Each row defines the contract a mapping entry must satisfy.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
source_field | string | Must match a field name in [SOURCE_SCHEMA]. Reject if not found in schema definition. | |
target_field | string | Must match a field name in [TARGET_SCHEMA]. Reject if not found in schema definition. | |
transformation_logic | string or null | Must be a non-empty string describing the operation. Accept null only when source_field equals target_field and types are compatible. Reject empty strings. | |
default_value | string, number, boolean, or null | Type must be compatible with target_field type. Reject if default_value type conflicts with [TARGET_SCHEMA] field type. | |
type_compatibility_warning | string or null | Must be null when source and target types match. Must contain a specific warning message when types differ. Reject if warning is present but types are identical. | |
transformation_notes | string or null | Free text allowed. Reject if notes exceed 500 characters. Accept null when no additional context is needed. | |
requires_human_review | boolean | Must be true when type_compatibility_warning is not null or when transformation_logic contains 'CUSTOM_FUNCTION'. Must be false otherwise. Reject on mismatch. | |
mapping_confidence | string | Must be one of: 'high', 'medium', 'low'. Reject any other value. Must be 'low' when requires_human_review is true and transformation_logic is null. |
Common Failure Modes
Field mapping prompts for ETL transformations fail in predictable ways. Here are the most common failure modes and how to guard against them before they reach production ingestion.
Silent Type Mismatch
What to watch: The model maps a source string field to a target integer column without coercion, producing a payload that passes JSON validation but fails database insertion. Guardrail: Add a type coercion step in the application layer that validates each mapped value against the target schema before insertion, and log coercion failures with source field provenance.
Hallucinated Default Values
What to watch: When a source field is missing, the model invents a plausible default instead of using the specified fallback or leaving the field null. Guardrail: Require the prompt to output an explicit default_applied boolean alongside every field, and validate that defaults only appear where the source field was confirmed absent.
Enum Value Drift
What to watch: The model maps a source value to a target enum that doesn't exist in the downstream system, such as mapping 'in_progress' to 'IN-PROGRESS' when the valid enum is 'IN_PROGRESS'. Guardrail: Include the complete allowed enum list in the prompt and add a post-extraction validator that rejects any mapped value not in the target enum set.
Nested Field Collapse
What to watch: The model flattens a nested source object into a single string or loses child fields when mapping to a target schema that expects structured nesting. Guardrail: Explicitly define the nesting contract in the output schema with required sub-fields, and validate structural completeness before ingestion.
Ambiguous Null Handling
What to watch: The model cannot distinguish between a source field that is genuinely absent, a field that is present but empty, and a field the model is uncertain about. All three become null in the output. Guardrail: Require a tri-state annotation for every nullable field: value_present, value_absent, or value_uncertain, and route uncertain cases to a review queue.
Transformation Logic Omission
What to watch: The model correctly identifies the source-to-target mapping but skips the required transformation logic, such as concatenating first_name and last_name into full_name. Guardrail: Include transformation rules as explicit, numbered steps in the prompt and add a post-processing check that verifies transformed fields differ from raw source values when a transformation was specified.
Evaluation Rubric
Use this rubric to test the quality of field mapping output before integrating it into an ETL pipeline. Each criterion targets a specific failure mode common in LLM-generated transformation logic.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Source-Target Completeness | Every field in [SOURCE_SCHEMA] is mapped to exactly one target field or explicitly marked as unmapped with a reason | Missing source fields in the mapping table or silent drops without justification | Diff the set of source field names against the set of mapped source fields in the output; flag any source field not present in the mapping |
Type Compatibility Accuracy | Every mapping declares a type compatibility verdict (compatible, coercion, incompatible) that matches the actual type systems of source and target | A mapping marked compatible when source is string and target is integer without a coercion rule | Spot-check 3 cross-type mappings by comparing declared verdict against a manual type compatibility matrix for the source and target systems |
Transformation Logic Executability | Every non-pass-through mapping includes a transformation rule that can be expressed as a deterministic function with clear inputs | Vague rules like clean up the value or normalize as needed without specifying the operation | For each transformation rule, attempt to write a one-line pseudocode function; flag any rule that cannot be expressed deterministically |
Default Value Safety | Every target field marked required in [TARGET_SCHEMA] has either a source mapping or an explicit, type-safe default value | A required target field has no source mapping and no default, or the default is the wrong type | Cross-reference required fields from [TARGET_SCHEMA] against the mapping table; flag any required field with neither a source nor a valid default |
Null Handling Consistency | Every mapping specifies null behavior using one of the allowed strategies: pass-through, default, skip-record, or error | Null behavior is missing, contradicts the target field nullability constraint, or uses an undefined strategy | Validate that the null behavior field contains only allowed enum values and that nullable=false target fields do not use pass-through |
Coercion Warning Presence | Every mapping with a coercion verdict includes at least one specific warning about potential data loss, precision loss, or format ambiguity | A coercion mapping with no warnings or a generic warning like data may be lost | Scan all coercion mappings; flag any where the warnings array is empty or contains only non-specific phrases |
Conflict Resolution Documentation | When multiple source fields map to the same target field, the output includes a documented precedence rule or merge strategy | Multiple source fields map to one target field with no indication of which wins or how values combine | Group mappings by target field; flag any target field with multiple source mappings that lacks a conflict_resolution field |
Schema Evolution Awareness | The mapping includes a compatibility_mode field indicating whether the mapping is safe for full replacement, forward-compatible, or requires consumer migration | Missing compatibility_mode or a mode that contradicts the type changes present in the mapping | Check that every mapping record includes a compatibility_mode value from the allowed set and that incompatible type changes are not marked full-replacement |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Add strict JSON output schema, type compatibility validation, and explicit null-handling rules. Include a validation harness that checks every mapped field against the target schema before accepting the output. Add retry logic for malformed responses.
codeReturn a JSON object with: - "mappings": array of {source_field, target_field, transformation, default_value, type_warning} - "unmapped_source_fields": array of fields in source with no target match - "unmapped_target_fields": array of required target fields with no source match - "type_conflicts": array of {field, source_type, target_type, resolution}
Watch for
- Silent format drift where the model drops optional fields under load
- Missing human review gate for mappings that affect production data pipelines
- Transformation logic that references functions not available in your ETL tool
- Default values that violate target column constraints (e.g., string default for integer column)

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us