So I was looking at trying to get a cloud based database that was always on. I wanted to build some visuals over whatever data I ended up building and have the DB accessible from a cloud server seemed like the easy way. I wanted to keep it free because I hate spending when I don't need to, so that others could use it for free and because I was sure there must be options out there. In the end my life was made much easier by spending £10 but you can go with the same free option on this site.
https://www.freemysqlhosting.net/
Although not super fast or super sized it gives you a free and easily accessible database. So far I have easily connected using phpAdmin, BeeKeeper Studio, Python, Google Data Studio and Keboola. I have had no issues at all unlike several other solutions I have tried including Heroku.
To setup the DB you just set your location and hit start, you will then be e-mailed the connection details and then use your favourite MySQL IDE and you are in.
Above is a snapshot of me connected and using the database through Bee Keeper Studio. For me personally it is a great chance to get experience using MySQL, having mostly been limited to the Oracle stack this is great. So far I haven't done much more than create a few tables and views.
Below is the full code of the view that I cobbled together using Google / Stackoverflow. Given I have 10 years experience in Oracle it is not surprise that currently I feel Oracle is head and shoulders easier to use.
create or replace view v_parkrun_result as | |
select | |
substr(mailtext, | |
locate('Your time was',mailtext)+14, | |
8) event_time, | |
cast(substr(mailtext, | |
locate('Congratulations on completing your ',mailtext)+35, | |
3) as DECIMAL) parkrun_number, | |
-- get place | |
trim(substr(mailtext, | |
locate('Hello Gary',mailtext)+18, | |
locate('results for event ',mailtext) | |
- (locate('Hello Gary',mailtext)+18) | |
)) parkrun_place, | |
-- get position | |
cast(substr(mailtext, | |
locate('today. You finished in',mailtext)+22, | |
3) as DECIMAL) parkrun_position, | |
-- get total participants | |
cast(substr(mailtext, | |
locate('out of a field of ',mailtext)+18, | |
4) as DECIMAL) total_field, | |
-- age category | |
substr(mailtext, | |
locate('category VM',mailtext)+9, | |
7) age_category, | |
-- age grading (as percentage) | |
cast(substr(mailtext, | |
locate('You achieved an age-graded score of ',mailtext)+36, | |
5) as DECIMAL(4,2)) age_rating, | |
date(cast(date as datetime)) event_date | |
from ext_tab_parkrun_email | |
union all | |
select '00:21:15' event_time, 192 parkrun_number,'Eastbourne parkrun' place, 30, 343 , 'VM35-39' , 62.04, date('2022-03-05') union all | |
select '00:21:22' event_time, 191 parkrun_number,'Eastbourne parkrun' place, 28, 338 , 'VM35-39' , 61.7, date('2022-02-26') union all | |
select '00:22:52' event_time, 190 parkrun_number,'Eastbourne parkrun' place, 37, 318 , 'VM35-39' , 57.61, date('2022-02-12') union all | |
select convert('00:19:37',time) event_time, 189 parkrun_number,'Eastbourne parkrun' place, 15, 355 , 'VM35-39' , 67.2, date('2022-02-05') | |
; | |
create or replace view v_parkrun_processed as | |
select TIME_FORMAT(STR_TO_DATE(event_time, '%H:%i:%s'),'%H:%i:%s') event_time, | |
extract(MINUTE FROM TIME_FORMAT(STR_TO_DATE(event_time, '%H:%i:%s'),'%H:%i:%s')) * 60 | |
+ extract(SECOND FROM TIME_FORMAT(STR_TO_DATE(event_time, '%H:%i:%s'),'%H:%i:%s')) total_seconds, | |
(extract(MINUTE FROM TIME_FORMAT(STR_TO_DATE(event_time, '%H:%i:%s'),'%H:%i:%s')) * 60 | |
+ extract(SECOND FROM TIME_FORMAT(STR_TO_DATE(event_time, '%H:%i:%s'),'%H:%i:%s')))/60 decimal_minute, | |
parkrun_number, | |
parkrun_position, | |
total_field, | |
age_category, | |
event_date, | |
parkrun_place, | |
age_rating | |
-- time in seconds and deciaml time in minute. | |
from v_parkrun_result | |
Comments
Post a Comment