I’m developing a Python application that interacts with a GridDB time-series container. While inserting and querying data, I encountered an issue where the container fails to retrieve rows. The error message I receive is: gs.error.GSException: [101503:API] Row data does not match container definition
Here’s the Python code I’m using:
from griddb_python import ContainerInfo, GSException, Timestamp
factory = griddb_python.StoreFactory.get_instance()
try:
# Connect to GridDB
gridstore = factory.get_store(
host="239.0.0.1",
port=31999,
cluster_name="defaultCluster",
username="admin",
password="admin"
)
# Create a time-series container
container_info = ContainerInfo(
name="device_logs",
column_info_list=[
("log_time", griddb_python.Type.TIMESTAMP),
("device_id", griddb_python.Type.STRING),
("status", griddb_python.Type.INTEGER)
],
type=griddb_python.ContainerType.TIME_SERIES
)
container = gridstore.put_container(container_info)
# Insert data
ts = container
ts.put([Timestamp(2024, 11, 21, 10, 0, 0), "device123", "active"])
# Query data
query = ts.query("SELECT *")
rowset = query.fetch()
# Print results
while rowset.has_next():
data = rowset.next()
print("Data:", data)
except GSException as e:
print("Error occurred:", e)
I suspect the issue lies in the data format, specifically when inserting rows. I’ve reviewed the container definition and ensured the columns match the data being inserted, but the error persists.
-Am I missing something in the way I’m defining the container or inserting the data? -Is there a specific way to handle data types in Python for GridDB to avoid such issues? Any advice or insights would be greatly appreciated!