Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
Enterprise only

Run Incremental Matching

Update the identity graph with new, changed, or deleted records without re-running the full match on your entire dataset.

Enterprise only. Incremental matching updates the identity graph and preserves Zingg IDs across runs. Not available in Community.

Re-running matching on entire datasets is wasteful and loses the lineage of matched records against a persistent identifier. Incremental matching lets you process new, updated, and deleted records and match them to existing clusters, without starting over.

New records that do not find a match receive their own new Zingg ID. Records that match an existing cluster are assigned that cluster's Zingg ID. Cluster merges, unmerges, and assignments happen automatically. Human-approved cluster decisions from previous runs are preserved and not overridden.

Step 1: Imports

from zingg.client import *
from zingg.pipes import *
from zinggEC.enterprise.common.epipes import *
from zinggEC.enterprise.common.EArguments import *
from zinggEC.enterprise.common.EFieldDefinition import EFieldDefinition
from zinggEC.enterprise.common.IncrementalArguments import *
from zinggES.enterprise.spark.ESparkClient import *

Step 2: Set up base args

args = EArguments()
recId = EFieldDefinition(
    "recId",
    "string",
    MatchType.DONT_USE
)
recId.setPrimaryKey(True)

fname = EFieldDefinition(
    "fname",
    "string",
    MatchType.FUZZY
)
lname = EFieldDefinition(
    "lname",
    "string",
    MatchType.FUZZY
)
stNo = EFieldDefinition(
    "stNo",
    "string",
    MatchType.FUZZY
)
add1 = EFieldDefinition(
    "add1",
    "string",
    MatchType.FUZZY
)
add2 = EFieldDefinition(
    "add2",
    "string",
    MatchType.FUZZY
)
city = EFieldDefinition(
    "city",
    "string",
    MatchType.FUZZY
)
areacode = EFieldDefinition(
    "areacode",
    "string",
    MatchType.FUZZY
)
state = EFieldDefinition(
    "state",
    "string",
    MatchType.FUZZY
)
dob = EFieldDefinition(
    "dob",
    "string",
    MatchType.FUZZY
)
ssn = EFieldDefinition(
    "ssn",
    "string",
    MatchType.FUZZY
)

fieldDefs = [
    recId,
    fname,
    lname,
    stNo,
    add1,
    add2,
    city,
    areacode,
    state,
    dob,
    ssn
]
args.setFieldDefinition(fieldDefs)
args.setModelId("100")
args.setZinggDir("/tmp/models")
args.setNumPartitions(4)
args.setLabelDataSampleSize(0.5)

schema = (
    "recId string, fname string, "
    "lname string, stNo string, add1 string, "
    "add2 string, city string, areacode string, "
    "state string, dob string, ssn string"
)

inputPipe = ECsvPipe("testFebrl", "examples/febrl/test.csv", schema)
args.setData(inputPipe)

outputPipe = ECsvPipe("resultFebrl", "/tmp/febrlOutput")
outputPipe.setHeader("true")
args.setOutput(outputPipe)

Step 3: Create IncrementalArguments

Step 4: Configure incremental input pipe

Step 5: Run incremental matching

Step 6: Read output

Output is at the same path as your match output. New records get new Zingg IDs. Records matching existing clusters get the existing Zingg ID. No separate output path is needed.

If using the CLI instead of the Python API, create an incrementalConf.json file:

Run With

The outputTmp section specifies a temporary output location where Zingg writes intermediate results before final processing or merging with the main output.

Zingg on Snowflake can be run either from a local terminal via the CLI, or natively inside Snowflake as a job service.

CLI (local terminal)

Create an incrementalConf.json file:

Run With

The outputTmp section specifies a temporary output location where Zingg writes intermediate results before final processing or merging with the main output.

Snowflake (job service)

Run the phase as an asynchronous job service inside your Snowflake compute pool.

<zingg-job-spec-file> defines the container and job service configuration Zingg needs to run inside Snowpark Container Services. It is maintained by your administrator and referenced from your @specs stage.

<config-name> is the name of your incremental configuration json file (e.g. incrementalConf.json).

Monitor the job

Retrieve the service logs to monitor execution and debug any failures.

zingg-async-job-container refers to the container name defined in the job specification.

Stop the compute pool

Once the job completes, stop the compute pool to release resources.

Last updated

Was this helpful?