Skip to main content

private_sql_query

Private SQL query algorithm.

Classes

PrivateSqlQuery

class PrivateSqlQuery(    *, query: str, epsilon: float, delta: float, column_ranges: dict, **kwargs: Any,):

Simple algorithm for running a SQL query on a table, with privacy.

Arguments

  • query: The SQL query to execute.
  • epsilon: The maximum epsilon to use for the privacy budget.
  • delta: The target delta to use for the privacy budget.
  • column_ranges: A dictionary of column names and their ranges.

Raises

  • PrivateSqlError: If there is an error executing the private SQL query (e.g. DP misconfiguration or bad query specified).
  • ValueError: If a pod identifier is not supplied, or if a join is attempted.
note

The values provided for the privacy budget (i.e. epsilon and delta) will be applied individually to all columns included in the SQL query provided. If the total values of the epsilon and delta exceed the maximum allowed by the pod, the provided values will be reduced to the maximum values required to remain within the allowed privacy budget.

Ancestors

  • bitfount.federated.algorithms.base._BaseAlgorithmFactory
  • bitfount.federated.mixins._ModellessAlgorithmMixIn
  • abc.ABC
  • bitfount.federated.roles._RolesMixIn
  • bitfount.types._BaseSerializableObjectMixIn

Methods


def modeller(    self, **kwargs: Any,)> bitfount.federated.algorithms.private_sql_query._ModellerSide:

Returns the modeller side of the PrivateSqlQuery algorithm.

Arguments

  • `kwargs`**: Additional keyword arguments to pass to the modeller side.
def worker(    self, **kwargs: Any,)> bitfount.federated.algorithms.private_sql_query._WorkerSide:

Returns the worker side of the PrivateSqlQuery algorithm.

Arguments

  • `kwargs**: Additional keyword arguments to pass to the worker side. hub must be one of these keyword arguments which provides aBitfountHub` instance.

Variables

  • static column_ranges : dict - A dictionary of column names and their ranges.
  • static delta : float - The target delta to use for the privacy budget.
  • static epsilon : float - The maximum epsilon to use for the privacy budget.
  • static query : str - The SQL query to execute.
  • static table : Optional[str] - The table on which the query will be executed.