Emma,

> ouch, that's seriously unpleasant syntax.should these be proxied by
> methods in DataMapper so you could do DataMapper.query('SELECT.....")
> for default repository?

Actually, this is ugly on purpose because we want to discourage direct
SQL usage from within DM.

DM is an ORM designed to fetch and store objects in a data store
through a simple CRUD layer.  It won't handle reporting very well,
since there's no way to simply construct a non-trivial query for
aggregate reporting in a way that will work with more than a handful
of storage backends.  Even describing non-trivial aggregate report
queries between RDBMS' is a bit painful, but it gets insane when you
throw in CouchDB or web APIs.

I believe you should use the best tool for the job, and not every tool
can be used for every job.  In an attempt to make DM handle reporting
for every storage backend I believe it would become too complex to
satisfy it's primary goal of providing a simple CRUD layer on top of
data stores.

If you need a nice clean API to an RDBMS for reporting purposes, and
you don't want to use straight SQL, I would suggest looking at
Sequel.  It's closer to SQL syntax and it should be possible to
describe many queries with it.  I've wondered if it is possible to
create a layer between DM and Sequel so that you could still describe
the models in DM, and then indicate you want to use Sequel to
construct a query. I haven't looked into it though so anyone
interested in DM and Sequel: please do investigate.

With all that said, we will likely make this a little less ugly in the
future.  Something like this will probably be supported:

  results = repository.query('SELECT...')

Dan
(dkubb)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to