1

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() and query.close() before reusing → no effect

  • Calling container.flush() and container.commit() → no effect

  • Recreating 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

1
  • I don't have the platform on hand, so I'm not posting this as an answer, but have you tried del(rs) after the first query? This forces rs to 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. Commented 6 hours ago

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.