I’m using GridDB Cloud with the Python client (griddb_python) and found a reproducible issue where executing multiple sequential queries on a TimeSeries container causes the second query to return stale data unless I recreate the RowSet.
Schema
import griddb_python as griddb
conInfo = griddb.ContainerInfo(
name="ts_metrics",
column_info_list=[
("ts", griddb.Type.TIMESTAMP),
("cpu", griddb.Type.FLOAT)
],
type=griddb.ContainerType.TIME_SERIES,
row_key=True
)
store.put_container(conInfo, True)
Insert test data
import datetime
container = store.get_container("ts_metrics")
base = datetime.datetime(2024, 6, 1, 0, 0)
for i in range(5):
container.put((base + datetime.timedelta(minutes=i), 0.5 + i))
Query 1 (works)
query = container.query("SELECT * WHERE ts >= TIMESTAMP('2024-06-01T00:00:00')")
rs = query.fetch(False)
print([row for row in rs])
Returns:
[(2024-06-01 00:00:00, 0.5), ..., (00:04:00, 4.5)]
Query 2 on the same RowSet (stale data)
query = container.query("SELECT * WHERE ts >= TIMESTAMP('2024-06-01T00:02:00')")
rs = query.fetch(False)
print([row for row in rs])
Expected: Rows from 00:02 onward.
Actual: It prints the results from Query 1, even though the SQL text changed.
If I recreate the container or create a new RowSet object manually, the problem disappears.
Question
Is there a known limitation in the GridDB Python client that prevents reusing a TimeSeries RowSet for sequential queries, causing stale-buffer reads, and is a new RowSet required for every query execution?
What I have tried
Calling
rs.close()andquery.close()before reusing → no effectCalling
container.flush()andcontainer.commit()→ no effectRecreating only the query → still stale
Recreating the container object → fixes it
Tested on GridDB CE 5.3 and GridDB Cloud → identical behavior
TimeSeries-specific; Collections do not show this issue
del(rs)after the first query? This forcesrsto go out of scope and allows the underlying (C-based) library to clean up resources, so that the second bit of code doesn't run into trouble. If this works, I'd say it very odd that the code doesn't generate an exception or at least some sort of warning somewhere. If it works, a clean way to deal with this would be to wrap the data retrieval in a function, so that the rowset naturally goes out of scope.