@@ -170,6 +170,7 @@ def create_time_series(
170
170
series : Union [pd .Series , TimeSeries ],
171
171
create_tag : Optional [bool ] = None , # pylint: disable=unused-argument
172
172
default_known_time : Optional [DefaultKnownTime ] = None ,
173
+ should_optimise : Optional [bool ] = None ,
173
174
) -> None :
174
175
"""
175
176
Create a time series.
@@ -193,13 +194,17 @@ def create_time_series(
193
194
the Known Time for data points where a specific known time timestamp
194
195
has not been given. If not provided, the Exabel API defaults to the
195
196
current time (upload time) as the Known Time.
197
+ should_optimise:
198
+ Whether time series storage optimisation should be enabled or not. If not
199
+ set, optimisation is at the discretion of the server.
196
200
"""
197
201
series = self ._handle_time_series (name , series )
198
202
199
203
self .client .create_time_series (
200
204
CreateTimeSeriesRequest (
201
205
time_series = series .to_proto (),
202
206
default_known_time = default_known_time ,
207
+ insert_options = InsertOptions (should_optimise = should_optimise ),
203
208
),
204
209
)
205
210
@@ -210,6 +215,7 @@ def upsert_time_series(
210
215
series : pd .Series ,
211
216
create_tag : Optional [bool ] = None , # pylint: disable=unused-argument
212
217
default_known_time : Optional [DefaultKnownTime ] = None ,
218
+ should_optimise : Optional [bool ] = None ,
213
219
) -> None :
214
220
"""
215
221
Create or update a time series.
@@ -229,12 +235,16 @@ def upsert_time_series(
229
235
the Known Time for data points where a specific known time timestamp
230
236
has not been given. If not provided, the Exabel API defaults to the
231
237
current time (upload time) as the Known Time.
238
+ should_optimise:
239
+ Whether time series storage optimisation should be enabled or not. If not
240
+ set, optimisation is at the discretion of the server.
232
241
"""
233
242
self .append_time_series_data (
234
243
name ,
235
244
series ,
236
245
default_known_time ,
237
246
allow_missing = True ,
247
+ should_optimise = should_optimise ,
238
248
)
239
249
240
250
@deprecate_arguments (create_tag = None )
@@ -245,6 +255,7 @@ def append_time_series_data(
245
255
default_known_time : Optional [DefaultKnownTime ] = None ,
246
256
allow_missing : bool = False ,
247
257
create_tag : bool = False , # pylint: disable=unused-argument
258
+ should_optimise : Optional [bool ] = None ,
248
259
) -> None :
249
260
"""
250
261
Append data to the given time series.
@@ -263,6 +274,9 @@ def append_time_series_data(
263
274
allow_missing: If set to true, and the resource is not found, a new resource will be
264
275
created. In this situation, the "update_mask" is ignored.
265
276
create_tag: Deprecated.
277
+ should_optimise:
278
+ Whether time series storage optimisation should be enabled or not. If not
279
+ set, optimisation is at the discretion of the server.
266
280
"""
267
281
series = self ._handle_time_series (name , series )
268
282
@@ -271,6 +285,7 @@ def append_time_series_data(
271
285
time_series = series .to_proto (),
272
286
insert_options = InsertOptions (
273
287
default_known_time = default_known_time ,
288
+ should_optimise = should_optimise ,
274
289
),
275
290
update_options = UpdateOptions (
276
291
allow_missing = allow_missing ,
@@ -289,6 +304,7 @@ def import_time_series(
289
304
status_in_response : bool = False ,
290
305
replace_existing_time_series : bool = False ,
291
306
replace_existing_data_points : bool = False ,
307
+ should_optimise : Optional [bool ] = None ,
292
308
) -> Optional [Sequence [ResourceCreationResult ]]:
293
309
"""
294
310
Import multiple time series.
@@ -325,6 +341,9 @@ def import_time_series(
325
341
inserted time series points. Data points at times not present in the
326
342
request will be left untouched. Only one of replace_existing_data_points
327
343
or replace_existing_time_series can be set to true.
344
+ should_optimise:
345
+ Whether time series storage optimisation should be enabled or not. If
346
+ not set, optimisation is at the discretion of the server.
328
347
Returns:
329
348
If status_in_response is set to true, a list of ResourceCreationResult will be returned.
330
349
Otherwise, None is returned.
@@ -348,6 +367,7 @@ def import_time_series(
348
367
status_in_response = status_in_response ,
349
368
insert_options = InsertOptions (
350
369
default_known_time = default_known_time ,
370
+ should_optimise = should_optimise ,
351
371
),
352
372
update_options = update_options ,
353
373
)
@@ -367,6 +387,7 @@ def append_time_series_data_and_return(
367
387
allow_missing : Optional [bool ] = False ,
368
388
create_tag : Optional [bool ] = None , # pylint: disable=unused-argument
369
389
include_metadata : Optional [bool ] = False ,
390
+ should_optimise : Optional [bool ] = None ,
370
391
) -> Union [pd .Series , TimeSeries ]:
371
392
"""
372
393
Append data to the given time series, and return the full series.
@@ -388,6 +409,9 @@ def append_time_series_data_and_return(
388
409
include_metadata:
389
410
Whether to include the metadata of the time series in the response.
390
411
Returns a TimeSeries object if set to True, otherwise a pandas Series.
412
+ should_optimise:
413
+ Whether time series storage optimisation should be enabled or not. If not
414
+ set, optimisation is at the discretion of the server.
391
415
392
416
Returns:
393
417
A series with all data for the given time series.
@@ -401,6 +425,7 @@ def append_time_series_data_and_return(
401
425
view = TimeSeriesView (time_range = TimeRange ()),
402
426
insert_options = InsertOptions (
403
427
default_known_time = default_known_time ,
428
+ should_optimise = should_optimise ,
404
429
),
405
430
update_options = UpdateOptions (
406
431
allow_missing = allow_missing ,
@@ -441,6 +466,7 @@ def bulk_upsert_time_series(
441
466
default_known_time : Optional [DefaultKnownTime ] = None ,
442
467
replace_existing_time_series : bool = False ,
443
468
replace_existing_data_points : bool = False ,
469
+ should_optimise : Optional [bool ] = None ,
444
470
retries : int = DEFAULT_NUMBER_OF_RETRIES ,
445
471
abort_threshold : Optional [float ] = DEFAULT_ABORT_THRESHOLD ,
446
472
# Deprecated arguments
@@ -477,6 +503,9 @@ def bulk_upsert_time_series(
477
503
inserted time series points. Data points at times not present in the
478
504
request will be left untouched. Only one of replace_existing_data_points
479
505
or replace_existing_time_series can be set to true.
506
+ should_optimise:
507
+ Whether time series storage optimisation should be enabled or not. If
508
+ not set, optimisation is at the discretion of the server.
480
509
retries: Maximum number of retries to make for each failed request.
481
510
abort_threshold:
482
511
The threshold for the proportion of failed requests that will cause the
@@ -497,6 +526,7 @@ def import_func(
497
526
status_in_response = True ,
498
527
replace_existing_time_series = replace_existing_time_series ,
499
528
replace_existing_data_points = replace_existing_data_points ,
529
+ should_optimise = should_optimise ,
500
530
)
501
531
assert result is not None
502
532
return result
0 commit comments