[Python] Why is the GSException raised only at put_row() instead of at container creation for...

Discussão em 'Python' iniciado por Stack, Junho 20, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using the GridDB Python client (griddb_python) to ingest time-series data from IoT devices. The container schema is created dynamically like this:

    store.put_container("sensor_metrics", [
    ("timestamp", griddb.Type.TIMESTAMP),
    ("device_id", griddb.Type.STRING),
    ("temperature", griddb.Type.FLOAT),
    ("vibration", griddb.Type.FLOAT)
    ], griddb.ContainerType.TIME_SERIES, True)



    At runtime, my ingestion code parses incoming JSON and builds rows dynamically, like this:

    row = [data["timestamp"], data["device_id"], data["temperature"], data.get("vibration")]
    container.put_row(row)



    If vibration is missing, or is a string due to malformed data ("vibration": "high"), I don’t get any error until the put_row() call is made, where it raises:

    GSException: [ILLEGAL_VALUE] Field type mismatch at column 3 (expected FLOAT)



    Question:

    Is there any way to validate the row against the container schema before calling put_row() in GridDB Python? Can the schema (column types, order) be introspected in Python using the client API to avoid silent mismatches?

    What I’ve tried:


    • Using Python type checks (isinstance()) manually — but this adds a lot of boilerplate and doesn’t guarantee safety for schema evolution.


    • Looked at get_container_info() — seems limited in terms of exposing column types or enforcing validation logic.

    Continue reading...

Compartilhe esta Página