Insert data in sqlite or mssql

Hello everyone, I want insert data upto only some points (for example only entry 500 datapoints) in sqlite or sql database, and then data insertion will stop automatticaly. Is there any such node library available, or any other solution to develop? can anyone help me how to develop?

Have you searched the flows library.

There are both MSSQL and sqlite nodes.

I can't vouch for sqlite nodes but I know node-red-contrib-mssql-plus works very well.

The read me has info to help.

1 Like
  • How long of a time will it be till you hit the limit?
  • How will you detrermint the time limit? Fixed? Vaariable?
  • How you you determine the number of rows to create?
  • Will this be restarted at some time (like, insert 300 points in a half hour then start inserting 300 more in the next haclf hour...etc)

As steve said there are many mysql and sqlite nodes you can try out,

1 Like

Thanks for quick reply.
There is no time limit for datalogging. I will elaborate in details for better understanding. I am developing the logic for connecting my IoT device to the cloud. If internet connection is disabled then it buffer data in local sql database(like 300 points then it has to be stopped) and once the connection is established with cloud then data(from local database) will send to the cloud automatically. This is my requirement.
Hope you understand. Thanks

I understand and do exactly the same thing except I don't use a database. I use this.

So a datum comes in

  • you try to send to cloud
    • it succeeds, then you check to see if you have stored data
      • if so loop thru sending it to the cloud, deleting each datum after is is sent
    • it fails store the data in the database of buffer - set flag saying there is stored data.

that seems to be basically what you want to do. I would break it down and do each of those separately. Put together a flow that writes to the database (or buffer). build the flow that will read from the database and send each datum out and then delete it if it worked.

I hope you are planning on timestamping the data in the NR flow before sending it to the cloud, that way any data that is 'held' while offline, will beable to be logically (timestamp) be organized where ever you are sending it. And remember, it is possible that while you are in the loop to send out the stored data, more datums could be coming in.

1 Like

Hi,
Is there any similar kind of solution is available, can you share me link or flows?

I don't have a flow, but I gave you the basis of a flow. Did you try to create it? If not, why not?
if you did and are having problems, let us know and i'll will be happy to guide you to a solution.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.