On turning excellence in Python into epic mediocrity in SQL. Very successful mediocre SQL.
Today is a brute-force day. I needed to collect second-by-second data from a database over a 4-hour period. There were 2 queries that needed to be run, each just generating a single number for each second (counting events/sec). If I knew anything about SQL these could probably be done in exactly 2 queries. I don't know any useful SQL so I ran individual SQL queries for every single second. That's 28,800 total queries.
I didn't hand-write them, of course. I first wrote a python script to generate the queries and craft a simple SQL script. After generating my two SQL scripts (each 3 MB) and running them, I had 2 data files each containing 14,400 data points. Then I used my text editor, EditPadPro, to trim the whitespace and condense to a single column of numbers. Then I pasted into Excel.
Then I made a line chart from the two number sets which almost brought Excel to its knees, but it worked! It was cool but there was no way to zoom in on the smaller more interesting sections, plus the thing took several seconds to redraw after any scrolling. I ended up creating separate charts for each hour so the graphs render much faster. Now I am calculating some interesting max, mean, and mode numbers to reduce it all to useful summary numbers.
The last few hours were therefore a major triumph of brute force effort: writing a program to generate two other programs (the SQL queries) to generate the 28,800 data points. All because I only know very basic SQL queries.
It was a blast!
BONUS — my generator program understands natural language, so when I ran it I did 'elog_count.py today 01:00:00 to today 05:00:00 by second for "InformPeriodic" '. Then once again for 'InformValueChanged' for the other query.