Skip to content

Commit 5b7d43a

Browse files
authored
VER: Release 0.18.0
See release notes.
2 parents 72f53b4 + 95893c4 commit 5b7d43a

File tree

7 files changed

+711
-450
lines changed

7 files changed

+711
-450
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.18.0 - 2023-08-14
4+
5+
#### Breaking changes
6+
- Renamed the `TimeSeriesHttpAPI` class to `TimeseriesHttpAPI`
7+
8+
#### Bug Fixes
9+
- Fixed an issue where `DBNStore.to_csv()`, `DBNStore.to_df()`, `DBNStore.to_json()`, and `DBNStore.to_ndarray()` would consume large amounts of memory.
10+
311
## 0.17.0 - 2023-08-10
412

513
This release includes improvements to the ergonomics of the clients metadata API, you can read more about the changes [here](https://databento.com/blog/api-improvements-august-2023).

databento/common/dbnstore.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import abc
44
import datetime as dt
5-
import functools
65
import logging
76
from collections.abc import Generator
87
from io import BytesIO
@@ -1069,15 +1068,16 @@ def to_ndarray(
10691068
raise ValueError("a schema must be specified for mixed DBN data")
10701069
schema = self.schema
10711070

1072-
schema_records = filter(
1073-
lambda r: isinstance(r, SCHEMA_STRUCT_MAP[schema]), # type: ignore
1074-
self,
1075-
)
1076-
1077-
decoder = functools.partial(np.frombuffer, dtype=SCHEMA_DTYPES_MAP[schema])
1078-
result = tuple(map(decoder, map(bytes, schema_records)))
1071+
record_buffer = BytesIO()
1072+
num_records = 0
1073+
for record in filter(lambda r: isinstance(r, SCHEMA_STRUCT_MAP[schema]), self): # type: ignore [arg-type]
1074+
num_records += 1
1075+
record_buffer.write(bytes(record))
10791076

1080-
if not result:
1081-
return np.empty(shape=(0, 1), dtype=SCHEMA_DTYPES_MAP[schema])
1077+
result = np.frombuffer(
1078+
record_buffer.getvalue(),
1079+
dtype=SCHEMA_DTYPES_MAP[schema],
1080+
count=num_records,
1081+
)
10821082

1083-
return np.ravel(result)
1083+
return result

databento/historical/api/timeseries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from databento.historical.http import BentoHttpAPI
2222

2323

24-
class TimeSeriesHttpAPI(BentoHttpAPI):
24+
class TimeseriesHttpAPI(BentoHttpAPI):
2525
"""
2626
Provides request methods for the time series HTTP API endpoints.
2727
"""

databento/historical/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from databento.historical.api.batch import BatchHttpAPI
99
from databento.historical.api.metadata import MetadataHttpAPI
1010
from databento.historical.api.symbology import SymbologyHttpAPI
11-
from databento.historical.api.timeseries import TimeSeriesHttpAPI
11+
from databento.historical.api.timeseries import TimeseriesHttpAPI
1212

1313

1414
logger = logging.getLogger(__name__)
@@ -56,7 +56,7 @@ def __init__(
5656
self.batch = BatchHttpAPI(key=key, gateway=gateway)
5757
self.metadata = MetadataHttpAPI(key=key, gateway=gateway)
5858
self.symbology = SymbologyHttpAPI(key=key, gateway=gateway)
59-
self.timeseries = TimeSeriesHttpAPI(key=key, gateway=gateway)
59+
self.timeseries = TimeseriesHttpAPI(key=key, gateway=gateway)
6060

6161
# Not logging security sensitive `key`
6262
logger.info("Initialized %s(gateway=%s)", type(self).__name__, self.gateway)

databento/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.17.0"
1+
__version__ = "0.18.0"

0 commit comments

Comments
 (0)