cmennens
Posts: 20
Joined: Fri Apr 12, 2013 5:50 pm

Database Project Suggestions

Tue Apr 10, 2018 7:39 pm

I installed PostgreSQL database on my Raspbian installed RPi3B+. I would like to get ideas / suggestions for constantly documenting anything to the local database. Was thinking of some Nginx web project that hooked into PostgreSQL or perhaps documenting the system temperature every 15 minutes to the local database along w/ timestamps.

Anyone have any ideas and or suggestions on how I can utilize my Pi as a constantly written to database server?

droleary
Posts: 174
Joined: Fri Feb 09, 2018 3:45 am
Location: Minneapolis, MN USA
Contact: Website Skype

Re: Database Project Suggestions

Wed Apr 11, 2018 3:43 pm

PostgreSQL is a pretty common database with all the regular local/network interfaces. It just comes down to using one of them from whatever programming environment you're getting the data you want to log.

Personally, though, I'd start with basic file logging. You don't mention anything you're doing with data that requires even an SQLite database.

User avatar
DougieLawson
Posts: 36578
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Database Project Suggestions

Thu Apr 12, 2018 8:13 am

droleary wrote:
Wed Apr 11, 2018 3:43 pm
Personally, though, I'd start with basic file logging. You don't mention anything you're doing with data that requires even an SQLite database.
SQL databases aren't chosen for data collection reasons. They're chosen for the ability to run complex SQL SELECTs against the stored data to enable you to answer questions that would otherwise be exceedingly difficult to resolve.

The hard part of SQL is the data modelling and data normalisation so that your complex SELECT runs in micro seconds rather than hours.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

droleary
Posts: 174
Joined: Fri Feb 09, 2018 3:45 am
Location: Minneapolis, MN USA
Contact: Website Skype

Re: Database Project Suggestions

Thu Apr 12, 2018 2:47 pm

DougieLawson wrote:
Thu Apr 12, 2018 8:13 am
SQL databases aren't chosen for data collection reasons. They're chosen for the ability to run complex SQL SELECTs against the stored data to enable you to answer questions that would otherwise be exceedingly difficult to resolve.
Yeah, that was my point. The OP made no mention of why a local database was desirable for data collection. It's going to be far less of a strain on the RPi if it simply appended text to a file. Sure, it might be wise to load that file into a database if/when it becomes necessary to query the information in a complex way. But that's not the half of the story being told, so I think it's premature to jump to needing a database at the start.

User avatar
B.Goode
Posts: 8987
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Database Project Suggestions

Thu Apr 12, 2018 3:06 pm

Only my interpretation, and @cmennens must speak for her/his self, but I thought maybe the post was from someone who was keen to learn about databases and was looking for a project as a basis for gaining that experience?

Being told to use a flat text file as an alternative doesn't move that ambition forward very much...
The Raspberry Pi Foundation is a UK-based charity that works to put the power of digital making into the hands of people all over the world, so they are capable of understanding and shaping our increasingly digital world, able to solve the problems that matter to them, and equipped for the jobs of the future.

We provide low-cost, high-performance computers that people use to learn, solve problems and have fun.
Ref: Raspberry Pi Foundation.

MaxVMH
Posts: 114
Joined: Mon Mar 19, 2018 1:26 pm

Re: Database Project Suggestions

Thu Apr 12, 2018 3:42 pm

If TS wants to be able to view/edit data in a browser, I suggest learning some basic PHP and log the data using cronjobs. Then use phpPgAdmin (a web based PostgreSQL database manager in PHP) to view/edit the data.

But that's my suggestion because I'm familiar with some basic PHP ... The same can be achieved in Python, JavaScript, etc. ... It all depends on what TS already knows / wants to achieve / is willing to learn.
Webserver stack: 2x Pi 3B | 1x Pi 3B+ ||| Pi Zero W for fooling around

Working on a soccer prediction web app:
https://github.com/MaxVMH/mijnscore
Attempt at writing up-to-date tutorials on making a Raspberry Pi webserver:
http://blog.mijnscore.be/

droleary
Posts: 174
Joined: Fri Feb 09, 2018 3:45 am
Location: Minneapolis, MN USA
Contact: Website Skype

Re: Database Project Suggestions

Fri Apr 13, 2018 2:55 pm

B.Goode wrote:
Thu Apr 12, 2018 3:06 pm
Only my interpretation, and @cmennens must speak for her/his self, but I thought maybe the post was from someone who was keen to learn about databases and was looking for a project as a basis for gaining that experience?
Could be. That's why I said they should look into the database libraries that are provided by their language of choice. Since their aim was unclear, I also gave a second option.

Return to “Networking and servers”