Session#

from tmlt.analytics import Session
class tmlt.analytics.Session(accountant, public_sources)#

Bases: object

Allows differentially private query evaluation on sensitive data.

Sessions should not be directly constructed. Instead, they should be created using from_dataframe() or with a Builder.

A simple introduction to Session initialization and use can be found in the first and second tutorials.

Attributes

Session.private_sources

Returns the IDs of the private sources.

Session.public_source_dataframes

Returns a dictionary of public source DataFrames.

Session.public_sources

Returns the IDs of the public sources.

Session.remaining_privacy_budget

Returns the remaining privacy_budget left in the session.

Methods

Session.add_public_dataframe

Adds a public data source to the session.

Session.create_view

Creates a new view from a transformation and possibly cache it.

Session.delete_view

Deletes a view and decaches it if it was cached.

Session.describe

Describes this session, or one of its tables, or the result of a query.

Session.evaluate

Answers a query within the given privacy budget and returns a Spark dataframe.

Session.from_dataframe

Initializes a DP session from a Spark dataframe.

Session.get_column_types

Returns the column types for any data source.

Session.get_grouping_column

Returns an optional column that must be grouped by in this query.

Session.get_id_column

Returns the ID column of a table, if it has one.

Session.get_id_space

Returns the ID space of a table, if it has one.

Session.get_schema

Returns the schema for any data source.

Session.partition_and_create

Returns new sessions from a partition mapped to split name/source_id.

Session.stop

Closes out this Session, allowing other Sessions to become active.