admin管理员组文章数量:1332389
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!
本文标签:
版权声明:本文标题:Issue with Python GridDB: Unable to fetch rows - "Row data does not match container definition" - Stack Overfl 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742292068a2447990.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论