In-flight processing
Masking rule sets
Publish reusable masking rules for a source database, choose a revision for each replica, and check what will reload before you activate it.
Use a rule set when several targets need the same decisions about sensitive fields. For example, an analytics replica can use a stable token for customer email so analysts can count repeat customers. A support replica can use that same rule set and reveal the last four digits of a phone number where its policy permits. Each target has its own assignment and can stay on a different published revision.
Where masking applies
SQL Flow masks values as it writes the target, during the initial copy and subsequent changes. Original values remain on the source and can pass through the capture agent's spool and the relay. Place those components inside the boundary where original data is allowed. Tightening masking later cannot recall rows that someone already exported or backed up.
Rule sets are available for one-way pipelines from SQL Server DirectLog or Reconstruction, or Oracle DirectLog, to PostgreSQL, SQL Server or Azure SQL. A relay can deliver masked non-key fields. Pseudonymizing a replication key has additional requirements.
1. Read the source schema
Open Masking and find the source database. A source appears here after a pipeline uses it. Select Read schema to have the agent discover its tables and fields. Use Refresh schema after a source schema change. Review the fields that the pipeline actually replicates. The editor's examples use synthetic values.
For a new source that must be masked from its first copy, create a paused pipeline first. Read the schema and set up masking before starting a load. Activation of changed rules can itself start a reload, so finish the target and key setup before activating.
2. Create and publish a rule set
Select New rule set on the source, enter a name that describes its use, such as Analytics, and choose actions for the fields that matter.
| Action | Example decision |
|---|---|
| Keep original | Explicitly approve delivery of country_code unchanged. |
| Hide value | Replace a text field such as contact_name with a constant compatible with the column. |
| Show part | Keep the last four characters of phone. Set the minimum number that must remain hidden so short values are masked in full. |
| Stable pseudonym | Give email a token. Equal inputs produce the same token under the same normalization, alias, key and version. |
| Exclude column | Omit private_note from the target output. |
Use an explicit field rule for an exception. For repeated names, add a pattern. Explicit field rules take precedence, then the first matching pattern wins. Patterns skip key columns. Restrict field use is a Safe Boundary access control and cannot be enforced on a SQL Flow replica.
Save the draft, review its decisions and publish it with a revision note. A published revision is fixed. Editing the draft and publishing a later revision leaves existing target assignments pinned until someone reviews and activates the update.
3. Assign the revision to a target
On the source's Targets list, choose the pipeline target and the published rule set. Open its masking details to review the effective rules. Where the rule set permits customization, override individual fields for this target. You can also start with manual decisions for a single target.
Check the tables in scope, the fields marked Unreviewed, any missing fields and the reasons that block activation. A table outside scope has no masking guarantee from this assignment. Keep original records an explicit decision. A masking administrator can mark fields as required and specify acceptable actions or restrict who can customize a rule set. Resolve each blocked field before proceeding.
For every stable pseudonym, supply an immutable version and an operator secret reference. For example, alias customer, version v1, reference env:CUSTOMER_MASK_V1 uses the agent service's SQLFLOW_SECRET_CUSTOMER_MASK_V1 variable. Provision the same secret on each agent that needs it, including both ends of a relay. Enter the reference in SQL Flow and keep the key material on the agents. Follow the key generation and storage instructions.
When you create another pipeline from a source whose schema has already been read, the wizard's Review step lets you choose a published revision and bind its keys before the first load.
4. Review the impact and activate
Compare the pending decisions with On the target. If the change would expose a previously masked field, review the named fields and acknowledge the exposure. SQL Flow requires a capture-agent check of the effective rules before dispatching a reload. Fix the issue named by any blocker, such as an unavailable key or a field that the target cannot represent.
| What the activation panel shows | What happens |
|---|---|
| No reload needed | The recorded revision or assignment changes, but the compiled rules produce the same output. |
| Apply and reload with a list of tables | The pipeline restarts and recopies the listed tables on this target. Other tables and targets resume without being recopied. |
| Apply and reload pipeline | All selected tables on every target reload. Read the reason and schedule the interruption accordingly. |
Select Activate or Activate and reload, as offered. Confirm that the target shows the intended revision and that any reload completes. A masking failure stops delivery. For the conditions that allow a smaller reload, see Change rules on an existing pipeline.
When a newer revision becomes available, review the field changes on each target. If a changed field also has a target override, decide whether to retain that override or inherit the new rule before activating. To rotate a pseudonym key, provide a new version and reference, then review the reload. Values generated with the new version differ from the old tokens, including in downstream extracts that use them for joins.
Keep joins on a pseudonymized key
Use Stable pseudonym on a primary key only with a directly applied SQL Server DirectLog or Reconstruction source and an eligible target. The key must be text, binary, a supported whole number or a unique identifier. Use exact normalization. The target key must accommodate 64 hexadecimal characters with case-safe comparison. A key originally stored as an integer needs a compatible text column on the target.
When the parent and child tables are both replicated, keep both sides unchanged or apply the same pseudonym alias and normalization to both. For example, use the same alias for Customers.customer_id and Orders.customer_id. On a unique column, preserve distinct values and keep SQL NULL as NULL. SQL Flow validates the key relationships before delivery.
A table with a pseudonymized replication key cannot use key-based compare or repair, automatic repair, native large-object apply, or row-filter lookups that depend on foreign-key closure. Keep the original key if those workflows are required. For expression masking, the compiler recognizes an exact HASH_MASK on a text or binary key, or a hash of the full canonical text of a supported whole number or unique identifier. An arbitrary transformation cannot be used as a replication key.
