|
| 1 | +--- |
| 2 | +title: OBFUSCATE |
| 3 | +--- |
| 4 | + |
| 5 | +Dataset anonymization. This is a quick tool, and for more complex scenarios, it is recommended to directly use the underlying function [MARKOV_TRAIN](../07-aggregate-functions/aggregate-markov-train.md), [MARKOV_GENERATE](../20-other-functions/markov_generate.md), [FEISTEL_OBFUSCATE](../20-other-functions/feistel_obfuscate.md). |
| 6 | + |
| 7 | +## Syntax |
| 8 | + |
| 9 | +```sql |
| 10 | +OBFUSCATE('<table>'[, seed => <seed>]) |
| 11 | +``` |
| 12 | + |
| 13 | +## Examples |
| 14 | + |
| 15 | +```sql |
| 16 | +create or replace table users as |
| 17 | +select * from (values |
| 18 | +( 1, 'James Smith', '[email protected]', '123 Fake St, Anytown, CA 91234'), |
| 19 | +( 2, 'Mary Johnson', '[email protected]', '456 Fictional Ave, Springfield, IL 62704'), |
| 20 | +( 3, 'John Williams', '[email protected]', '789 Imaginary Ln, Pleasantville, NY 10570'), |
| 21 | +( 4, 'Patricia Brown', '[email protected]', '101 Nonexistent Rd, Metropolis, KS 66666'), |
| 22 | +( 5, 'Robert Jones', '[email protected]', '222 Make Believe Dr, Smallville, OH 44688'), |
| 23 | +( 6, 'Jennifer Garcia', '[email protected]', '333 Phantom Ct, Gotham, NJ 07005'), |
| 24 | +( 7, 'Michael Miller', '[email protected]', '444 Unreal Blvd, Wonderland, TX 75001'), |
| 25 | +( 8, 'Linda Davis', '[email protected]', '555 Fabricated Way, Neverland, FL 32801'), |
| 26 | +( 9, 'William Rodriguez', '[email protected]', '666 Bogus Pl, Oz, KS 67445'), |
| 27 | +( 10, 'Elizabeth Martinez', '[email protected]', '777 Sham Ln, Camelot, CA 90210'), |
| 28 | +( 11, 'James Johnson', '[email protected]', '888 Pretend Ave, Atlantis, GA 30303'), |
| 29 | +( 12, 'Mary Williams', '[email protected]', '999 Simulated Rd, Utopia, MI 48009'), |
| 30 | +( 13, 'John Brown', '[email protected]', '1010 Counterfeit St, El Dorado, AR 71730'), |
| 31 | +( 14, 'Patricia Jones', '[email protected]', '10 Counterfeit St, El Dorado, AR 71730'), |
| 32 | +( 15, 'Robert Garcia', '[email protected]', '1111 Phony Ln, Shangri-La, CO 80014'), |
| 33 | +( 16, 'Jennifer Miller', '[email protected]', '1212 Artificial Dr, Rivendell, WA 98101'), |
| 34 | +( 17, 'Michael Davis', '[email protected]', '1313 Spurious Ave, Narnia, TN 37201'), |
| 35 | +( 18, 'Linda Rodriguez', '[email protected]', '1414 Pseudo Rd, Brigadoon, PA 19003'), |
| 36 | +( 19, 'William Martinez', '[email protected]', '1515 Feigned St, Never Never Land, CA 90210'), |
| 37 | +( 20, 'Elizabeth Smith', '[email protected]', '1616 Imitation Ln, Asgard, NY 10001'), |
| 38 | +( 21, 'James Williams', '[email protected]', '1717 Simulated Ave, Middle Earth, OR 97006'), |
| 39 | +( 22, 'Mary Brown', '[email protected]', '123 Fake St, Anytown, CA 91234'), |
| 40 | +( 23, 'John Jones', '[email protected]', '456 Fictitious Ave, Springfield, IL 62704'), |
| 41 | +( 24, 'Patricia Garcia', '[email protected]', '789 Illusion Ln, Pleasantville, NY 10570'), |
| 42 | +( 25, 'Robert Miller', '[email protected]', '101 Imaginary Rd, Metropolis, KS 66666'), |
| 43 | +( 26, 'Jennifer Davis', '[email protected]', '222 Make Believe Dr, Neverland, FL 33333'), |
| 44 | +( 27, 'Michael Rodriguez', '[email protected]', '333 Pretend Ct, Wonderland, TX 77777'), |
| 45 | +( 28, 'Linda Martinez', '[email protected]', '444 Fabricated Blvd, Utopia, WA 98101'), |
| 46 | +( 29, 'William Smith', '[email protected]', '555 Sham Way, Mirage, AZ 85001'), |
| 47 | +( 30, 'Elizabeth Johnson', '[email protected]', '666 Bogus Pl, Fantasyland, GA 30303'), |
| 48 | +( 31, 'James Brown', '[email protected]', '777 Unreal Ave, Dreamville, CO 80202'), |
| 49 | +( 32, 'Mary Jones', '[email protected]', '888 Counterfeit Ln, Wishville, OH 44114'), |
| 50 | +( 33, 'John Garcia', '[email protected]', '999 Phony Rd, Delusion, MI 48075'), |
| 51 | +( 34, 'Patricia Miller', '[email protected]', '1010 Simulated St, Echo, NV 89109'), |
| 52 | +( 35, 'Robert Davis', '[email protected]', '1111 Spurious Ave, Replica, PA 19103'), |
| 53 | +( 36, 'Jennifer Rodriguez', '[email protected]', '1212 Artificial Dr, Clone, NC 27601'), |
| 54 | +( 37, 'Michael Martinez', '[email protected]', '1313 Synthetic Ct, Duplicate, TN 37201'), |
| 55 | +( 38, 'Linda Smith', '[email protected]', '1414 Feigned Blvd, Imposter, IN 46204'), |
| 56 | +( 39, 'William Johnson', '[email protected]', '1515 Pseudo Pl, Mimic, MN 55401'), |
| 57 | +( 40, 'Elizabeth Williams', '[email protected]', '1616 Forged Way, Facsimile, AL 35203') |
| 58 | +) users(id, name, email, address); |
| 59 | + |
| 60 | + |
| 61 | +select * from obfuscate(users, seed=>10) limit 5 offset 20; |
| 62 | +╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ |
| 63 | +│ id │ name │ email │ address │ |
| 64 | +│ Nullable(UInt64) │ Nullable(String) │ Nullable(String) │ Nullable(String) │ |
| 65 | +├──────────────────┼───────────────────┼───────────────────────────┼─────────────────────────────────────────┤ |
| 66 | +│ 21 │ William Rodriguez │ michael.davis@example.com │ 1212 Artificial Dr, Rivendell, WA 98101 │ |
| 67 | +│ 16 │ Jennifer Garcia │ patricia.brown@gmail │ 1313 Spurious Ave, NC 27601 │ |
| 68 | +│ 25 │ John Brown │ michael.martinez@example │ 1111 Phony Ln, Asgard, NY 10570 │ |
| 69 | +│ 30 │ Mary Brown │ jennifer.garcia@gmail.com │ 222 Make Believe Dr, Clone, NC 27601 │ |
| 70 | +│ 24 │ James Smith │ elizabeth.johnson@example │ 444 Fabricated St, Anytown, CA 90210 │ |
| 71 | +╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ |
| 72 | +``` |
0 commit comments