Re: [Haskell-cafe] ORM for haskell?

2009-07-04 Thread Alberto G. Corona
And I realize that you are not trying to replace RDBs, just building a nicer interface to them. I am just concerned that some of the nice properties are lost in the process. I think my main concern comes from seeing people create databases, by automatically generating tables from OO-classes.

Re: [Haskell-cafe] ORM for haskell?

2009-07-03 Thread Jochem Berndsen
Chris Eidhof wrote: I've something working that sort of does this. You define your model in the following way: data User = User {name :: String, password :: String, age :: Int, post :: BelongsTo Post} data Post = Post {title :: String, body :: String} Then there's some boilerplate code

Re: [Haskell-cafe] ORM for haskell?

2009-07-03 Thread Chris Eidhof
On 3 jul 2009, at 11:28, Jochem Berndsen wrote: Chris Eidhof wrote: I've something working that sort of does this. You define your model in the following way: data User = User {name :: String, password :: String, age :: Int, post :: BelongsTo Post} data Post = Post {title :: String, body

Re: [Haskell-cafe] ORM for haskell?

2009-07-02 Thread Mads Lindstrøm
Hi Marc Weber Hi Mads! On Tue, Jun 30, 2009 at 11:49:40PM +0200, Mads Lindstrøm wrote: Hi Marc Weber Another example: Updating the age of a pupil: row = SELECT * FROM pupils where age = 13; UPDATE pupils SET age = 14 WHERE id = the id you got above p =

Re: [Haskell-cafe] ORM for haskell?

2009-07-02 Thread Marc Weber
And I realize that you are not trying to replace RDBs, just building a nicer interface to them. I am just concerned that some of the nice properties are lost in the process. I think my main concern comes from seeing people create databases, by automatically generating tables from OO-classes.

Re: [Haskell-cafe] ORM for haskell?

2009-07-01 Thread Ketil Malde
Mads Lindstrøm mads_lindstr...@yahoo.dk writes: I do not get this explanation, could you expand? I would have thought it should be: difference? Because SQLAlchemy knows about the relationships (not relations, but relation_ships_), it do not have to explicitly join on foreign keys.. I think

Re: [Haskell-cafe] ORM for haskell?

2009-07-01 Thread Chris Eidhof
Hey Marc, On 30 jun 2009, at 19:52, Marc Weber wrote: Is there anyone interested in helping building a library which a) let's you define kind of model of you data b) let's you store you model in any backend (maybe a relational database) c) does static checking of your queries at compilation

[Haskell-cafe] ORM for haskell?

2009-06-30 Thread Marc Weber
Some time ago I stumbled upon SQLAlchemy which is a great ORM wrapper library for python. It has a nice syntax I'd like to see in a haskell library as well. SQLAlchemy already provides some lazy features such as loading subitems on access etc. All haskell SQL libraries I know only let you run

Re: [Haskell-cafe] ORM for haskell?

2009-06-30 Thread Daniel Peebles
I don't have a good answer to your question, but I'm curious of how lazy loading of SQL-based records would work. It seems like having another user of the database modify your record before you've loaded it all could lead to an inconsistent record (assuming you've already loaded and memoized some

Re: [Haskell-cafe] ORM for haskell?

2009-06-30 Thread Rick R
It has to do with treating groups of records from a table like an object. You have the object Employee, which consists of rows from the Person table, the Account table and the Building table. When you instantiate the object. if you don't ask to view the Employee's building information, it doesn't

Re: [Haskell-cafe] ORM for haskell?

2009-06-30 Thread Mads Lindstrøm
Hi Marc Example why it matters: schools - 1:n - teachers - 1:n - pupils If you want to list all schools which have a pupil with age 3 you'd write an sql query like this: SELECT dictinct * FROM schools as s JOIN teachers t ON (t.school_id = s.id) JOIN pupils as p ON (p.teacher_id =

Re: [Haskell-cafe] ORM for haskell?

2009-06-30 Thread Mads Lindstrøm
Hi Marc Weber Another example: Updating the age of a pupil: row = SELECT * FROM pupils where age = 13; UPDATE pupils SET age = 14 WHERE id = the id you got above p = session.query(Pupil).filter(Pupil.age==13).one().age=14 session.commit() difference? You don't have to

Re: [Haskell-cafe] ORM for haskell?

2009-06-30 Thread Marc Weber
Hi Mads! On Tue, Jun 30, 2009 at 11:49:40PM +0200, Mads Lindstrøm wrote: Hi Marc Weber Another example: Updating the age of a pupil: row = SELECT * FROM pupils where age = 13; UPDATE pupils SET age = 14 WHERE id = the id you got above p =

Re: [Haskell-cafe] ORM for haskell?

2009-06-30 Thread Jeremy Shaw
At Tue, 30 Jun 2009 19:52:08 +0200, Marc Weber wrote: Is there anyone interested in helping building a library which a) let's you define kind of model of you data b) let's you store you model in any backend (maybe a relational database) c) does static checking of your queries at