In this post I will explain how to connect to PostgreSQL on Raspberry PI using
Python is a good language for scripting, so it could be useful to include our
psql statements inside a
python script, without the requirement of having
psql installed on client machine.
The first thing to do if you want to connect to PostgreSQL on your Raspberry is to configure PostgreSQL to accept remote connections:
In the previous post we’ve already explained how to set the Raspberry PostgreSQL server to allow incoming connections.
PostgreSQL shell client is
psql. Unlike pgAdminIII,
psql is the terminal-based front-end to PostgreSQL, included in by default in the PostgreSQL package.
psql enables to type in queries interactively, and provides meta-commands and shell-like features to facilitate writing scripts and automating a wide variety of tasks.
In step 5, we have installed PostgreSQL. We then performed some benchmarks, by following tips and tricks contained in the world famous book about “PostgreSQL High Performance” by our dear Gregory Smith.
Results will be now presented, to test the efficiency of a PostgreSQL database server installed on a Raspberry PI. This represents a good challenge: build up a database server in a cheap way! Let’s not forget our goal: be able to adopt Postgres in schools so that the SQL language can be taught!
Previously, we have been able to install Linux and configure it on our Raspberry PI. It is now the moment to turn our Raspberry PI into Raspberry PG, by installing PostgreSQL 9.3.