Systems and methods for privacy-enhancing transformation of a SQL query
Systems and methods for obtaining a SQL query, translating the SQL into a modified SQL query incorporating a privacy mechanism, and outputting the modified SQL query incorporating the privacy mechanism. In some embodiments, the modified SQL query incorporating the privacy mechanism is forwarded to a SQL database.
1. A system for translating a SQL query into a SQL query incorporating a privacy mechanism, the system comprising:
a computer-readable data storage device containing program instructions; and
a processor, operably connected to the computer-readable data storage device, that executes the program instructions to perform operations comprising:
obtaining the SQL query;
translating the SQL query into a modified SQL query incorporating a histogram-based privacy mechanism configured to achieve differential privacy, wherein the translating comprises:
parsing the SQL query;
recursively translating the parsed SQL into an intermediate SQL query; and
incorporating the histogram-based privacy mechanism into the intermediate SQL query to produce the modified SQL query, wherein the histogram-based privacy mechanism utilizes a histogram to add noise to results produced by the modified SQL query; and
outputting the modified SQL query to a SQL database.
2. The system of claim 1 , wherein the privacy mechanism is configured to perform binning of data referred to in the SQL query by placing counts of the data in a plurality of bins.
3. The system of claim 2 , wherein the privacy mechanism is configured to add noise to data in at least one of the bins.
4. The system of claim 3 , wherein the query is modified to produce estimates of aggregate functions of data referred to in the SQL query from the histogram.
5. The system of claim 1 , wherein recursively translating the parsed SQL query comprises replacing at least one aggregate function with an SQL expression over a noisy histogram.
6. The system of claim 5 , wherein the SQL expression replacing the aggregate function utilizes the noisy histogram to approximate evaluation of the replaced aggregate function.
7. A method of translating a SQL query into a SQL query incorporating a privacy mechanism, comprising:
obtaining the SQL query;
translating the SQL query into a modified SQL query incorporating a histogram-based privacy mechanism configured to achieve differential privacy, wherein the translating comprises:
parsing the SQL query;
recursively translating the parsed SQL into an intermediate SQL query; and
incorporating the histogram-based privacy mechanism into the intermediate SQL query to produce the modified SQL query, wherein the histogram-based privacy mechanism utilizes a histogram to add noise to results produced by the modified SQL query; and
outputting the modified SQL query to a SQL database.
8. The method of claim 7 , wherein the privacy mechanism is configured to perform binning of data referred to in the SQL query by placing counts of the data in a plurality of bins.
9. The method of claim 8 , wherein the privacy mechanism is configured to add noise to data in at least one of the bins.
10. The method of claim 7 , wherein the query is modified to produce estimates of aggregate functions of data referred to in the SQL query from the histogram.
11. The method of claim 7 , wherein recursively translating the parsed SQL query comprises replacing at least one aggregate function with an SQL expression over a noisy histogram.
12. The method of claim 11 , wherein the SQL expression replacing the aggregate function utilizes the noisy histogram to approximate evaluation of the replaced aggregate function.