1

I’m experimenting with GridDB CE for a project where sensor data is stored as JSON objects inside a BLOB column. For example, I have a container defined as:

    ContainerInfo containerInfo = new ContainerInfo();
containerInfo.setName("SensorData");
containerInfo.setColumnInfoList(new ColumnInfo[] {
    new ColumnInfo("id", GSType.STRING),
    new ColumnInfo("timestamp", GSType.TIMESTAMP),
    new ColumnInfo("payload", GSType.BLOB) // contains JSON
});

A typical payload JSON looks like this:

{
  "temperature": 22.5,
  "humidity": 60,
  "location": {
    "lat": 36.812,
    "lon": 10.165
  }
}

I’d like to query all rows where temperature > 25 AND location.lat > 35 using TQL, without having to pull all the rows into memory and parse the JSON manually.

I’ve tried something like:

SELECT * FROM SensorData WHERE payload.temperature > 25

But GridDB throws a syntax error saying the column does not exist.

Question:

Is there a way in GridDB to query JSON fields inside a BLOB column directly using TQL? If not, what’s the recommended schema design to handle this type of semi-structured data so I can still query it efficiently?

1
  • If you want to query data efficiently with SQL (structured query language), then your data should be structured. When you ingest the data, parse it and store it in appropriate tables / columns (ETL - Extract Transform Load). Commented Sep 13 at 7:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.