I'm using Apache Cassandra in an IoT application, where I plan to create a device abstraction for users to define their devices with required sets of attributes. And, for each attribute, any user can only define specific properties like name, data type, minimum value, maximum value, etc.
Like say, here are the examples for some devices:
Device:
Vehicle
Attributes it can have:
Speed (name = speed, data type = double, minimum value = 0, maximum value = 300)
Latitude (name = latitude, data = double, minimum = -90, maximum = 90)
Longitude (name = longitude, data = double , minimum = -180, maximum = 180)
Device:
Temperature Sensor
Attributes it can have:
Current Temperature (name = Current Temperation, data type = double, minimum = 0, maximum = 300)
Unit (name = Unit, datatype = string)
Each device can send data in real-time in form of key-value pairs.
Eg. - Vehicle could send the data like this:
Time: 6/4/2016 11:15:15.150, Latitude: 1.256, Longitude: -180.75, Speed: 50
Time: 6/4/2016 11:15:16.150, Latitude: 1.257, Longitude: -181.75, Speed: 51
Eg. - Temperature sensor could send data like this:
Time: 6/4/2016 - 11:15:15.150, Current Temperature: 100, Unit: Fahrenheit
Time: 6/4/2016 - 11:15:16.150, Current Temperature: 101, Unit: Fahrenheit
Now, because different devices can have different sets of attributes, I've been confused about how the data tables in Cassandra should be modeled. Some of the options I've considered so far are creating a table for each device or creating just a single table to store the values in Map data types. But, I'm still not sure as to which would the correct or better approach be to suit my needs. Please suggest some possible implementations. TIA