1

I’m using GridDB Cloud (Free) with the Python client, and I need to write a batch of rows to a TimeSeries container atomically (all-or-nothing). I'm having trouble figuring out how to turn autocommit off and commit/rollback explicitly.

Minimal repro:

import griddb_python as griddb
from datetime import datetime, timezone

# connect
factory = griddb.StoreFactory.get_instance()
store = factory.get_store(
    host="xxx.cloud.griddb.com",
    port=31999,
    cluster_name="KN3yxw8u",
    username="userM016Pqo8pS",
    password="****",
)

# create/open timeseries
props = griddb.TimeSeriesProperties()
props.row_key = True
props.set_column_info([
    ("ts", griddb.Type.TIMESTAMP),
    ("deviceid", griddb.Type.STRING),
    ("temperature", griddb.Type.DOUBLE),
])
ts = store.put_time_series("TSDB", props)

# --- transaction attempt ----------------------------------------------
# Q: Where do I disable autocommit?
#    ts.set_auto_commit(False) ? store.set_auto_commit(False) ?

rows = [
    (datetime(2025, 9, 1, 0, 0, tzinfo=timezone.utc), "dev-001", 25.0),
    (datetime(2025, 9, 1, 1, 0, tzinfo=timezone.utc), "dev-001", 26.0),
]

try:
    # try to batch insert
    for r in rows:
        ts.put(r)

    # simulate a failure before commit
    raise RuntimeError("boom")

    ts.commit()           # expect not to reach here
except Exception:
    # I expected no rows to be visible after this
    ts.rollback()

# Observed: after the exception, the new rows are visible,
# which makes it appear as though autocommit was enabled.

Question: How do I turn off autocommit and use explicit commit()/rollback() with the Python GridDB client for a TimeSeries container? What is the correct object/method to call (container vs store), and is there anything special for TimeSeries?

Environment:

  • GridDB Cloud (Free)
  • griddb_python client
  • TimeSeries container (ts TIMESTAMP as row key)

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.