<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sami Yaseen on Medium]]></title>
        <description><![CDATA[Stories by Sami Yaseen on Medium]]></description>
        <link>https://medium.com/@samibnyyasen?source=rss-d16936b140b4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-xTJUKZzJ5RZp3ES-IHbEQ.jpeg</url>
            <title>Stories by Sami Yaseen on Medium</title>
            <link>https://medium.com/@samibnyyasen?source=rss-d16936b140b4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:37:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@samibnyyasen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Company Name Normalization Isn’t Enough for Fuzzy Matching]]></title>
            <link>https://medium.com/tilo-tech/company-name-normalization-isnt-enough-for-fuzzy-matching-970ac8f1161c?source=rss-d16936b140b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/970ac8f1161c</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-quality]]></category>
            <category><![CDATA[entity-resolution]]></category>
            <category><![CDATA[fuzzy-matching]]></category>
            <category><![CDATA[data-matching]]></category>
            <dc:creator><![CDATA[Sami Yaseen]]></dc:creator>
            <pubDate>Mon, 18 May 2026 16:06:04 GMT</pubDate>
            <atom:updated>2026-05-18T16:06:04.515Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Every entity-resolution tool ships legal-form normalization. None of it fixes the false positives resulting from matching based on common words like Group, Holdings, Solutions etc. These are meaningful business words that can’t be normalized, and token weighting is what closes the gap.</strong></p><p>Standard fuzzy-matching algorithms fail on company name records for a structural reason: they treat every token as equal evidence. Weighted token matching uses Inverse Document Frequency (IDF) rarity weights to fix that. No per-token normalization lists, no per-domain tuning.</p><h3>The setup</h3><p>Assuming you’ve handled the Ltd/Limited problem and normalized your legal forms, your fuzzy matcher still rates “Acme Group Ltd” and “Beta Group Ltd” (pair A) as more similar than “Acme Group Ltd” and “Acme Holdings Ltd” (pair B). On every standard similarity algorithm (Jaccard, Cosine, Jaro, Jaro Winkler, Sorensen-Dice), pair A scores higher than pair B. The matcher is doing exactly what it was designed to do, and that’s the problem.</p><p>Try this using your preferred fuzzy matching algorithm. Run two pairs of company names:</p><p>Pair A is two unrelated companies. Pair B is plausibly the same group, possibly the same company. Pair B should score higher. Here’s what every standard fuzzy matcher actually says, with match threshold 80% similarity, distance ≤ 3, phonetic codes equal. Cell colored 🟢 above-threshold; 🔴 below-threshold:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gRKYKLbG3o1Z6qYnu0SLjw.png" /></figure><p>⚠ = matcher said match when it shouldn’t have (false positive on the unrelated pair).</p><p>Verify these numbers yourself in Tilores’s free fuzzy-matching comparison tool: <a href="https://tilores.io/fuzzy-matching-algorithms?t1=Acme%20Group%20Ltd&amp;t2=Beta%20Group%20Ltd">pair A</a> and <a href="https://tilores.io/fuzzy-matching-algorithms?t1=Acme%20Group%20Ltd&amp;t2=Acme%20Holdings%20Ltd">pair B</a>. The weighted token matcher row uses sensible illustrative token-frequency weights.</p><p>There’s no threshold that fixes both. Lower the threshold to catch pair B and you also accept pair A as a false positive. Raise it to reject pair A and you lose pair B. With these algorithms, you pick between bad precision (wrong matches) and bad recall (missed matches) on exactly the kind of records entity matching is supposed to handle.</p><p>Only the weighted token matcher gets both right. Acme is doing the work in pair B; Group and Ltd contribute almost nothing in pair A. The 80% threshold lands cleanly between the two scores: pair A rejected at ~13%, pair B accepted at ~84%. Both decisions correct, with room to spare in either direction.</p><p>The standard matchers aren’t broken. Jaccard, Dice, Cosine, Jaro Winkler are all doing exactly what they’re defined to do: count or measure shared characters and tokens, whilst ignoring which characters and tokens are actually present. And for company names, or any short natural-language identifier, that’s exactly the wrong thing to count.</p><p>This issue is most acute with company names, where reliable addresses often aren’t there to begin with. The same problem is there with person names. Smith and Garcia hide the matching signal of rare names that actually identify someone. With addresses, a house number plus a rare street name carries the signal whilst Street, Avenue, Road are not unique to the address.</p><p>So how does the weighted token matcher get both pairs right? It starts with knowing which words actually matter.</p><h3>Why common business words break fuzzy matching</h3><p>Pull a million company names from any registry and tokenize. The top of the frequency distribution falls into two layers, and they’re not equally hard to deal with.</p><p>The easier half (for Western companies): legal forms. Ltd, Inc, Corp, Limited, Company, GmbH, SA, AG, Pty. You can handle these with a reference list of known legal-form variants and a normalization step. Most entity-resolution tools have this baked in; OpenSanctions publishes open reference data you can reuse; commercial tools ship preset lists. For Western legal forms, mostly a solved problem.</p><p>For Chinese, Russian, transliterated, or non-Latin-script company names, it gets complicated quickly. The reference-list approach hits its limits when transliteration variants, mixed scripts, and locale-specific suffixes pile up. That’s a different article. For the rest of this piece, assume the easy cases are handled and focus on what’s left.</p><p>The harder half: business-language tokens that aren’t legal forms. Group, Holdings, International, Global, Services, Solutions, Systems, Technologies, Industries, Consulting, Management, Capital, Digital, Cloud etc.. Each of these appear in 5–25% of records (i.e. close to 90% of records in any dataset will have one of these words). They’re real meaningful words. They sometimes distinguish a company (a “Solutions” subsidiary is different from an “Industries” subsidiary) and sometimes don’t (“Acme Group” rebranded to “Acme Holdings”). You can’t normalize them away. They carry domain meaning. But the likelihood of two records sharing any one of them is barely better than chance.</p><p>This is where naive token-set similarity falls apart for company name matching. A matcher that doesn’t distinguish Solutions (in 18% of records) from Petrochemical (in 0.01%) will treat “Acme Solutions Ltd” and “Beta Solutions Ltd” as a strong match candidate (both share Solutions and Ltd) even though the Acme/Beta difference is the only thing that actually identifies these as different companies.</p><p>The same shows up in person names. Smith, Garcia, Wang, and Lee together cover something like 15% of records in their respective populations. Two records in a US dataset sharing Smith says almost nothing. Two records sharing Petrov in the same dataset says a lot. With addresses: Main Street and High Street appear in thousands of cities; a number plus Magnolia Lane is uniquely yours.</p><p>The fix isn’t a better string-similarity algorithm. Edit distance, Levenshtein, Jaro-Winkler, all of them have the same problem when applied to short identifiers. And it isn’t a longer normalization list either. Solutions, Holdings, Industries aren’t candidates for normalization. They’re meaningful tokens that happen to be common. The fix is to give the matcher information it doesn’t have: a sense of which tokens carry information.</p><h3>Inverse Document Frequency: an old idea in a new place</h3><p>Search engines have known about this for fifty years. They use TF-IDF (Term Frequency × Inverse Document Frequency): the first half counts how often a word appears in a given document; the second half discounts it by how common the word is across the whole corpus. Together they measure how distinctive a word is for that document. A token’s value as evidence is inversely proportional to how often it shows up.</p><p>The IDF half:</p><p>weight(token) = log(N / count(token))</p><p>N is the total number of records, count(token) is how many of them contain that token. Common tokens get weights near zero. Rare tokens get high weights.</p><p>Nothing exotic. The same intuition every search engine uses.</p><p>What’s not commonly applied is using IDF for entity matching. Search uses it to rank documents against a query: which document best matches these words? Entity matching uses it for a related but different question: do these two short records refer to the same thing? Same idea, different application.</p><p>You take the tokens of both records, weight each by its IDF score, and now your matcher has the information it didn’t have before. Acme should count for orders of magnitude more than Solutions or Holdings or Group when measuring whether two records overlap.</p><p>And critically, you don’t need to maintain a per-token normalization list to make it happen. The weights come from the data itself. The same technique works across domains (company names, person names, product titles, addresses) because the IDF derivation pulls the rare-vs-common distinction out of whatever corpus you point it at. Domain knowledge comes from the data, automatically. No per-domain tuning, no manual rule lists, no expert-curated exception files.</p><p>If you’ve used the ratio matcher (matching tokens / unique tokens, or any equivalent uniform-weight set-similarity), this is the natural next step. Same idea, just with rarity as the weighting principle instead of treating every token equally.</p><h3>How weighted token matching works</h3><p>The scoring formula:</p><p>matching_score = matching_token_weights / all_token_weights</p><p>Where:</p><p>What you’re computing: the fraction of the informative content the two records share, instead of the fraction of tokens. Hook a threshold to that score (say, 80%) and you have a matcher that doesn’t fall for the Group/Holdings/Solutions trap.</p><p>Even mature probabilistic linkage tools, such as Splink, explicitly say they’re not designed for the single-column “bag of words” case, a table with only a company name column, nothing else. That’s exactly the case this technique handles, and it’s a chunk of real-world entity-matching work that often goes underserved.</p><p>A few details worth knowing about:</p><p>I’m describing the general structure. Several specific scoring functions fit it. What matters is the structural change: from “all tokens equal” to “tokens weighted by rarity.”</p><h3>How to derive token-frequency weights from your data</h3><p>We glossed over an important question: where does count(token) come from?</p><p>You have two choices. Use a generic weight list (i.e. an off-the-shelf English IDF), or derive your own from your data.</p><p>Generic is easier. It’s also wrong, in subtle ways. Industries is rare in general English and would get a high weight. In a B2B vendor dataset, Industries is everywhere. Petrochemical is rare in general English but might be common in your dataset. Generic weights mis-weight exactly the tokens that are characteristic of your domain. Exactly the tokens that matter most.</p><p>Deriving weights from your dataset is the right move. Run your corpus through the same transformation chain that runtime matching uses, count token frequencies, compute IDF.</p><p>The “same transformation chain” part is non-trivial. If your weight-generation tokenizer drops diacritics and your runtime tokenizer doesn’t, the matcher pulls a weight for token X computed against a different splitter, and either misses the token (because the form isn’t in the weight list) or scores it wrong. The mismatch is silent; nothing crashes; matching just performs worse than it should.</p><p>The fix is operational. Lock the transformation chain. Use the same chain for both purposes. Regenerate weights when the dataset shifts meaningfully.</p><h3>What changes when this works</h3><p>False positives drop and recall holds at the same threshold. Operators stop maintaining the exception lists they’ve built up against the obviously-wrong matches token-set methods generate.</p><p>Where this matters most: matching shipping or customs records (often OCR’d from handwritten forms) against clean company registries, where the only shared signal is a company name riddled with extraneous tokens, transliterated variants, or fragments of address mixed into the name field. Address-based matching has nothing to work with there. Token-set methods drown in the noise. Weighted matching is what finally bridges them.</p><p>The approach generalizes. Person names: matching Aleksandr Petrov through a customer base full of Smiths and Garcias becomes tractable instead of a tuning exercise. Addresses: “12 Old Mill Lane, Petersfield” finds “12 Old Mill Ln, Petersfield” without drowning in every record that contains Lane or Street or any postal abbreviation. Fraud applicant linkage, customer deduplication across systems, cross-language identifier matching. Anywhere short tokens carry the signal and most are noise, the same problem applies, and is solved the same way. The data carries the domain knowledge.</p><p>There’s a price. You maintain the weights, tune the threshold, and keep the transformation chain aligned across both stages. Most teams running entity resolution at scale already have this discipline. Weighted matching just gives you a tool that uses it.</p><p>If you’re hand-tuning thresholds against company name datasets, normalizing legal forms, and writing exception rules for Solutions, Holdings, and Group matches, there’s a better way.</p><p>This is the approach the matcher in <a href="https://tilores.io/">Tilores</a> takes for its entity-resolution pipeline ( <a href="https://docs.tilotech.io/tilores/rules/matcher/#weighted-token">technical docs</a>). The transformation-chain alignment described above is implemented as a separate weight-generation step that runs your dataset through the runtime transformation chain to compute weights consistently. The weights, category boundaries, and transformation chain are explicit configuration, not pre-tuned settings you can’t see or adjust.</p><h3>Summary</h3><ul><li>Standard fuzzy matching (Jaccard, Cosine, Jaro, Jaro Winkler, Levenshtein) fails on company name records because all tokens count as equal evidence.</li><li>Common business words like Group, Holdings, Solutions aren’t candidates for normalization. They carry domain meaning, even when they’re noise for matching.</li><li>IDF-style token weighting separates rare-and-meaningful tokens from common-and-noise ones. Fixes both precision (false positives) and recall (missed matches) at the same threshold.</li><li>At scale, indexing must bucket tokens by weight too: rare tokens indexed individually, mid-weight tokens in pairs, common tokens dropped from the index.</li><li>Weights derive automatically from your dataset, run through the same transformation chain as runtime matching. The same technique works on company names, person names, addresses, product titles, anything. Domain knowledge comes from the data; no manual rule lists or per-domain tuning required.</li></ul><p><em>Originally published at </em><a href="https://tilores.io/content/Company-name-normalization-isnt-enough-for-fuzzy-matching"><em>https://tilores.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=970ac8f1161c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tilo-tech/company-name-normalization-isnt-enough-for-fuzzy-matching-970ac8f1161c">Company Name Normalization Isn’t Enough for Fuzzy Matching</a> was originally published in <a href="https://medium.com/tilo-tech">Tilores</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Normalize Company Names for Deduplication and Matching]]></title>
            <link>https://medium.com/tilo-tech/how-to-normalize-company-names-for-deduplication-and-matching-21e9720b30ba?source=rss-d16936b140b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/21e9720b30ba</guid>
            <category><![CDATA[data-quality]]></category>
            <category><![CDATA[company-name]]></category>
            <category><![CDATA[data-matching]]></category>
            <category><![CDATA[normalization]]></category>
            <category><![CDATA[data-cleaning]]></category>
            <dc:creator><![CDATA[Sami Yaseen]]></dc:creator>
            <pubDate>Fri, 09 Feb 2024 11:04:55 GMT</pubDate>
            <atom:updated>2024-02-09T12:02:26.324Z</atom:updated>
            <content:encoded><![CDATA[<h4>Normalize company data to improve matching</h4><h4>The Problem</h4><p>Company names are written in many ways due to spelling variations, abbreviations, inclusion or omission of the legal form and different formatting. These inconsistencies can arise from human error, different conventions in naming, or changes in branding over time. Normalizing company names involves addressing these variations to avoid duplications, identify relationships between companies and facilitate company data management and analysis.</p><h3>Manual Method</h3><p>Normalizing company names manually involves a series of steps.</p><h4><strong>Whitespace Normalization</strong></h4><ul><li>Trim leading and trailing whitespace.</li><li>Replace consecutive whitespace characters with a single space.</li></ul><pre><strong>Example:</strong><br>&quot;     company   name Limited&quot; --&gt; &quot;company name limited&quot;</pre><h4><strong>Case Normalization</strong></h4><ul><li>Convert company names to lowercase or uppercase.</li></ul><h4><strong>Language Specific Normalization</strong></h4><ul><li>Normalize language-specific characters and convert characters with diacritics or accents to their base form for consistent handling.</li></ul><pre><strong>Example:</strong><br>Rénault --&gt; Renault</pre><h4>Legal Form Separation</h4><p>One significant reason for variations in company names is the inclusion or omission of the legal form. Additionally, variations in spelling, punctuation, and abbreviations of the legal form further contribute to the inconsistency of a company name representation.</p><p>Separating the company name from its legal form improves the matching of the base company name in case of different legal form abbreviations. It also helps distinguish between different types of companies based on the separated legal form if necessary.</p><p>Legal form detection would require knowledge of possible values and their potential variations. Here are some of the ways how this could be achieved:</p><ul><li>Creating a small list of most common values, such as “Inc.”, “Corp.”, “LLC”, “Ltd.”, “PLC”, “GmbH” etc. for a basic detection level.</li><li>Creating or using an existing reference list.</li><li>Using a database.</li></ul><pre>Example:<br>&quot;Abc Ltd.&quot;    --&gt; &quot;Abc&quot;,  &quot;Ltd.&quot;<br>&quot;Abc Limited&quot; --&gt; &quot;Abc&quot;,  &quot;Limited&quot;</pre><p>While this manual approach is feasible for small datasets, it becomes increasingly impractical as the number of potential legal variations increases and volume of data grows.</p><h3>Alternative Method: Using a Free Online Tool</h3><p>Tilores offers a free online text normalization tool which includes the steps needed to normalize company names and has its own list of legal forms that detects and separates legal form internationally and in multiple languages.</p><p>Using the tool is straightforward, simply upload your csv or jsonline containing company names, select your prefered normalization steps to perform and let the tool do the rest.</p><h4>Using the Tool for Company Name Normalization</h4><ol><li>Navigate to <a href="https://tilores.io/text-normalization-tool">https://tilores.io/text-normalization-tool</a></li><li>Upload your csv or jsonline file containing company names.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*udf_i4UjG8CCk-SZdFjxHA.png" /></figure><p>3. Select the company name field to normalize.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9QqTw8GUsGFjwUdD01pgCg.png" /></figure><p>4. Select the preferred normalization transformations. <br> (Normalize Spaces, Diacritics, Company Name)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x7X7lZBaLxMKWb_sq-voFQ.png" /></figure><p>5. Wait a few seconds and get your normalized file back.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*USR9PgITFfq2W8FQDaCJzQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*wlAA37tinAnbUHkcp1mstA.png" /><figcaption>Before and after Company Name Normalization</figcaption></figure><p>Try it at: <a href="https://tilores.io/text-normalization-tool">https://tilores.io/text-normalization-tool</a></p><p>Happy cleaning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21e9720b30ba" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tilo-tech/how-to-normalize-company-names-for-deduplication-and-matching-21e9720b30ba">How to Normalize Company Names for Deduplication and Matching</a> was originally published in <a href="https://medium.com/tilo-tech">Tilores</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Data Deduplication in Snowflake with Tilores]]></title>
            <link>https://medium.com/tilo-tech/automating-data-deduplication-in-snowflake-with-tilores-b9dbd5bc37b7?source=rss-d16936b140b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9dbd5bc37b7</guid>
            <category><![CDATA[identity-resolution]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[fuzzy-matching]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[fraud-detection]]></category>
            <dc:creator><![CDATA[Sami Yaseen]]></dc:creator>
            <pubDate>Fri, 11 Aug 2023 09:29:46 GMT</pubDate>
            <atom:updated>2026-05-18T15:25:04.671Z</atom:updated>
            <content:encoded><![CDATA[<h4>Detecting Free Trial Abuse using Identity Resolution with your Snowflake Customer Data</h4><h4>The problem</h4><p>Ending up with duplicate customer data is almost unavoidable, whether it is due to acquiring data from different sources, customers registering multiple times or mistakes made during manual data entry. Another possible cause of duplicate customer data is when customers sign up online multiple times, each time slightly changing their details, to take advantage of free trials or first-use discounts.</p><p>This leads to multiple rows in a table that represent the same customer, company or any other kind of entity. A classic identity resolution problem. So how can one solve this in Snowflake?</p><h4>What to expect?</h4><p>In this guide we will start with a Snowflake table that contains duplicated customer data and we will end up with another table introducing a new field (<strong>entity_id</strong>) which is a unique identifier for each customer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*5RYL0WP0jveygbtEn4KY-Q.png" /></figure><p>An <strong>entity_id </strong>will be automatically calculated for any new data added to the table.</p><h4>Create test table in Snowflake</h4><p>Create a new worksheet and run the following:</p><pre>CREATE DATABASE DEMO;<br><br>USE DATABASE DEMO;<br><br>CREATE or REPLACE TABLE customers(<br> &quot;id&quot; VARCHAR,<br> &quot;first_name&quot; VARCHAR,<br> &quot;last_name&quot; VARCHAR,<br> &quot;email&quot; VARCHAR<br>);<br><br>ALTER TABLE customers SET CHANGE_TRACKING = TRUE;<br><br>INSERT INTO customers VALUES<br>    (&#39;1&#39;, &#39;John&#39;, &#39;Smith&#39;, &#39;john.smith@example.com&#39;),<br>    (&#39;2&#39;, &#39;Jessica&#39;, &#39;Davis&#39;, &#39;jessica.davis@example.com&#39;),<br>    (&#39;3&#39;, &#39;John Robert&#39;, &#39;Smith&#39;, &#39;js@example.com&#39;),<br>    (&#39;4&#39;, &#39;Jane&#39;, &#39;Doe&#39;, &#39;jane@example.com&#39;),<br>    (&#39;5&#39;, &#39;J. Robert&#39;, &#39;Smith&#39;, &#39;js+1@example.com&#39;),<br>    (&#39;6&#39;, &#39;Jessika&#39;, &#39;Davis&#39;, &#39;jessd@example.com&#39;);<br><br>SELECT * from customers;</pre><p>Download the result as CSV. We will use this in the next step to automatically generate the matching rules.</p><h4>Connecting Snowflake to Tilores</h4><p>Sign up for a free Tilores account at <a href="https://app.tilores.io/">app.tilores.io</a>. After signing in choose “ <strong>Upload Data File</strong>”. And then upload the CSV file from the previous step, Then click “ <strong>Yes, use rules</strong> “ and complete the wizard. It will take around 3 minutes to finish setting up.</p><p>Now we will create an API integration which will allow Snowflake to make calls to Tilores.</p><blockquote><em>Snowflake will always be the one initiating the connection, sending and requesting data from Tilores, not the other way around.</em></blockquote><p>In the Tilores UI go to <strong>Integration — Snowflake</strong> and under the section “<strong>Where to get these values?</strong>” copy all the code sections and run them in a new worksheet in your Snowflake workspace.</p><p>The result of the last query should have <strong>API_AWS_IAM_USER_ARN</strong>, copy the value and use it in <strong>User ARN</strong> field in Tilores UI. Also copy the value of <strong>API_AWS_EXTERNAL_ID </strong>and use it in <strong>External ID</strong> in Tilores UI then click <strong>UPDATE </strong>to activate the connection.</p><p>The following banner should show:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*a2jjE7rnKA15HrbS" /></figure><p>Now Snowflake and Tilores are connected.</p><h4>Setup automatic entity identification in Snowflake</h4><p>Next we will create a task which will process any new data added to the <strong>customers </strong>table we created at the beginning and create a row with an <strong>entity_id </strong>in a new table <strong>customers_entities</strong>. Run the following in Snowflake:</p><pre>USE DATABASE DEMO;<br><br>ALTER TABLE customers SET CHANGE_TRACKING = TRUE;<br><br>CREATE or REPLACE TABLE customers_entities(<br>    &quot;entity_id&quot; VARCHAR,<br>    &quot;customer_id&quot; VARCHAR<br>);<br><br>CREATE OR REPLACE TABLE TILORES_CONFIG (<br>    name varchar(255) NOT NULL,<br>    value varchar(255) default NULL<br>);<br><br>INSERT INTO TILORES_CONFIG VALUES<br>    (&#39;last_sync&#39;, CURRENT_TIMESTAMP()::string),<br>    (&#39;fetch_on_next_run&#39;, &#39;true&#39;);<br><br>SELECT * FROM TILORES_CONFIG;<br>      <br>CREATE OR REPLACE TASK tilores_sync<br>    SCHEDULE = &#39;1 MINUTE&#39;<br>    AS<br>    DECLARE<br>        now STRING;<br>        last_sync STRING;<br>        fetch_on_next_run STRING;<br>    BEGIN <br>        now := (SELECT CURRENT_TIMESTAMP());<br>        last_sync := (SELECT value FROM TILORES_CONFIG WHERE name=&#39;last_sync&#39;);<br>        fetch_on_next_run := (SELECT value FROM TILORES_CONFIG WHERE name=&#39;fetch_on_next_run&#39;);<br>        <br>        SELECT tilores_ingest(OBJECT_CONSTRUCT(*)) AS ingested <br>        FROM (<br>            SELECT * EXCLUDE(METADATA$ACTION, METADATA$ISUPDATE, METADATA$ROW_ID)<br>            FROM customers<br>            CHANGES(INFORMATION =&gt; DEFAULT)<br>                AT(TIMESTAMP =&gt; to_timestamp_tz(:last_sync))<br>            WHERE METADATA$ACTION=&#39;INSERT&#39;);<br><br>        IF (fetch_on_next_run = &#39;true&#39;) THEN<br>            MERGE INTO customers_entities TARGET USING (SELECT tilores_entity_by_record_id(&quot;id&quot;):id AS &quot;entity_id&quot;, &quot;id&quot; FROM customers) SOURCE<br>            ON TARGET.&quot;customer_id&quot; = SOURCE.&quot;id&quot;<br>            WHEN MATCHED THEN<br>              UPDATE SET<br>                  TARGET.&quot;entity_id&quot; = SOURCE.&quot;entity_id&quot;<br>            WHEN NOT MATCHED THEN<br>              INSERT (&quot;entity_id&quot;, &quot;customer_id&quot;)<br>                  VALUES (SOURCE.&quot;entity_id&quot;, SOURCE.&quot;id&quot;);<br>        END IF;<br>            <br>        UPDATE TILORES_CONFIG<br>            SET value = :now<br>            WHERE name = &#39;last_sync&#39;;<br>        UPDATE TILORES_CONFIG<br>            SET value = (SELECT <br>                            CASE<br>                                WHEN count(*) &gt; 0 THEN &#39;true&#39;<br>                                ELSE &#39;false&#39;<br>                            END AS fetch_on_next_run<br>                        FROM customers<br>                        CHANGES(INFORMATION =&gt; DEFAULT)<br>                            AT(TIMESTAMP =&gt; to_timestamp_tz(:last_sync))<br>                        WHERE METADATA$ACTION=&#39;INSERT&#39;)<br>            WHERE name = &#39;fetch_on_next_run&#39;;<br>    END;<br><br>ALTER TASK tilores_sync RESUME;<br><br>SELECT *<br>FROM TABLE(information_schema.task_history())<br>ORDER BY scheduled_time;</pre><h4>Testing the automation</h4><p>After two minutes, a row is created in <strong>customers_entities </strong>for each customer. So if we perform a join we should be able to tell which customer rows belong to which actual customer.</p><pre>SELECT * EXCLUDE(&quot;customer_id&quot;)<br>FROM customers<br>LEFT JOIN customers_entities ON &quot;id&quot;=&quot;customer_id&quot;<br>ORDER BY &quot;id&quot;;</pre><p>Should result in:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*5RYL0WP0jveygbtEn4KY-Q.png" /></figure><p>Based on the entity ids, it shows that these rows represent only three actual customers.</p><p>And if we now add another customer with a similar name and a few spelling mistakes, and a different email domain. It should end up with the same <strong>entity_id </strong>as the first row.</p><pre>INSERT INTO customers VALUES<br>  (&#39;7&#39;, &#39;Johnn&#39;, &#39;Smeth&#39;, &#39;john.smith@otherDomain.com&#39;);</pre><p>Wait two minutes, then run the following again:</p><pre>SELECT * EXCLUDE(&quot;customer_id&quot;)<br>FROM customers<br>LEFT JOIN customers_entities ON &quot;id&quot;=&quot;customer_id&quot;<br>ORDER BY &quot;id&quot;;</pre><p>The result should now be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*189lxq8jDk1DmX088DC4jg.png" /></figure><p>In this case <strong>entity_id </strong>is the actual customer identifier.</p><h4>Conclusion - Identity Resolution in Snowflake</h4><p>By introducing unique entity IDs for customers, this identity resolution approach ensures an accurate customer 360 view in Snowflake and allows for easy customer segmentation for marketing. Further use cases include detecting duplicate account creation associated with free trial abuse.</p><p><em>Originally published at </em><a href="https://tilores.io/content/Automating-Data-Deduplication-in-Snowflake"><em>https://tilores.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9dbd5bc37b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tilo-tech/automating-data-deduplication-in-snowflake-with-tilores-b9dbd5bc37b7">Automating Data Deduplication in Snowflake with Tilores</a> was originally published in <a href="https://medium.com/tilo-tech">Tilores</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>