Table#

class Table#

A class representing an encrypted database. This Table supports the calculation of some data analysis functions on tabular data.

average_query(*args, **kwargs)#

Overloaded function.

  1. average_query(self: pyhelayers.Table, average_field: str, field_to_compare: str, compare_value: pyhelayers.Field, ct: pyhelayers.ComparisonType) -> pyhelayers.FieldVector

    Average of “average_field” elements, where “field_to_compare” satisfies the given comparison condition. Use post_process_average_query() to extract the required average from the return value of this function.

    param average_field:

    The name of the field to compute average for.

    type average_field:

    string

    param field_to_compare:

    The name of the field to apply the comparison condition on.

    type field_to_compare:

    string

    param compare_value:

    The value to compare with.

    type compare_value:

    Field

    param ct:

    The comparison type.

    type ct:

    comparison_type

    rtype:

    FieldVector

    raises RuntimeError:

    If this table was initialized with “inverse_optimsation_on” set to False and “ct” is not “IS_EQUAL”.

  2. average_query(self: pyhelayers.Table, average_field: str) -> Tuple[pyhelayers.Field, int]

    Average of “average_field” elements. Use post_process_average_query() to extract the required average from the return value of this function.

    param average_field:

    The name of the field to compute average for.

    type average_field:

    string

    rtype:

    tuple of (Field, int)

count_query(self: pyhelayers.Table, field_to_compare: str, compare_value: pyhelayers.Field, ct: pyhelayers.ComparisonType) pyhelayers.Field#

Number of elements of “field_to_compare” satisfying the given comparison condition. Use postProcessCountQuery() to extract the count result from the return value of this function.

Parameters:
  • field_to_compare (string) – The name of the field to apply the comparison condition on.

  • compare_value (Field) – The value to compare with.

  • ct (comparison_type) – The comparison type.

Return type:

Field

Raises:

RuntimeError – If this table was initialized with “inverse_optimsation_on” set to False and “ct” is not “IS_EQUAL”.

create_compare_value(*args, **kwargs)#

Overloaded function.

  1. create_compare_value(self: pyhelayers.Table, value_to_seek: int, column_name: str, is_signed: bool = False) -> pyhelayers.Field

    Creates a hybrid bitwise value to be used in comparison queries.

    param value_to_seek:

    The compare value to use in the comparison.

    type value_to_seek:

    int

    param column_name:

    The name of the column which is intended to be compared with the given value.

    type column_name:

    string

    param is_signed:

    Whether the comparison value is signed. Defaults to False.

    type is_signed:

    bool

    rtype:

    Field

  2. create_compare_value(self: pyhelayers.Table, value_to_seek: int, bit_len: int, is_signed: bool = False) -> pyhelayers.Field

    Creates a hybrid bitwise value to be used in comparison queries.

    param value_to_seek:

    The compare value to use in the comparison.

    type value_to_seek:

    int

    param bit_len:

    The number of bits that should be used to represent the comparison value.

    type bit_len:

    int

    param is_signed:

    Whether the comparison value is signed. Defaults to False.

    type is_signed:

    bool

    rtype:

    Field

create_indicators_for_col(self: pyhelayers.Table, col_name: str, val_to_compare: pyhelayers.Field, ct: pyhelayers.ComparisonType, mult_by_mask: bool = False) std::vector<std::shared_ptr<helayers::Field>, std::allocator<std::shared_ptr<helayers::Field> > >#

Applies the given comparison condition on the entries of the specified column, and returns a vector of indicators representing the comparison results. The ith Field in the returned vector contains the indicators corresponding to the ith Field in the specified column.

Parameters:
  • col_name (string) – The name of the column to create indicators for.

  • val_to_compare (Field) – The value to compare the column Fields with.

  • ct (FieldType) – comparison type.

  • mult_by_mask (bool) – If true, the resulting indicators will be multiplied by the stored mask. Defautls to False.

Return type:

FieldVector

get_cell_content(self: pyhelayers.Table, col_name: str, row_num: int) pyhelayers.CTileVector#

Returns a CTile containing the column values in the Field with the given index.

Parameters:
  • col_name (string) – The name of the column to extract the content from.

  • row_num (int) – The index of the Field to be extracted from the specified column.

Return type:

CTileVector

get_num_of_rows(self: pyhelayers.Table) int#

Returns the number of entries in this database.

mult_indicators(self: pyhelayers.Table, col_name: str, indicators: std::vector<std::shared_ptr<helayers::Field>, std::allocator<std::shared_ptr<helayers::Field> > >) std::vector<std::shared_ptr<helayers::Field>, std::allocator<std::shared_ptr<helayers::Field> > >#

Multiplies the given set of indicators.

Parameters:
  • col_name (string) – The name of the column the given indicators are created for.

  • indicators (FieldVector) – The indicators to multiply.

Return type:

FieldVector

post_process_average_query(*args, **kwargs)#

Overloaded function.

  1. post_process_average_query(self: pyhelayers.Table, query_res: pyhelayers.FieldVector) -> float

    Applies post-processing on the result of an average_query and returns the average result. This function assumes that the HeContext stored in this Table object contains the secret key.

    param query_res:

    The result of an average_query.

    type query_res:

    FieldVector

    rtype:

    double

  2. post_process_average_query(self: pyhelayers.Table, query_res: Tuple[pyhelayers.Field, int]) -> float

    Applies post-processing on the result of an average_query and returns the average result. This function assumes that the HeContext stored in this Table object contains the secret key.

    param query_res:

    The result of an average_query.

    type query_res:

    tuple of (Field, int)

    rtype:

    double

  3. post_process_average_query(self: pyhelayers.Table, query_res: Tuple[pyhelayers.FieldVector, int]) -> float

    Applies post-processing on the result of a standard_deviation_query and returns the standard deviation result. This function assumes that the HeContext stored in this Table object contains the secret key.

    param query_res:

    The result of a standard_deviation_query.

    type query_res:

    tuple of (FieldVector, int)

    rtype:

    double

