IoT Analytics dataset contains only __dt. Is my query broken?

183 Views Asked by At

I've been beating my head against this for a while. I have created a channel, pipeline, datastore and dataset, but the dataset just contains __dt no matter what I do.

I believe the channel, pipeline, and datastore are working, primarily because I see correctly formatted JSON messages in the S3 bucket for the datastore.

My datastore is called "salt_datastore". When I navigate to the relevant S3 bucket, I see a folder called "salt_datastore", and in it, I see a folder with today's date called "__dt=2022-10-09 00:00:00/". Inside that folder, I see a separate .gz file for every message I have sent, with names of the format "1665276480000_1665276510000_435011638936_salt_sensor_0_840.0.salt_sensor_pipeline.json.gz". If I download and open one of these, I see the MQTT messages that were sent to the MQTT topic.

So I think the channel, pipeline, and datastore are working, but if I set up a dataset with the query "select * from salt_datastore", I only get "__dt". I feel like this is the starting text of the folder inside the salt_datastore S3 bucket, but I can't figure out how to construct a valid SQL query that gives me what's inside that folder. Any help?

1

There are 1 best solutions below

4
name-andy On

I had the same issue.

DELETED INCORRECT ANSWER

Edited

Previously I incorrectly said to put the name of the datastore in single quotes in the sql query.

But it was the name of the topic that I had to put in single quotes. This is actually in your sql statement in the IoT Core rule

NOT

the sql statement for the datastore.

So the sql for the topic should look like

SELECT * FROM 'some_topic'

That is, the topic that that you are publishing to.

Adding query images

Topic query

Topic Query

Dataset query

Dataset Query