Johannes Held
unread,May 3, 2012, 2:19:43 AM5/3/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to datam...@googlegroups.com
Hello list,
I’m wondering what's the proper way to execute a SQL statement via DataMapper.
Assume I these models are created at runtime:
class Bar
include DataMapper::Resource
property :id, :Serial
end
class Foo
include DataMapper::Resource
property :a, :Serial
property :b, :Serial
belongs_to Bar, :key => true
end
Now I want to create a view (and a model to mirror that view):
create view foo_count as
select a, b, count(bar) as count
from foo
group by a, b
How can I use DataMapper to execute this statement?
Is there a way to use the name system of DataMapper?
--
Cheers, Johannes