PostgresV3 is a pure Smalltalk
implementation of the PostgreSQL v3 wire protocol. I've modified
PostgresV3-Core to do parameter binding and added PostgresV3-DBAPI, a very
simple client API.
In PostgresV3-DBAPI, there are a number of examples in PG3ExampleClient.
These examples require a PostgreSQL server loaded with the Sakila database.
To set that up, firstly, download the
Sakila database files.
Place the PostgreSQL files in ~/data, say.
The quickest way to get PostgreSQL up and running is by Docker. Here's my
docker-compose file that uses the official Postgres-11 image. Data is kept
in a separate volume 'pgdata'.
Bring up PostgreSQL, create roles, load the Sakila data, assign
In a fresh Squeak image - I'm using 5.2 - evaluate in a workspace:
In a fresh Pharo image - I'm using the latest 7.0 pre-release - evaluate in
As this is a pure Smalltalk implementation, it should also work in earlier
versions of Squeak and Pharo.
Using the Pharo v40592 image with which I had
verified NBSQLite3 for Glorp,
in this blog post I go through doing the same with the PostgresV2
pure-Smalltalk database driver.
Outside of Smalltalk, create the database 'sodbxtest', user 'sodbxtest'
with password 'sodbxtest':
In Smalltalk, firstly, install PostgresV2:
Open Test Runner and runs the PostgresV2 tests. On my Linux Mint machine,
using a vanilla PostgreSQL 9.3 installation, 23 of 24 tests passed, and
Now that we know the PostgresV2 driver can talk to our database, using the
Monticello browser, open the PostgresV2 repository and load the package
GlorpDriverPostgreSQL. Here I had to edit
NativePostgresDriver>>connectionArgsFromCurrentLogin: to comment out
the second last line:
This is because GlorpDatabaseLoginResource class>defaultPostgreSQLLocalLogin
does not specify encodingStrategy, meaning it is nil and will respond to #asSymbol
Konstantin Gredeskoul, CTO of Wanelo, gave a great talk entitled "12-Step
Program for Scaling Web Applications on PostgreSQL";
Wanelo uses Rails, and as the title says, the talk is heavily focused on
PostgreSQL, but many of the points should be applicable to Smalltalk
SCouchDBViewServer, by Jesus Mari Aguirre, a fork and superset that includes other functionality.
Neo4J is a graph database. It
is provides a RESTful API. I've not played with Neo4J, but I'd imagine the
Smalltalk environment, and by extension any Smalltalk object persistence
mechanism, make up a graph database. Probably speaking from ignorance here,
but I'm not sure what interest a Smalltalk programmer will have in a graph
database written in Java. :-)
I haven't finished the book, but so far I haven't seen any discussion on
authentication or security of these HTTP-speaking NoSQL databases. If the
database is lacking authentication or SSL, and if your threat model covers
that, probably the easiest is to put these behind a proxy. And, for
database and other such connectivity from the Smalltalk client, I suggest
In the previous post I wrote about
visualizing the PostgresV3 pure Smalltalk
implementation of the PostgreSQL v3 wire protocol. That "visualization" was
in text, which is not nearly as visual as seeing the protocol state machine
In this post, let's use
GraphViz to do that. Building on the
code previously written: