finagle / finagle-postgres   0.13.0

Apache License 2.0 GitHub

PostgreSQL protocol support for Finagle

Scala versions: 2.13 2.12 2.11 2.10

Finagle Postgres

Build status Maven Central Join the chat at

This library provides PostgreSQL database support for Finagle.


See the GitHub Pages

Using the Postgres client


Finagle Postgres is published on Maven Central. Use the following sbt snippet to bring it as a dependency.

libraryDependencies ++= Seq(
  "io.github.finagle" %% "finagle-postgres" % "0.12.0"

Connecting to the DB

val client = Postgres.Client()
  .withCredentials("user", Some("password"))
  .withSessionPool.maxSize(1) //optional; default is unbounded

Selecting with simple query

val f ="select * from users") {row =>
    User(row.getString("email"), row.getString("name"))
logger.debug("Responded " + Await.result(f))

Integration Tests

sbt test won't run integration tests by default. In order to make it easier for development, a database environment is provided via Docker. After installing Docker and docker compose, run:

docker-compose up -d

A few environment variables need to be provided as well:

export PG_HOST_PORT=localhost:5432 PG_DBNAME=finagle_postgres_test PG_USER=postgres

With the database and variables in place, all tests will be executed. More details in IntegrationSpec





Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.