I’m using the GridDB Python client to insert data into a container, but after inserting the data, I can’t seem to retrieve it. The code executes without any errors, but when I query the container, the inserted data is missing.
import griddb_python as griddb
factory = griddb.StoreFactory.get_instance()
try:
# Connect to the GridDB store
store = factory.get_store(
notification_member="123.0.0.1",
notification_port=31999,
cluster_name="myCluster",
username="admin",
password="admin"
)
# Retrieve or create the container
container = store.get_container("personContainer")
if container is None:
container_info = griddb.ContainerInfo(
"personContainer",
[
griddb.ColumnInfo("id", griddb.GS_TYPE_INTEGER),
griddb.ColumnInfo("name", griddb.GS_TYPE_STRING),
griddb.ColumnInfo("age", griddb.GS_TYPE_INTEGER)
],
griddb.CONTAINER_COLLECTION, True
)
container = store.put_container(container_info)
# Insert data
row = [1, "John Doe", 30]
container.put(row)
except griddb.GSException as e:
for i in range(e.get_error_stack_size()):
print(f"[{i}] Error code: {e.get_error_code(i)}")
print(f"Error message: {e.get_message(i)}")
The code runs without any errors, but when I query the container, I cannot find the inserted data. It seems that the data is not being persisted in the container after the put() operation.
What I’ve tried:
- Double-checked the GridDB server and confirmed it’s running.
- Verified that the container schema is correct and that the container exists.
- Looked through the documentation for common issues with put().
Why is the data not being persisted in GridDB after the insert operation, and how can I make sure that the inserted data is saved properly?