Skip to content

Commit 31e9cf6

Browse files
Python(feat): enable cache bypass sift client (#404)
1 parent db0fc7c commit 31e9cf6

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

python/lib/sift_client/resources/channels.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ async def get_data(
178178
start_time: datetime | None = None,
179179
end_time: datetime | None = None,
180180
limit: int | None = None,
181+
ignore_cache: bool = False,
181182
) -> dict[str, pd.DataFrame]:
182183
"""Get data for one or more channels.
183184
@@ -187,6 +188,7 @@ async def get_data(
187188
start_time: The start time to get data for.
188189
end_time: The end time to get data for.
189190
limit: The maximum number of data points to return. Will be in increments of page_size or default page size defined by the call if no page_size is provided.
191+
ignore_cache: Whether to ignore cached data and fetch fresh data from the server.
190192
191193
Returns:
192194
A dictionary mapping channel names to pandas DataFrames containing the channel data.
@@ -200,6 +202,7 @@ async def get_data(
200202
start_time=start_time,
201203
end_time=end_time,
202204
max_results=limit,
205+
ignore_cache=ignore_cache,
203206
)
204207

205208
async def get_data_as_arrow(
@@ -210,6 +213,7 @@ async def get_data_as_arrow(
210213
start_time: datetime | None = None,
211214
end_time: datetime | None = None,
212215
limit: int | None = None,
216+
ignore_cache: bool = False,
213217
) -> dict[str, pa.Table]:
214218
"""Get data for one or more channels as pyarrow tables."""
215219
from pyarrow import Table as ArrowTable
@@ -221,5 +225,6 @@ async def get_data_as_arrow(
221225
start_time=start_time,
222226
end_time=end_time,
223227
limit=limit,
228+
ignore_cache=ignore_cache,
224229
)
225230
return {k: ArrowTable.from_pandas(v) for k, v in data.items()}

python/lib/sift_client/resources/sync_stubs/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ class ChannelsAPI:
432432
start_time: datetime | None = None,
433433
end_time: datetime | None = None,
434434
limit: int | None = None,
435+
ignore_cache: bool = False,
435436
) -> dict[str, pd.DataFrame]:
436437
"""Get data for one or more channels.
437438
@@ -441,6 +442,7 @@ class ChannelsAPI:
441442
start_time: The start time to get data for.
442443
end_time: The end time to get data for.
443444
limit: The maximum number of data points to return. Will be in increments of page_size or default page size defined by the call if no page_size is provided.
445+
ignore_cache: Whether to ignore cached data and fetch fresh data from the server.
444446
445447
Returns:
446448
A dictionary mapping channel names to pandas DataFrames containing the channel data.
@@ -455,6 +457,7 @@ class ChannelsAPI:
455457
start_time: datetime | None = None,
456458
end_time: datetime | None = None,
457459
limit: int | None = None,
460+
ignore_cache: bool = False,
458461
) -> dict[str, pa.Table]:
459462
"""Get data for one or more channels as pyarrow tables."""
460463
...

python/pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ all = [
5959
'pyOpenSSL<24.0.0',
6060
'pyarrow>=17.0.0',
6161
'rosbags~=0.0',
62-
'sift-stream-bindings>=0.2.0-rc',
62+
'sift-stream-bindings>=0.2.0-rc2',
6363
'types-pyOpenSSL<24.0.0',
6464
]
6565
build = [
@@ -100,7 +100,7 @@ dev-all = [
100100
'pytest==8.2.2',
101101
'rosbags~=0.0',
102102
'ruff~=0.12.10',
103-
'sift-stream-bindings>=0.2.0-rc',
103+
'sift-stream-bindings>=0.2.0-rc2',
104104
'tomlkit~=0.13.3',
105105
'types-pyOpenSSL<24.0.0',
106106
]
@@ -153,7 +153,7 @@ docs-build = [
153153
'pytest==8.2.2',
154154
'rosbags~=0.0',
155155
'ruff~=0.12.10',
156-
'sift-stream-bindings>=0.2.0-rc',
156+
'sift-stream-bindings>=0.2.0-rc2',
157157
'tomlkit~=0.13.3',
158158
'types-pyOpenSSL<24.0.0',
159159
]
@@ -176,10 +176,10 @@ rosbags = [
176176
'rosbags~=0.0',
177177
]
178178
sift-stream = [
179-
'sift-stream-bindings>=0.2.0-rc',
179+
'sift-stream-bindings>=0.2.0-rc2',
180180
]
181181
sift-stream-bindings = [
182-
'sift-stream-bindings>=0.2.0-rc',
182+
'sift-stream-bindings>=0.2.0-rc2',
183183
]
184184
tdms = [
185185
'npTDMS~=1.9',

0 commit comments

Comments
 (0)