CrossjoinSync Type Translation Guide

This guide explains how CrossjoinSync translates data types between source and destination providers, and how to safely customize behavior in type-mappings.json.

Why Type Translation Exists

Different databases use different type systems. For example:

CrossjoinSync resolves this during schema generation (create-destination) by applying provider-pair mapping rules.

Where Translation Rules Live

The mapping file is copied to output/publish locations and read at runtime.

Mapping Model

Mappings are grouped by provider pair key:

Each key contains an ordered list of rules. First match wins.

Rule Schema

Each rule supports:

Example rule:

{ "match": "^NUMBER$", "matchType": "exact", "target": "decimal({prec},{scale})", "defaultPrec": 38, "defaultScale": 4 }

Placeholder Substitution

target can include placeholders:

Values come from source metadata when available:

If metadata is missing, CrossjoinSync uses rule defaults, then internal fallbacks.

Default Behavior and Fallbacks

When values are missing:

This means your defaultPrec/defaultScale/defaultSize choices in JSON directly affect generated DDL.

How to Change Mappings Safely

  1. Open CrossjoinSync/type-mappings.json.
  2. Find the provider pair you need to change.
  3. Add or edit rules in that block.
  4. Keep more specific rules above more general rules.
  5. Save the file.
  6. Run create-destination for a test extract and validate generated DDL.
.\CrossjoinSync.exe create-destination --job DailySync --file .\sql\preview-ddl.sql --source

Common Customizations

1) Change default precision/scale for numerics

If you want Oracle NUMBER to default to scale 2 instead of 4, update:

{ "match": "^NUMBER$", "matchType": "exact", "target": "decimal({prec},{scale})", "defaultPrec": 38, "defaultScale": 2 }

2) Force string lengths

To make SQL Server VARCHAR map to Snowflake VARCHAR(1000) by default:

{ "match": "^VARCHAR$", "matchType": "regex", "target": "VARCHAR({size})", "defaultSize": 1000 }

3) Add a new type mapping

Add a new rule near the top of the relevant provider pair:

{ "match": "^XMLTYPE$", "matchType": "exact", "target": "VARIANT" }

Rule Ordering Guidance

Because first match wins:

Bad ordering can cause broad rules to swallow specific ones.

Troubleshooting

If translated types are not what you expect:

Practical Notes