Dynamic typing converter from the incoming sensory data to the database #19
Labels
No labels
_CRITICAL_
API
app
backEnd
Blocked, waiting for further changes
bug
cleanup
close
design
duplicate
enhancement
feature request
frontEnd
help wanted
invalid
low priority
needs input
needs review
project documentation
question
research
reviewed
script
security
SQL
style
testing
topLevel
wontfix
No milestone
No project
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Andras/BoundlessFlowCampus2K#19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Right now, a table is created in the sensors database for each sensor that comes in via MQTT.
The created database table includes a timestamp and a payload.
We need a solution to create the table with all the necessary fields for the incoming data: i.e., determine what kind of data it is and create columns with the correct data types.
May we need some form of a Strategy design pattern to handle this?
We've done some research on this today and we've come up with some ideas that we're gonna experiment with over the weekend.
I've made some progress(or experiments rather, if you prefer to call it that), but I'm not entirely sure how we want to proceed with this.
I spent some time trying to have the data objects themselves control the SQL query by storing an array of strings that would declare what data type each property of the objects would have in the database.
The same thing could also be done by just using a single string and then having the middleware split it up and combine that string with the properties into an SQL-query.
Or, if we're not too picky about the datatypes we want to use in the database, we could just have each datatype on the objects (bool, string, int) correspond to a reasonably fitting SQL datatype. There could be some minor issues with this like how to handle DATETIME, but that could possibly be handled in the middleware.
I've also updated the middleware to output more information about the payload(s), which could prove useful when working on this area. (see picture)
Maybe I've completely misunderstood the issue. If so, please enlighten me.
Due to a lack of communication we both effectively created the same thing, albeit in different ways. We're working on solving it now.