[Haskell-cafe] Handling Postgresql array types
nukasu.kanaka at gmail.com
Fri Dec 26 10:56:18 UTC 2014
There is a new player in this field named Hasql, which provides
straightforward mappings to list and vector. On top of that the API is
orders of magnitude lighter and the performance is up to 2 and 7 times
better compared to "postgresql-simple" and "HDBC". See the results of
2014-12-26 9:22 GMT+03:00 Amit Aryeh Levy <amit at amitlevy.com>:
> I doubt you'd need to extend the built-in conversion functions for
> postgresql-simple. In particular there is already an instance fo `ToField`
> `ToField a => ToField (Vector a)`
> meaning there is an instance for the type `Vector (Vector Float)` (because
> `Float` is also an instance of `ToField`). I believe that should work out
> of the box for you. I've never tried using two dimensional arrays, but I've
> used postgresql arrays as Vectors using postgresql-simple a lot, and it
> works great out of the box.
> If you're interested in going just a little bit higher level without
> abandoning postgresql-simple, I'd suggest postgresql-orm (shameless plug),
> which gives you an very lightweight ORM layer on top of postgresql-simple
> -- specifically a safe query DSL.
> On 12/25/2014 07:36 PM, Riaan wrote:
> This is a question about database query libraries. I am trying to do some
> analytics on a Postgresql database and up to now have been using
> Database.HDBC for most of my querying.
> One of the columns on the database is a two dimensional float8 array. I
> tried using Database.PostgreSQL.Simple but got stuck on this array as I
> could not figure out how to extend the built in conversion functions to
> cater for something like this. So went back to HDBC. But now my queries
> are starting to get fairly long and I have been looking at libraries like
> Persistent with Esqualeto, HaskellDB and Groundhog to make my queries a
> little more composable and type safe.
> However I have not been able to find any examples of any of these
> libraries using postgres arrays and given my postgresql-simple experience I
> worried that I might similarly be unable, because of my low level of
> haskell ability, to extend the conversion functions.
> So to my question. Does anyone have experience with one of these
> libraries in dealing with postgresql arrays and could someone perhaps send
> me a simple example that I could use as a basis. Failing that, can anyone
> advise me on which of these libraries have the most haskell newbie (LYAH
> trained, but still struggling with RWH) friendly approach to writing new
> conversion functions?
> Haskell-Cafe mailing listHaskell-Cafe at haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe