rockset / community

Rockset community content
Apache License 2.0
16 stars 6 forks source link

allow altering field mappings on an existing collections #1

Open veeve opened 5 years ago

veeve commented 5 years ago

Currently, field mappings need to be specified at collection creation time. Allow these to be altered on an existing collection.

veeve commented 5 years ago

For now, one will have to recreate the collection in order to modify field mappings.

That said, one can modify records that have already been loaded into a collection using the INSERT INTO SELECT statement.

For example - say you have a collection called users and want to anonymize a field called email_address into a new field email_hash and wipe out the original field email_address from the users collection, you can do:

INSERT INTO users(_id, email_hash, email_address)
SELECT _id, TO_HEX(SHA256(u.email_address)) as email_hash, null as email_address
FROM users u
WHERE u.email_address IS NOT null

If you use INSERT INTO SELECT, please note that without field mappings, data from new inserts/updates will not be anonymized, and you will have to re-run the statement above periodically to anonymize them.