Wednesday 15 May 2013

Python "in memory DB style" data types -


I am creating a weather station using a raspberry P I have various sensors (temp, humidity, pressure, rain, etc.) ) And now I'm getting the process of wind sensor for me.

I have a dragon program which looks at the GPII pin, calculates the pulse to calculate the anomometer and the speed of the wind, to get this direction, through the anchorage of air through the ADC Also reads. For other sensors, I only process every few minutes and dump data directly to DB. Because I have to calculate a lot of things from wind sensor data, I do not necessarily want to write DB in every 5 seconds and then to read the data of the last 5 minutes to calculate the current speed and direction. I want to gather data in memory, processing it, then writing the last data in DB is something like sensor reading:

day-time, speed, direction = 2013-6-20 09 : 33: 45, 4.5, W 2013-6-20 09:33:50, 4.0, SW
2013-6-20 09:33:55, 4.3, W.

The program is calculating every 5 second data from the air sensor, I would like to write the data to DB every 5 minutes because the DB is on an SD card, I do not want to explicitly write DB 60 times, Then read it back to process it, then write it in permanent archival db every 5 minutes.

Am I better using the list of lists? Or a dictionary of Tuples made by datetime?
{datetime.datetime (2013, 6, 20, 9, 33, 45, 631816): ('4.5', 'W')}
{datetime.datetime (2013 (6, 20, 9, 33) , 55, 3872 9 4): ('4.3', 'W')}

For the latter, what is the best way to update a dictionary? Do I have it in a DB Leave it and read it back? It seems that one reads a lot for such a small number of data a day.

Multiple cache Layers Between Python Programs and Databases Specifically, Linux Disk Block Cache Usage Depending on the pattern of, you can keep your database in the core. Therefore, you should not believe that writing in a database and reading back is necessary to slow down some home-made cash in your application. And the code that you write to optimize your DB prematurely is going to be infinitely more buggy than the code.

For the workload you specify, MySQL M Zhe little Heavyweight relative SQLite, but you may be unsure of the reason for it.

No comments:

Post a Comment