John Coleman
Posts: 8
Joined: Thu Jun 21, 2012 5:07 pm

Re: Best Database

Sun Jun 24, 2012 11:16 am

Postgres for me, it's my favourite FOSS database and its spatial extension via PostGIS is brilliant. I'm not a python person (yet) but I have successfully installed PostGIS on RPi / Archlinux. I even managed to run a java-gnome client app against it, although I had to import the jar file for that - RPi can't handle the eclipse IDE I developed it on. See java-gnome to the stars on my (RPi hosted) blog. Don't forget to install pgadmin3 as well.

RPi is remarkable, but we shouldn't expect too much of it. Like me, it's not good at multi-tasking, it can only do one thing at a time.

John Coleman
Posts: 8
Joined: Thu Jun 21, 2012 5:07 pm

Re: Best Database

Wed Jul 18, 2012 9:30 am

John Coleman wrote:See java-gnome to the stars on my (RPi hosted) blog.
Oops I lost my static IP address. My ISP withdrew RPi's static IP and I can't afford an upgrade to replace it. So I have switched to Dynamic DNS via http://dalriada.hopto.org/rpi , thanks to no-ip.com and my Draytek router.

java-gnome to the stars is now at http://dalriada.hopto.org/rpi/?p=68

dannym
Posts: 7
Joined: Thu Jul 19, 2012 9:01 pm

Re: Best Database

Thu Jul 19, 2012 9:27 pm

gjs wrote:What would be a good database to use for:

Application to be written in python
Simple structure (one table) but large, up to several GB
Runs locally on the RPi as part of the application, not on a server
Seems the most important question was not yet asked:
Do you need to find records quickly more than writing new records quickly?
If yes, use a database like bsddb.
If no, just use a file.
No need to use relational databases if you don't need more than one table and hence no relations...

jmrnilsson
Posts: 2
Joined: Sat Feb 08, 2014 3:34 pm

Re: Best Database

Sat Feb 08, 2014 3:39 pm

Hi

I'd go with Tims suggestion assuming you don't care about relational consistancy.

-jmr

jmrnilsson
Posts: 2
Joined: Sat Feb 08, 2014 3:34 pm

Re: Best Database

Sat Feb 08, 2014 3:45 pm

I'v been using couchdb successfully for quite some time on rpi. Easy enough to get started and binaries in the raspian repo.

-jmr

houmanb
Posts: 1
Joined: Wed Apr 30, 2014 7:35 am

Re: Best Database

Wed Apr 30, 2014 7:50 am

hi,
Actually it is not a big deal to setup postgres (at least on Raspbian distribution).
Here is a setup script I wrote in order to install postgresql and multicorn, which is a fdw abstraction written in python (see: http://multicorn.org/ for more details).
It had to be started using sudo or under root account.

Code: Select all

#!/bin/bash

echo "######################################"
echo "# This script is only for usage under "
echo "# Debian 7.3.0                        "
echo "# Ubuntu 12.04                        "
echo "# Raspbian                            "
echo "######################################"


###############################################################
# Check for input variables
###############################################################

if [[ -z "$1" ]]; then 
	echo "USAGE:"
	echo "\$1 ... DBVERSION (i.e. 9.3.2)"
	exit
fi


###############################################################
# set local variables
###############################################################

BASEDIR=$PWD
PG_BIN=/usr/local/pgsql/bin/
DBVERSION=$1



###############################################################
# Download postgres
###############################################################

mkdir -p ./build/postgres

echo "Using Postgresql version postgresql-"$DBVERSION".tar.bz2"

#get postgres sources
DBFILEPATH="http://ftp.postgresql.org/pub/source/v"$DBVERSION"/postgresql-"$DBVERSION".tar.bz2"
PGSOURCEBALL="postgresql-"$DBVERSION".tar.bz2"
wget -O "./build/postgres/"$PGSOURCEBALL $DBFILEPATH

#upack sources
cd ./build/postgres
tar xjf $PGSOURCEBALL



###############################################################
# Download libraries needed
###############################################################

#install needed libraries
apt-get --assume-yes update
apt-get --assume-yes upgrade
apt-get --assume-yes install bison  
apt-get --assume-yes install libreadline6 
apt-get --assume-yes install python-dev 
apt-get --assume-yes install libghc-zlib-dev 
apt-get --assume-yes install libreadline-dev 
apt-get --assume-yes install build-essential 
apt-get --assume-yes install subversion 
apt-get --assume-yes install xsltproc 
apt-get --assume-yes install git 
apt-get --assume-yes install python-setuptools 
apt-get --assume-yes install redis
apt-get --assume-yes install autoremove


###############################################################
# build postgresql
###############################################################

#configure make make install
cd $BASEDIR"/build/postgres/postgresql-"$DBVERSION
./configure --with-python

make
make install

export PATH=/usr/local/pgsql/bin:$PATH

###############################################################
# add postgresql to init.d
###############################################################

cp contrib/start-scripts/linux /etc/init.d/postgresql
chmod +x /etc/init.d/postgresql
update-rc.d postgresql defaults

###############################################################
# build all postgresql contribs
###############################################################
cd ./contrib
make
make install

###############################################################
# build Multicorn and add the additional FDW for yahoo weather
###############################################################
cd $BASEDIR/build/
git clone https://github.com/Kozea/Multicorn.git
cd Multicorn
make
make install




###############################################################
# add postgres user and prepare the environment to start DB
###############################################################

useradd -m -d /usr/local/pgsql/home -U -s /bin/bash postgres
#prepare the data direcory
mkdir -p /usr/local/pgsql/data
chmod g-rwx /usr/local/pgsql/data
chmod o-rwx /usr/local/pgsql/data
chown postgres:postgres /usr/local/pgsql/data

su - postgres -c "/usr/local/pgsql/bin/initdb -E utf8 -D /usr/local/pgsql/data/"

#start DB
su - postgres -c "/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /dev/null -o \"-i\" start"

export PATH=/usr/local/pgsql/bin:$PATH

#add postgres to the path permanently
echo "export PATH=/usr/local/pgsql/bin:$PATH" >> /etc/profile
. /etc/profile

Attention:
This script comes with absolutely no warranty. It is your responsibility to read the script and analyze it before further use.

User avatar
jack.chaney
Posts: 13
Joined: Sun May 31, 2015 5:17 pm

Re: Best Database

Thu Jul 16, 2015 2:26 pm

Hi,

Just wondering if any consideration has been made for Derby. I've used it quite a bit and it only requires a JRE to run (the whole thing is written in Java). Good performance, relational model, and SQL access (and my second favorite price "free"). Comes from the Apache project so it operates under GPL.

User avatar
nielsx
Posts: 2
Joined: Thu Dec 08, 2016 4:10 pm
Location: Italy
Contact: Website

Re: Best Database

Fri Dec 09, 2016 9:04 am

Could you tell us if you finally set up your database with SQLite? Did you store the database file in a usb flash memory or SSD, I read external devices share bandwidth with ethernet port, is that true?

Return to “Python”

Who is online

Users browsing this forum: No registered users and 12 guests