[Haskell-cafe] ANNOUNCE: HaskellDB 2.0: Scrap your SQL strings

Justin Bailey jgbailey at gmail.com
Fri Oct 8 12:29:30 EDT 2010


What is it?
========

The HaskellDB library lets you generate SQL queries without writing
any actual SQL. Unlike other query generating libraries, you choose
the abstraction level. Queries can be built out of independent
fragments, just like your programs. Leave hand-written, string-based,
SQL libraries behind and check out HaskellDB.

Where to get it?
============

You can get it  from Hackage
(http://hackage.haskell.org/package/haskelldb) or by using cabal
(cabal install haskelldb).

You also need drivers for your specific database. HaskellDB currently
supports the HDBC family of drivers. First, download haskelldb-hdbc
(http://hackage.haskell.org/package/haskelldb-hdbc), then get the
appropriate package  for your database:

  * ODBC: haskelldb-hdbc-odbc
(http://hackage.haskell.org/package/haskelldb-hdbc-odbc)
  * Postgres: haskelldb-hdbc-postgresql
(http://hackage.haskell.org/package/haskelldb-hdbc-postgresql)
  * Sqllite: haskelldb-hdbc-sqlite3
(http://hackage.haskell.org/package/haskelldb-hdbc-sqlite3)

Documentation, Mailing List, Source, etc
=======================

Go to http://trac.haskell.org/haskelldb for detailed information.

What's New?
=========

  * New query capabilities: stored procedures, CASTs, query
parameters, constants, and more.
  * Postgres SQL improvements.
  * Bug fixes around AND and OR associativity.
  * Query optimization improvements around aggregate expressions.
  * More tests.

Details
=====

Back in June 2009, Bjorn Bringert passed maintainership of HaskellDB
to me. I've been working this summer to get a release out, which
included:

  * Adding an examples/ directory to the source distribution.
  * Archiving and consolidating information to
http://trac.haskell.org/haskelldb.
  * Accepting patches for various issues.

I have used a lot of ORM & SQL-wrapper libraries during my career and
HaskellDB is the first that I've found which does not require you to
eventually break the abstraction.

Learning to use the the library was a fun challenge but not one that
many people are willing to take, when they can easily write SQL by
hand. If the library was easier to get started with, I think it would
be much more widely used. Help me get HaskellDB better documentation!

If you are using HaskellDB and want to help: go to
http://trac.haskell.org/haskelldb and write an article, write a blog
post, get in touch with me, etc. When I saw that Rails 3.0 uses the
"ARel" gem (based on the relational algebra) I groaned - Haskell has
had that forever! We need to get the word out!

Why 2.0?
--------------

Last year Brian Bloniarz contributed an awesome patch which replaced
HaskellDB's home-grown record system with the HList library by Oleg
Kiselyov (and colleagues). I intended to work with the library for
awhile and get a 1.0 release out.

Unfortunately, HList proved too daunting for GHC and for me. Compile
times went way up, and I could not isolate it enough to give GHC HQ a
repro case. Even worse, HList required too many Oleg units for me to
comprehend. I could usually fix compile errors, but found myself
struggling to extend HaskellDB's functionality. In the end I felt I
needed to back the patch out. I really hated to lose some of the
functionality but in the end maintainability won out. At that point I
had pushed a few patches with a v1.0 cabal file, so I thought it best
to make this release 2.0.

Who am I?
---------------

I started using HaskellDB in early 2009. I use it more as a
query-generating library than for executing SQL statements. I have
written a largish system for generating a data-access layer in PHP
from query descriptions in HaskellDB. Yes, I'm using Haskell to write
PHP ... dirty!

Unmaintained & Unrelated Packages
-----------------------------------------------------

A couple of haskelldb related packages on Hackage are not maintained by me:

  * haskelldb-hdbc-mysql - This project was created and uploaded
independent of me. Contact the author for specifics. However, the
haskelldb-hdbc-odbc library is maintained by me and can be used to
talk to MySQL.
  * HSQL (haskelldb-hsql, etc)  - I cannot get this backend to compile
on my platform. HSQL seems unmaintained so I have let the drivers
decay. You'll notice I have not uploaded new packages or changed their
version dependencies.
  * haskelldb-flat and haskelldb-dynamic - Both of these packages have
suffered serious bitrot and are not maintained any longer.


More information about the Haskell-Cafe mailing list