post_process_count_query(self: pyhelayers.Table, query_res: pyhelayers.Field) int#

Applies post-processing on the result of a count_query and returns the counting result. This function assumes that the HeContext stored in this Table object contains the secret key.

Parameters:

query_res (Field) – The result of a count_query.

Return type:

double

post_process_std_dev_query(self: pyhelayers.Table, query_res: pyhelayers.FieldVector) float#

Applies post-processing on the result of a standard_deviation_query and returns the standard deviation result. This function assumes that the HeContext stored in this Table object contains the secret key.

Parameters:

query_res (FieldVector) – The result of a standard_deviation_query.

Return type:

double

post_process_sum_query(self: pyhelayers.Table, query_res: pyhelayers.Field) float#

Applies post-processing on the result of a sum_query and returns the sum value. This function assumes that the HeContext stored in this Table object contains the secret key.

Parameters:

query_res (Field) – The result of a sum_query.

Return type:

double

post_process_sum_squares_query(self: pyhelayers.Table, query_res: pyhelayers.Field) float#

Applies post-processing on the result of a sum_squares_query and returns the sum squares value. This function assumes that the HeContext stored in this Table object contains the secret key.

Parameters:

query_res (Field) – The result of a sum_squares_query

Return type:

double

set_inverse_optimization(self: pyhelayers.Table, flag: bool) None#

Sets inverseOptimisation flag to the given value.

Parameters:

flag (bool) – The value to set.

Return type:

void

standard_deviation_query(*args, **kwargs)#

Overloaded function.

  1. standard_deviation_query(self: pyhelayers.Table, std_dev_field: str, field_to_compare: str, compare_value: pyhelayers.Field, ct: pyhelayers.ComparisonType) -> pyhelayers.FieldVector

    Standard deviation of “std_dev_field” elements, where “field_to_compare” satisfies the given comparison condition. Use post_process_std_dev_query() to extract the required standard deviation from the return value of this function.

    param std_dev_field:

    The name of the field to compute standard deviation for.

    type std_dev_field:

    string

    param field_to_compare:

    The name of the field to apply the comparison condition on.

    type field_to_compare:

    string

    param compare_value:

    The value to compare with.

    type compare_value:

    Field

    param ct:

    The comparison type.

    type ct:

    comparison_type

    rtype:

    FieldVector

    raises RuntimeError:

    If this table was initialized with “inverse_optimsation_on” set to False and “ct” is not “IS_EQUAL”.

  2. standard_deviation_query(self: pyhelayers.Table, std_dev_field: str) -> Tuple[pyhelayers.FieldVector, int]

    Standard deviation of “std_dev_field” elements. Use post_process_std_dev_query() to extract the required standard deviation from the return value of this function.

    param std_dev_field:

    The name of the field to compute standard deviation for.

    type std_dev_field:

    string

    rtype:

    tuple of (FieldVector, int)

sum_query(*args, **kwargs)#

Overloaded function.

  1. sum_query(self: pyhelayers.Table, field_to_sum: str, field_to_compare: str, compare_value: pyhelayers.Field, ct: pyhelayers.ComparisonType) -> pyhelayers.Field

    Sum of “field_to_sum” elements, where “field_to_compare” satisfies the given comparison condition. Use post_process_sum_query() to extract the sum value from the return value of this function.

    param field_to_sum:

    The name of the field to sum.

    type field_to_sum:

    string

    param field_to_compare:

    The name of the field to apply the comparison condition on.

    type field_to_compare:

    string

    param compare_value:

    The value to compare with.

    type compare_value:

    Field

    param ct:

    The comparison type.

    type ct:

    comparison_type

    rtype:

    Field

    raises RuntimeError:

    If this table was initialized with “inverse_optimsation_on” set to False and “ct” is not “IS_EQUAL”.

  2. sum_query(self: pyhelayers.Table, field_to_sum: str) -> pyhelayers.Field

    Sum “field_to_sum” elements. Use post_process_sum_query() to extract the sum value from the return value of this function.

    param field_to_sum:

    The name of the column to sum.

    type field_to_sum:

    string

    rtype:

    Field

sum_squares_query(*args, **kwargs)#

Overloaded function.

  1. sum_squares_query(self: pyhelayers.Table, sum_squares_field: str, field_to_compare: str, compare_value: pyhelayers.Field, ct: pyhelayers.ComparisonType) -> pyhelayers.Field

    Sum squares of “sum_squares_field” elements, where “field_to_compare” satisfies the given comparison condition.

    param sum_squares_field:

    The name of the field to compute sum squares for.

    type sum_squares_field:

    string

    param field_to_compare:

    The name of the field to apply the comparison condition on.

    type field_to_compare:

    string

    param compare_value:

    The value to compare with.

    type compare_value:

    Field

    param ct:

    The comparison type.

    type ct:

    comparison_type

    rtype:

    Field

    raises RuntimeError:

    If this table was initialized with “inverse_optimsation_on” set to False and “ct” is not “IS_EQUAL”.

  2. sum_squares_query(self: pyhelayers.Table, sum_squares_field: str) -> pyhelayers.Field

    Sum of squares of “sum_squares_field” elements. Use post_process_sum_squares_query() to extract the sum value from the return value of this function.

    param sum_squares_field:

    The name of the column to compute sum squares for.

    type sum_squares_field:

    string

    rtype:

    Field