Skip to content

Commit c529017

Browse files
authored
Update arrow notes, small doc changes. (#38)
1 parent 0c646d4 commit c529017

File tree

3 files changed

+79
-26
lines changed

3 files changed

+79
-26
lines changed

btrdb/conn.py

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ def __init__(self, addrportstr, apikey=None):
5353
5454
Parameters
5555
----------
56-
addrportstr: str
56+
addrportstr: str, required
5757
The address of the cluster to connect to, e.g 123.123.123:4411
58-
apikey: str
59-
The option API key to authenticate requests
58+
apikey: str, optional
59+
The optional API key to authenticate requests
6060
6161
"""
6262
addrport = addrportstr.split(":", 2)
@@ -224,6 +224,17 @@ def query(
224224
a list of parameter values to be sanitized and interpolated into the
225225
SQL statement. Using parameters forces value/type checking and is
226226
considered a best practice at the very least.
227+
auto_retry: bool, default: False
228+
Whether to retry this request in the event of an error
229+
retries: int, default: 5
230+
Number of times to retry this request if there is an error. Will
231+
be ignored if auto_retry is False
232+
retry_delay: int, default: 3
233+
initial time to wait before retrying function call if there is an error.
234+
Will be ignored if auto_retry is False
235+
retry_backoff: int, default: 4
236+
Exponential factor by which the backoff increases between retries.
237+
Will be ignored if auto_retry is False
227238
228239
Returns
229240
-------
@@ -348,8 +359,25 @@ def create(
348359
349360
Parameters
350361
----------
351-
uuid: UUID
362+
uuid: UUID, required
352363
The uuid of the requested stream.
364+
collection: str, required
365+
The collection string prefix that the stream will belong to.
366+
tags: dict, required
367+
The tags-level immutable metadata key:value pairs.
368+
annotations: dict, optional
369+
The mutable metadata of the stream, key:value pairs
370+
auto_retry: bool, default: False
371+
Whether to retry this request in the event of an error
372+
retries: int, default: 5
373+
Number of times to retry this request if there is an error. Will
374+
be ignored if auto_retry is False
375+
retry_delay: int, default: 3
376+
initial time to wait before retrying function call if there is an error.
377+
Will be ignored if auto_retry is False
378+
retry_backoff: int, default: 4
379+
Exponential factor by which the backoff increases between retries.
380+
Will be ignored if auto_retry is False
353381
354382
Returns
355383
-------
@@ -376,7 +404,7 @@ def create(
376404

377405
def info(self):
378406
"""
379-
Returns information about the connected BTrDB srerver.
407+
Returns information about the connected BTrDB server.
380408
381409
Returns
382410
-------
@@ -397,9 +425,14 @@ def list_collections(self, starts_with=""):
397425
Returns a list of collection paths using the `starts_with` argument for
398426
filtering.
399427
428+
Parameters
429+
----------
430+
starts_with: str, optional, default = ''
431+
Filter collections that start with the string provided, if none passed, will list all collections.
432+
400433
Returns
401434
-------
402-
collection paths: list[str]
435+
collections: List[str]
403436
404437
"""
405438
return [c for some in self.ep.listCollections(starts_with) for c in some]
@@ -492,6 +525,17 @@ def streams_in_collection(
492525
The tags to identify the stream.
493526
annotations: Dict[str, str]
494527
The annotations to identify the stream.
528+
auto_retry: bool, default: False
529+
Whether to retry this request in the event of an error
530+
retries: int, default: 5
531+
Number of times to retry this request if there is an error. Will
532+
be ignored if auto_retry is False
533+
retry_delay: int, default: 3
534+
initial time to wait before retrying function call if there is an error.
535+
Will be ignored if auto_retry is False
536+
retry_backoff: int, default: 4
537+
Exponential factor by which the backoff increases between retries.
538+
Will be ignored if auto_retry is False
495539
496540
Returns
497541
------
@@ -546,8 +590,19 @@ def collection_metadata(
546590
547591
Parameters
548592
----------
549-
prefix: str
593+
prefix: str, required
550594
A prefix of the collection names to look at
595+
auto_retry: bool, default: False
596+
Whether to retry this request in the event of an error
597+
retries: int, default: 5
598+
Number of times to retry this request if there is an error. Will
599+
be ignored if auto_retry is False
600+
retry_delay: int, default: 3
601+
initial time to wait before retrying function call if there is an error.
602+
Will be ignored if auto_retry is False
603+
retry_backoff: int, default: 4
604+
Exponential factor by which the backoff increases between retries.
605+
Will be ignored if auto_retry is False
551606
552607
Returns
553608
-------

btrdb/stream.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __init__(self, btrdb, uuid, **db_values):
100100

101101
def refresh_metadata(self):
102102
"""
103-
Refreshes the locally cached meta data for a stream
103+
Refreshes the locally cached metadata for a stream from the server.
104104
105105
Queries the BTrDB server for all stream metadata including collection,
106106
annotation, and tags. This method requires a round trip to the server.
@@ -576,7 +576,6 @@ def insert(self, data, merge="never"):
576576
-------
577577
int
578578
The version of the stream after inserting new points.
579-
580579
"""
581580
version = 0
582581
i = 0
@@ -615,7 +614,7 @@ def arrow_insert(self, data: pa.Table, merge: str = "never") -> int:
615614
616615
Notes
617616
-----
618-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
617+
This method is available for commercial customers with arrow-enabled servers.
619618
"""
620619
if not self._btrdb._ARROW_ENABLED:
621620
raise NotImplementedError(_arrow_not_impl_str.format("arrow_insert"))
@@ -758,7 +757,6 @@ def update(
758757
int
759758
The version of the metadata (separate from the version of the data)
760759
also known as the "property version".
761-
762760
"""
763761
if tags is None and annotations is None and collection is None:
764762
raise BTRDBValueError(
@@ -826,7 +824,6 @@ def delete(
826824
-------
827825
int
828826
The version of the new stream created
829-
830827
"""
831828
return self._btrdb.ep.deleteRange(
832829
self._uuid, to_nanoseconds(start), to_nanoseconds(end)
@@ -948,7 +945,7 @@ def arrow_values(
948945
granularity. In the tree data structure of BTrDB, this data is stored in
949946
the vector nodes.
950947
951-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
948+
This method is available for commercial customers with arrow-enabled servers.
952949
"""
953950
if not self._btrdb._ARROW_ENABLED:
954951
raise NotImplementedError(_arrow_not_impl_str.format("arrow_values"))
@@ -1108,7 +1105,7 @@ def arrow_aligned_windows(
11081105
As the window-width is a power-of-two, it aligns with BTrDB internal
11091106
tree data structure and is faster to execute than `windows()`.
11101107
1111-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
1108+
This method is available for commercial customers with arrow-enabled servers.
11121109
"""
11131110
if not self._btrdb._ARROW_ENABLED:
11141111
raise NotImplementedError(
@@ -1202,7 +1199,7 @@ def windows(
12021199
parameter previously available has been deprecated. The only valid value
12031200
for depth is now 0.
12041201
1205-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
1202+
This method is available for commercial customers with arrow-enabled servers.
12061203
"""
12071204
materialized = []
12081205
start = to_nanoseconds(start)
@@ -1270,7 +1267,7 @@ def arrow_windows(
12701267
end = start + width * floordiv(end - start, width). The `depth`
12711268
parameter previously available has been deprecated. The only valid value
12721269
for depth is now 0.
1273-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
1270+
This method is available for commercial customers with arrow-enabled servers.
12741271
"""
12751272
if not self._btrdb._ARROW_ENABLED:
12761273
raise NotImplementedError(_arrow_not_impl_str.format("arrow_windows"))
@@ -1827,12 +1824,12 @@ def windows(self, width, depth=0):
18271824
Windows returns arbitrary precision windows from BTrDB. It is slower
18281825
than aligned_windows, but still significantly faster than values. Each
18291826
returned window will be width nanoseconds long. start is inclusive, but
1830-
end is exclusive (e.g if end < start+width you will get no results).
1827+
end is exclusive (e.g. if end < start+width you will get no results).
18311828
That is, results will be returned for all windows that start at a time
18321829
less than the end timestamp. If (end - start) is not a multiple of
18331830
width, then end will be decreased to the greatest value less than end
18341831
such that (end - start) is a multiple of width (i.e., we set end = start
1835-
+ width * floordiv(end - start, width). The `depth` parameter previously
1832+
+ width * floordiv(end - start, width)). The `depth` parameter previously
18361833
available has been deprecated. The only valid value for depth is now 0.
18371834
18381835
"""
@@ -2046,7 +2043,8 @@ def arrow_insert(self, data_map: dict, merge: str = "never") -> dict:
20462043
Notes
20472044
-----
20482045
BTrDB expects datetimes to be in UTC+0.
2049-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
2046+
2047+
This method is available for commercial customers with arrow-enabled servers.
20502048
20512049
Returns
20522050
-------
@@ -2098,7 +2096,7 @@ def arrow_values(
20982096
20992097
Notes
21002098
-----
2101-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
2099+
This method is available for commercial customers with arrow-enabled servers.
21022100
"""
21032101
params = self._params_from_filters()
21042102
versions = self._pinned_versions

btrdb/transformers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def arrow_to_series(streamset, agg="mean", name_callable=None):
120120
121121
Notes
122122
-----
123-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
123+
This method is available for commercial customers with arrow-enabled servers.
124124
"""
125125
if not streamset._btrdb._ARROW_ENABLED:
126126
raise NotImplementedError(
@@ -161,7 +161,7 @@ def arrow_to_dataframe(
161161
162162
Notes
163163
-----
164-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
164+
This method is available for commercial customers with arrow-enabled servers.
165165
"""
166166
if not streamset._btrdb._ARROW_ENABLED:
167167
raise NotImplementedError(
@@ -314,7 +314,7 @@ def arrow_to_polars(streamset, agg=None, name_callable=None):
314314
315315
Notes
316316
-----
317-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
317+
This method is available for commercial customers with arrow-enabled servers.
318318
"""
319319
if not streamset._btrdb._ARROW_ENABLED:
320320
raise NotImplementedError(
@@ -341,7 +341,7 @@ def arrow_to_arrow_table(streamset):
341341
342342
Notes
343343
-----
344-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
344+
This method is available for commercial customers with arrow-enabled servers.
345345
"""
346346
if not streamset._btrdb._ARROW_ENABLED:
347347
raise NotImplementedError(
@@ -457,7 +457,7 @@ def arrow_to_numpy(streamset, agg=None):
457457
-----
458458
This method first converts to a pandas data frame then to a numpy array.
459459
460-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
460+
This method is available for commercial customers with arrow-enabled servers.
461461
"""
462462
if not streamset._btrdb._ARROW_ENABLED:
463463
raise NotImplementedError(
@@ -529,7 +529,7 @@ def arrow_to_dict(streamset, agg=None, name_callable=None):
529529
530530
Notes
531531
-----
532-
ARROW ENABLED SERVERS REQUIRED - CHANGE ME FOR FINAL
532+
This method is available for commercial customers with arrow-enabled servers.
533533
"""
534534
if not streamset._btrdb._ARROW_ENABLED:
535535
raise NotImplementedError(

0 commit comments

Comments
 (0)