Client
Classes:
-
Bound–Any type that supports ordering comparisons (< and >).
-
Client–Client class to send requests to the server.
Bound
#
flowchart TD
lomas_client.client.Bound[Bound]
click lomas_client.client.Bound href "" "lomas_client.client.Bound"
Any type that supports ordering comparisons (< and >).
Client
#
Client(**kwargs: model_config)
Client class to send requests to the server.
Handle all serialisation and deserialisation steps
Parameters:
-
(kwargs#model_config, default:{}) –All keyword arguments will be forwarded to the ClientConfig
Methods:
-
get_dataset_metadata–This function retrieves metadata for the dataset.
-
get_column_metadata–This function retrieves metadata for the column.
-
get_column_bounds–This function retrieves metadata bounds for the column.
-
get_diffprivlib_bounds–Get bounds for a list of columns in diffprivlib expected format.
-
get_dummy_dataset–This function retrieves a dummy dataset with optional parameters.
-
get_context–Create an OpenDP context based on a dummy dataset.
-
get_initial_budget–This function retrieves the initial budget.
-
get_total_spent_budget–This function retrieves the total spent budget.
-
get_remaining_budget–This function retrieves the remaining budget.
-
get_previous_queries–This function retrieves the previous queries of the user.
Source code in client/lomas_client/client.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
get_dataset_metadata
#
This function retrieves metadata for the dataset.
Returns: A dictionary containing dataset metadata.
Source code in client/lomas_client/client.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
get_column_metadata
#
This function retrieves metadata for the column.
Returns: A dictionary containing column metadata.
Source code in client/lomas_client/client.py
97 98 99 100 101 102 103 104 105 106 107 108 109 | |
get_column_bounds
#
This function retrieves metadata bounds for the column.
Returns: A tuple of (minimum_bound, maximum_bound)
Source code in client/lomas_client/client.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
get_diffprivlib_bounds
#
Get bounds for a list of columns in diffprivlib expected format.
Source code in client/lomas_client/client.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
get_dummy_dataset
#
get_dummy_dataset(
nb_rows: int = DUMMY_NB_ROWS, seed: int = DUMMY_SEED, lazy: bool = False
) -> DataFrame | LazyFrame
This function retrieves a dummy dataset with optional parameters.
Parameters:
-
(nb_rows#int, default:DUMMY_NB_ROWS) –The number of rows in the dummy dataset. Defaults to DUMMY_NB_ROWS.
-
(seed#int, default:DUMMY_SEED) –The random seed for generating the dummy dataset. Defaults to DUMMY_SEED.
-
(lazy#bool, default:False) –If True, return a polars LazyFrame. Defaults to False (pandas DataFrame)
Returns:
-
DataFrame | LazyFrame–pd.DataFrame | pl.LazyFrame: A Pandas DataFrame representing
-
DataFrame | LazyFrame–the dummy dataset (optionally in LazyFrame format).
Source code in client/lomas_client/client.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
get_context
#
get_context(
epsilon: float | None = None, delta: float | None = None, rho: float | None = None
) -> Context
Create an OpenDP context based on a dummy dataset.
This can be used to build an OpenDP pipeline locally on the client side.
Parameters:
-
(epsilon#float | None, default:None) –Privacy parameter to be spent. Required for pure DP or approximate DP (Laplace mechanism). Defaults to None.
-
(delta#float | None, default:None) –Required if the pipeline measurement uses ZeroConcentratedDivergence (e.g., with make_gaussian) and is converted to SmoothedMaxDivergence using make_zCDP_to_approxDP. See: https://docs.smartnoise.org/sql/advanced.html#postprocess Defaults to None.
-
(rho#float | None, default:None) –Privacy parameter used for zCDP or approximate zCDP (Gaussian mechanism). Cannot be used if epsilon is provided.
Returns:
-
Context–dp.Context: OpenDP context object initialized with metadata and
-
Context–user-provided privacy parameters.
Source code in client/lomas_client/client.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
get_initial_budget
#
get_initial_budget() -> InitialBudgetResponse
This function retrieves the initial budget.
Returns:
-
InitialBudgetResponse(InitialBudgetResponse) –A dictionary containing the initial budget.
Source code in client/lomas_client/client.py
221 222 223 224 225 226 227 228 229 230 231 232 233 | |
get_total_spent_budget
#
get_total_spent_budget() -> SpentBudgetResponse
This function retrieves the total spent budget.
Returns:
-
SpentBudgetResponse(SpentBudgetResponse) –A dictionary containing the total spent budget.
Source code in client/lomas_client/client.py
235 236 237 238 239 240 241 242 243 244 245 246 247 | |
get_remaining_budget
#
get_remaining_budget() -> RemainingBudgetResponse
This function retrieves the remaining budget.
Returns:
-
RemainingBudgetResponse(RemainingBudgetResponse) –A dictionary containing the remaining budget.
Source code in client/lomas_client/client.py
249 250 251 252 253 254 255 256 257 258 259 260 261 | |
get_previous_queries
#
This function retrieves the previous queries of the user.
Raises:
-
ValueError–If an unknown query type is encountered during deserialization.
Returns:
-
list[dict]–List[dict]: A list of dictionary containing
-
list[dict]–the different queries on the private dataset.
Source code in client/lomas_client/client.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
Classes:
-
LomasHttpClient–A client for interacting with the Lomas API.
LomasHttpClient
#
LomasHttpClient(config: ClientConfig)
A client for interacting with the Lomas API.
Methods:
-
post–Executes a POST request to endpoint with the provided JSON body.
-
wait_for_job–Periodically query the job endpoint sleeping in between until it completes / times-out.
Source code in client/lomas_client/http_client.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
post
#
post(
endpoint: str, body: LomasRequestModel, read_timeout: int = DEFAULT_READ_TIMEOUT
) -> Response
Executes a POST request to endpoint with the provided JSON body.
Handles authorization to the api by automatically fetching a token if required.
Parameters:
-
(endpoint#str) –The API endpoint to which the request will be sent.
-
(body#LomasRequestModel) –The body to include in the POST request.
-
(read_timeout#int, default:DEFAULT_READ_TIMEOUT) –number of seconds that client wait for the server to send a response. Defaults to DEFAULT_READ_TIMEOUT.
Returns:
-
Response–requests.Response: The response object resulting from the POST request.
Source code in client/lomas_client/http_client.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
wait_for_job
#
Periodically query the job endpoint sleeping in between until it completes / times-out.
Source code in client/lomas_client/http_client.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
Classes:
-
DiffPrivLibClient–A client for executing and estimating the cost of DiffPrivLib queries.
DiffPrivLibClient
#
DiffPrivLibClient(http_client: LomasHttpClient)
A client for executing and estimating the cost of DiffPrivLib queries.
Methods:
-
cost–This function estimates the cost of executing a DiffPrivLib query.
-
query–Trains a DiffPrivLib pipeline and return a trained Pipeline.
Source code in client/lomas_client/libraries/diffprivlib.py
21 22 | |
cost
#
cost(
pipeline: Pipeline,
feature_columns: list[str] | None = None,
target_columns: list[str] | None = None,
test_size: float = 0.2,
test_train_split_seed: int = 1,
imputer_strategy: str = "drop",
) -> CostResponse
This function estimates the cost of executing a DiffPrivLib query.
Parameters:
-
(pipeline#pipeline) –DiffPrivLib pipeline with three conditions: - The pipeline MUST start with a
models.StandardScaler. Otherwise a PrivacyLeakWarning is raised by DiffPrivLib library and is treated as an error in lomas server.random_statefields can only be int (RandomStatewill not work).accountantfields must be None.
Note: as in DiffPrivLib, avoid any DiffprivlibCompatibilityWarning to ensure that the pipeline does what is intended.
-
(feature_columns#list[str], default:None) –the list of feature column to train
-
(target_columns#list[str], default:None) –the list of target column to predict May be None for certain models.
-
(test_size#float, default:0.2) –proportion of the test set Defaults to 0.2.
-
(test_train_split_seed#int, default:1) –seed for random train test split Defaults to 1.
-
(imputer_strategy#str, default:'drop') –imputation strategy. Defaults to "drop". "drop": will drop all rows with missing values "mean": will replace values by the mean of the column values "median": will replace values by the median of the column values "most_frequent": will replace values by the most frequent values
Returns:
-
CostResponse–Optional[dict[str, float]]: A dictionary containing the estimated cost.
Source code in client/lomas_client/libraries/diffprivlib.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
query
#
query(
pipeline: Pipeline,
feature_columns: list[str],
target_columns: list[str] | None = None,
test_size: float = 0.2,
test_train_split_seed: int = 1,
imputer_strategy: str = "drop",
dummy: bool = False,
nb_rows: int = DUMMY_NB_ROWS,
seed: int = DUMMY_SEED,
) -> QueryResponse
Trains a DiffPrivLib pipeline and return a trained Pipeline.
Parameters:
-
(pipeline#pipeline) –DiffPrivLib pipeline with three conditions: - The pipeline MUST start with a
models.StandardScaler. Otherwise a PrivacyLeakWarning is raised by DiffPrivLib library and is treated as an error in lomas server. -random_statefields can only be int (RandomStatewill not work). -accountantfields must be None.Note: as in DiffPrivLib, avoid any DiffprivlibCompatibilityWarning to ensure that the pipeline does what is intended.
-
(feature_columns#list[str]) –the list of feature column to train
-
(target_columns#list[str], default:None) –the list of target column to predict May be None for certain models.
-
(test_size#float, default:0.2) –proportion of the test set Defaults to 0.2.
-
(test_train_split_seed#int, default:1) –seed for random train test split Defaults to 1.
-
(imputer_strategy#str, default:'drop') –imputation strategy. Defaults to "drop". "drop": will drop all rows with missing values "mean": will replace values by the mean of the column values "median": will replace values by the median of the column values "most_frequent": : will replace values by the most frequent values
-
(dummy#bool, default:False) –Whether to use a dummy dataset. Defaults to False.
-
(nb_rows#int, default:DUMMY_NB_ROWS) –The number of rows in the dummy dataset. Defaults to DUMMY_NB_ROWS.
-
(seed#int, default:DUMMY_SEED) –The random seed for generating the dummy dataset. Defaults to DUMMY_SEED.
Returns:
-
QueryResponse–Optional[Pipeline]: A trained DiffPrivLip pipeline
Source code in client/lomas_client/libraries/diffprivlib.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
Classes:
-
OpenDPClient–A client for executing and estimating the cost of OpenDP queries.
OpenDPClient
#
OpenDPClient(http_client: LomasHttpClient)
A client for executing and estimating the cost of OpenDP queries.
Methods:
-
cost–This function estimates the cost of executing an OpenDP query.
-
query–This function executes an OpenDP query.
Source code in client/lomas_client/libraries/opendp.py
21 22 | |
cost
#
cost(
opendp_pipeline: LazyFrameQuery | LazyFrame,
epsilon: float | None = None,
delta: float | None = None,
rho: float | None = None,
approx_zcdp: bool = True,
) -> CostResponse
This function estimates the cost of executing an OpenDP query.
Parameters:
-
(opendp_pipeline#Measurement) –The OpenDP pipeline for the query.
-
(epsilon#float, default:None) –Privacy parameter that will be spent. For pure-DP or approximate DP this must be set. (Laplace mechanism)
-
(delta#Optional[float], default:None) –If the pipeline measurement is of type “ZeroConcentratedDivergence” (e.g. with make_gaussian) then it is converted to “SmoothedMaxDivergence” with make_zCDP_to_approxDP (
See Smartnoise-SQL postprocessing documentation. <https://docs.smartnoise.org/sql/advanced.html#postprocess>__). In that case a delta must be provided by the user. Defaults to None. -
(rho#float, default:None) –Privacy parameter used for zCDP or approximate-zCDP (Gaussian mechanism). Cannot be used if epsilon is not None.
-
(approx_zcdp#bool, default:True) –If false, delta is used to compute the epsilon consumption equivalent when user wants to use zCDP. Default True.
Raises: Exception: If the opendp_pipeline type is not suppported.
Returns:
-
CostResponse(CostResponse) –The estimated cost.
Source code in client/lomas_client/libraries/opendp.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
query
#
query(
opendp_pipeline: LazyFrameQuery | LazyFrame,
epsilon: float | None = None,
delta: float | None = None,
rho: float | None = None,
approx_zcdp: bool = True,
dummy: bool = False,
nb_rows: int = DUMMY_NB_ROWS,
seed: int = DUMMY_SEED,
) -> QueryResponse
This function executes an OpenDP query.
Parameters:
-
(opendp_pipeline#Measurement) –The OpenDP pipeline for the query. Can be a dp.Measurement or a polars LazyFrame (plan) for opendp.polars pipelines.
-
(epsilon#float, default:None) –Privacy parameter that will be spent. For pure-DP or approximate DP this must be set. (Laplace mechanism)
-
(delta#Optional[float], default:None) –If the pipeline measurement is of type “ZeroConcentratedDivergence” (e.g. with make_gaussian) then it is converted to “SmoothedMaxDivergence” with make_zCDP_to_approxDP (
See Smartnoise-SQL postprocessing documentation. <https://docs.smartnoise.org/sql/advanced.html#postprocess>__). In that case a delta must be provided by the user. Defaults to None. -
(rho#float, default:None) –Privacy parameter used for zCDP or approximate-zCDP (Gaussian mechanism). Cannot be used if epsilon is not None.
-
(approx_zcdp#bool, default:True) –If false, delta is used to compute the epsilon consumption equivalent when user wants to use zCDP. Default True.
-
(dummy#bool, default:False) –Whether to use a dummy dataset. Defaults to False.
-
(nb_rows#int, default:DUMMY_NB_ROWS) –The number of rows in the dummy dataset. Defaults to DUMMY_NB_ROWS.
-
(seed#int, default:DUMMY_SEED) –The random seed for generating the dummy dataset. Defaults to DUMMY_SEED.
Raises:
-
Exception–If the opendp_pipeline type is not suppported.
Returns:
-
QueryResponse(QueryResponse) –A dictionary of the response body containing the deserialized pipeline result.
Source code in client/lomas_client/libraries/opendp.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
Classes:
-
SmartnoiseSQLClient–A client for executing and estimating the cost of SmartNoise SQL queries.
SmartnoiseSQLClient
#
SmartnoiseSQLClient(http_client: LomasHttpClient)
A client for executing and estimating the cost of SmartNoise SQL queries.
Methods:
-
cost–This function estimates the cost of executing a SmartNoise query.
-
query–This function executes a SmartNoise SQL query.
Source code in client/lomas_client/libraries/smartnoise_sql.py
15 16 | |
cost
#
cost(
query: str, epsilon: float, delta: float, mechanisms: dict[str, str] | None = None
) -> CostResponse
This function estimates the cost of executing a SmartNoise query.
Parameters:
-
(query#str) –The SQL query to estimate the cost for. NOTE: the table name is df, the query must end with “FROM df”.
-
(epsilon#float) –Privacy parameter (e.g., 0.1).
-
(delta#float) –Privacy parameter (e.g., 1e-5). mechanisms (dict[str, str], optional): Dictionary of mechanisms for the query
See Smartnoise-SQL postprocessing documentation. <https://docs.smartnoise.org/sql/advanced.html#postprocess>__ Defaults to {}.
Returns:
-
CostResponse(CostResponse) –The estimated cost.
Source code in client/lomas_client/libraries/smartnoise_sql.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
query
#
query(
query: str,
epsilon: float,
delta: float,
mechanisms: dict[str, str] | None = None,
postprocess: bool = True,
dummy: bool = False,
nb_rows: int = DUMMY_NB_ROWS,
seed: int = DUMMY_SEED,
) -> QueryResponse
This function executes a SmartNoise SQL query.
Parameters:
-
(query#str) –The SQL query to execute. NOTE: the table name is df, the query must end with “FROM df”.
-
(epsilon#float) –Privacy parameter (e.g., 0.1).
-
(delta#float) –Privacy parameter (e.g., 1e-5).
-
(mechanisms#dict[str, str], default:None) –Dictionary of mechanisms for the query
See Smartnoise-SQL postprocessing documentation. <https://docs.smartnoise.org/sql/advanced.html#overriding-mechanisms>__Defaults to {}.
-
(postprocess#bool, default:True) –Whether to postprocess the query results.
See Smartnoise-SQL postprocessing documentation. <https://docs.smartnoise.org/sql/advanced.html#postprocess>__Defaults to True.
-
(dummy#bool, default:False) –Whether to use a dummy dataset.
Defaults to False.
-
(nb_rows#int, default:DUMMY_NB_ROWS) –The number of rows in the dummy dataset.
Defaults to DUMMY_NB_ROWS.
-
(seed#int, default:DUMMY_SEED) –The random seed for generating the dummy dataset.
Defaults to DUMMY_SEED.
Returns:
-
QueryResponse(QueryResponse) –A Pandas DataFrame containing the query results.
Source code in client/lomas_client/libraries/smartnoise_sql.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
Classes:
-
SmartnoiseSynthClient–A client for executing and estimating the cost of SmartNoiseSynth queries.
SmartnoiseSynthClient
#
SmartnoiseSynthClient(http_client: LomasHttpClient)
A client for executing and estimating the cost of SmartNoiseSynth queries.
Methods:
-
cost–This function estimates the cost of executing a SmartNoise query.
-
query–This function executes a SmartNoise Synthetic query.
Source code in client/lomas_client/libraries/smartnoise_synth.py
20 21 | |
cost
#
cost(
synth_name: str,
epsilon: float,
delta: float | None = None,
select_cols: list[str] | None = None,
synth_params: dict | None = None,
nullable: bool = True,
constraints: dict | None = None,
) -> CostResponse
This function estimates the cost of executing a SmartNoise query.
Parameters:
-
(synth_name#str) –name of the Synthesizer model to use. Available synthesizer are - "aim", - "mwem", - "dpctgan" with
disabled_dp=Falseand warning (cryptographically secure random generator) - "patectgan" - "dpgan" with warning (cryptographically secure random generator)Available under certain conditions: - "mst" if
return_model=False- "pategan" if the dataset has enough rowsNot available: - "pacsynth" due to Rust panic error - "quail" currently unavailable in Smartnoise Synth
For further documentation on models, please see here: https://docs.smartnoise.org/synth/index.html#synthesizers-reference
-
(epsilon#float) –Privacy parameter (e.g., 0.1).
-
(delta#float, default:None) –Privacy parameter (e.g., 1e-5).
-
(select_cols#List[str], default:None) –List of columns to select. Defaults to None.
-
(synth_params#dict, default:None) –Keyword arguments to pass to the synthesizer constructor. See https://docs.smartnoise.org/synth/synthesizers/index.html#, provide all parameters of the model except
epsilonanddelta. Defaults to None. -
(nullable#bool, default:True) –True if some data cells may be null Defaults to True.
-
(constraints#dict, default:None) –Dictionnary for custom table transformer constraints. Column that are not specified will be inferred based on metadata. Defaults to {}. For further documentation on constraints, please see here: https://docs.smartnoise.org/synth/transforms/index.html. Note: lambda function in
AnonimizationTransformerare not supported.
Returns:
-
CostResponse(CostResponse) –The estimated cost.
Source code in client/lomas_client/libraries/smartnoise_synth.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
query
#
query(
synth_name: str,
epsilon: float,
delta: float | None = None,
select_cols: list[str] | None = None,
synth_params: dict | None = None,
nullable: bool = True,
constraints: dict | None = None,
dummy: bool = False,
return_model: bool = False,
condition: str = "",
nb_samples: int = SNSYNTH_DEFAULT_SAMPLES_NB,
nb_rows: int = DUMMY_NB_ROWS,
seed: int = DUMMY_SEED,
) -> QueryResponse
This function executes a SmartNoise Synthetic query.
Parameters:
-
(synth_name#str) –name of the Synthesizer model to use. Available synthesizer are - "aim", - "mwem", - "dpctgan" with
disabled_dp=Falseand warning (cryptographically secure random generator) - "patectgan" - "dpgan" with warning (cryptographically secure random generator)Available under certain conditions: - "mst" if
return_model=False- "pategan" if the dataset has enough rowsNot available: - "pacsynth" due to Rust panic error - "quail" currently unavailable in Smartnoise Synth
For further documentation on models, please see here: https://docs.smartnoise.org/synth/index.html#synthesizers-reference
-
(epsilon#float) –Privacy parameter (e.g., 0.1).
-
(delta#float, default:None) –Privacy parameter (e.g., 1e-5).
-
(select_cols#List[str], default:None) –List of columns to select. Defaults to None.
-
(synth_params#dict, default:None) –Keyword arguments to pass to the synthesizer constructor. See https://docs.smartnoise.org/synth/synthesizers/index.html#, provide all parameters of the model except
epsilonanddelta. Defaults to None. -
(nullable#bool, default:True) –True if some data cells may be null Defaults to True.
-
(constraints#dict | None, default:None) –Dictionnary for custom table transformer constraints. Column that are not specified will be inferred based on metadata. Defaults to {}. For further documentation on constraints, please see here: https://docs.smartnoise.org/synth/transforms/index.html. Note: lambda function in
AnonimizationTransformerare not supported. -
(return_model#bool, default:False) –True to get Synthesizer model, False to get samples Defaults to False
-
(condition#Optional[str], default:'') –sampling condition in
model.sample(only relevant if return_model is False) Defaults to "". -
(nb_samples#Optional[int], default:SNSYNTH_DEFAULT_SAMPLES_NB) –number of samples to generate. (only relevant if return_model is False) Defaults to SNSYNTH_DEFAULT_SAMPLES_NB
-
(dummy#bool, default:False) –Whether to use a dummy dataset. Defaults to False.
-
(nb_rows#int, default:DUMMY_NB_ROWS) –The number of rows in the dummy dataset. Defaults to DUMMY_NB_ROWS.
-
(seed#int, default:DUMMY_SEED) –The random seed for generating the dummy dataset. Defaults to DUMMY_SEED.
Returns:
-
QueryResponse(QueryResponse) –A Pandas DataFrame containing the query results.
Source code in client/lomas_client/libraries/smartnoise_synth.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
Classes:
-
ClientConfig–Config model for the HTTP client.
ClientConfig
#
flowchart TD
lomas_client.models.config.ClientConfig[ClientConfig]
click lomas_client.models.config.ClientConfig href "" "lomas_client.models.config.ClientConfig"
Config model for the HTTP client.
-
API Reference
Client
LomasHttpClient
Methods:
-
oidc_use_tls–Using TLS for OIDC?
-
lomas_service_use_tls–Using TLS for lomas service?
Attributes:
-
app_url(HttpUrl) –The base URL for the API server.
-
dataset_name(str) –The name of the dataset to be accessed or manipulated.
-
use_password_flow(bool) –If true, uses the legacy password auth flow.
-
user_name(str | None) –User name.
-
user_password(str | None) –User password.
-
oidc_discovery_url(HttpUrl) –The oidc provier discovery Url.
-
telemetry(Telemetry) –Telemetry Settings.
-
oidc_config(OIDCConfig) –Returns the oidc provider config.
dataset_name
instance-attribute
#
dataset_name: str
The name of the dataset to be accessed or manipulated.
use_password_flow
class-attribute
instance-attribute
#
use_password_flow: bool = False
If true, uses the legacy password auth flow.
Functions:
-
get_client_notebook_files–Returns a list of the client notebook file names (absolute paths).
-
run_notebook–Runs the notebook in the given file.
get_client_notebook_files
#
Returns a list of the client notebook file names (absolute paths).
Assumes the file layout is the same as in the code repository.
Source code in client/lomas_client/scripts/run_notebook.py
16 17 18 19 20 21 22 | |
run_notebook
#
run_notebook(
notebook_file: Path,
run_demo_setup: bool,
save_output: bool = False,
skip_smartnoise_synth: bool = True,
) -> None
Runs the notebook in the given file.
Assumes all services in the process compose are up and the file layout is same as in the code repository.
Parameters:
-
(notebook_file#str) –description
-
(run_demo_setup#bool) –Runs the lomas_demo_setup before running the notebook.
-
(save_output#bool, default:False) –Saves the output to the original file. Defaults to False.
-
(skip_smartnoise_synth#bool, default:True) –Skip smartnoise synth demo notebook
Source code in client/lomas_client/scripts/run_notebook.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
Functions:
-
dex_config–Dex config.
dex_config
#
dex_config()
Dex config.
Removes all dex users before yield.
Source code in client/lomas_client/tests/test_integrations.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
Functions:
-
test_run_notebook–Runs the notebook and fails if the notebook fails.
test_run_notebook
#
Runs the notebook and fails if the notebook fails.
Parameters:
Source code in client/lomas_client/tests/test_run_notebooks.py
24 25 26 27 28 29 30 31 | |
Functions:
-
raise_error–Raise error message based on the HTTP response.
-
validate_model_response_direct–Validate and process a HTTP response.
-
validate_model_response–Validate and process a HTTP response.
raise_error
#
Raise error message based on the HTTP response.
Parameters:
-
(response#Response) –The response object from an HTTP request.
Raise
Server Error
Source code in client/lomas_client/utils.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
validate_model_response_direct
#
Validate and process a HTTP response.
Parameters:
-
(response#Response) –The response object from an HTTP request.
Returns:
-
response_model(Any) –Model for responses requests.
Source code in client/lomas_client/utils.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
validate_model_response
#
validate_model_response(
client: LomasHttpClient, response: Response, response_model: type[ResponseT]
) -> ResponseT
Validate and process a HTTP response.
Parameters:
-
(response#Response) –The response object from an HTTP request.
Returns:
-
response_model(ResponseT) –Model for responses requests.
Source code in client/lomas_client/utils.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |