Re: couchDB datasource

2011-07-13 Thread Clément Hallet
Hard task you're working on there ;)
I have also think about automatically created views when building the
datasource. That was for filtering document type too, if I remember
well.

Imho, the main point here is that couchDB documents can have so many
shapes and format, that doing a strong ORM over it leads to use schema
and "standard" format in documents, which may be painful :p

Please, let us know how and if there is a way to follow how it's going
on. New ideas or help can be found that way.

Cheers
--
Clément



On 13 juil, 11:55, Thomas Ploch  wrote:
> As an addition to my last post, here is what I am currently doing:
>
> - Develop a special CouchDB Model that application models will extend
> - Add a required docType field to the Models (might be defaulting to
> Model::$alias) to check for in automatically created views.
> - In the CouchDB Model constructor, analyze the associations and build
> views depending  on those values (if debug > 0, the views will be staled
> immediately) as well as basic views that just emit the docType of the
> Model it is calling.
> - Override Model::find() in the CouchDB Model to process relations found
> by the specifically created relational views.
> - Implement listSources() to look for the Model views that describe the
> Model. I.e. you have the Models Apple and Banana, the views 'apples' and
> 'bananas' would be regarded as sources, while relational views would
> start with an underscore '_apples_relations'  would be disregarded in
> listSources()
>
> This would result in an implementation, which will not only fetch
> relations in one query to a view (or 2, depending on the final
> implementation), but also everything will be handled in one database.
>
> I am currently developing this, but this is shitloads of work, and it
> will still take me some time :)
>
> Kind regards
> Thomas
>
> Am Mittwoch, den 13.07.2011, 02:10 -0700 schrieb Clément Hallet:
>
>
>
>
>
>
>
> > Hello to cakePHP
>
> > I created a CouhDB datasource at my company, and we released it as
> > open source.
> > It handles CRUD methods on a document, and can query the CouchDB
> > views.
>
> > Code and documentation are available here 
> > :https://github.com/PathMotion/cakephp-couchsource
>
> > If you're interested in review, comment or bug-report it, please feel
> > free.
>
> > --
> > Clément

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: couchDB datasource

2011-07-13 Thread Clément Hallet
Hi Thomas,

Indeed, we use the "one database for one model" approach.
Since Couchdb doesn't have hardcoded relations, I'd share your
conclusion that it's not easy to have it automaticlay handled with a
relationnal oriented ORM.
Then, you could still have several models with the same database
(cakePHP table here), but each one using a specific view (where the
"type" filtering is done).


To be honest, there are only few parts of our website (http://
pathmotion.com) which use CouchDB.
Our philosphy is to still use SQL databases where there are relations
between models, and to duplicate some datas into CouchDB in order to
benefits the power of the indexes you told about.
They are mainly used for pre-calculation, aggregation, statistics. On
some intense algorithm, the gain was about 80 times faster !

Regards
--
Clément




On 13 juil, 11:33, Thomas Ploch  wrote:
> Hi,
>
> I am currently doing the same for my company as well.
> You are going to face a bit of trouble here, since I can't see how you
> model your couchdb views to fetch relations. See an introduction on
> Entity Relations with couchdb views 
> here:http://wiki.apache.org/couchdb/EntityRelationship
>
> As an addition, the approach with multiple databases (one for each
> model) seems flawed, since what about bigger projects needing
> master/slave replication logic. For a bigger amount of Models, this will
> not be manageable.
>
> I don't think the CouchDB view approach can be achieved without a
> special CouchDB Model overriding save(), find(), etc. Since the approach
> differs extremely to the approach the CakePHP Model class is handling
> the relations.
>
> Although I think that this is a good start to implement the CouchDB view
> API (the BTree indexes are awfully fast :)), I think there is still a
> lot to do to make it what I would call a "production ready" DataSource.
>
> Best regards
> Thomas
>
> Am Mittwoch, den 13.07.2011, 02:10 -0700 schrieb Clément Hallet:> Hello to 
> cakePHP
>
> > I created a CouhDB datasource at my company, and we released it as
> > open source.
> > It handles CRUD methods on a document, and can query the CouchDB
> > views.
>
> > Code and documentation are available here 
> > :https://github.com/PathMotion/cakephp-couchsource
>
> > If you're interested in review, comment or bug-report it, please feel
> > free.
>
> > --
> > Clément

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: couchDB datasource

2011-07-13 Thread Thomas Ploch
As an addition to my last post, here is what I am currently doing:

- Develop a special CouchDB Model that application models will extend
- Add a required docType field to the Models (might be defaulting to
Model::$alias) to check for in automatically created views.
- In the CouchDB Model constructor, analyze the associations and build
views depending  on those values (if debug > 0, the views will be staled
immediately) as well as basic views that just emit the docType of the
Model it is calling.
- Override Model::find() in the CouchDB Model to process relations found
by the specifically created relational views.
- Implement listSources() to look for the Model views that describe the
Model. I.e. you have the Models Apple and Banana, the views 'apples' and
'bananas' would be regarded as sources, while relational views would
start with an underscore '_apples_relations'  would be disregarded in
listSources()

This would result in an implementation, which will not only fetch
relations in one query to a view (or 2, depending on the final
implementation), but also everything will be handled in one database.

I am currently developing this, but this is shitloads of work, and it
will still take me some time :)

Kind regards
Thomas

Am Mittwoch, den 13.07.2011, 02:10 -0700 schrieb Clément Hallet:
> Hello to cakePHP
> 
> I created a CouhDB datasource at my company, and we released it as
> open source.
> It handles CRUD methods on a document, and can query the CouchDB
> views.
> 
> Code and documentation are available here : 
> https://github.com/PathMotion/cakephp-couchsource
> 
> If you're interested in review, comment or bug-report it, please feel
> free.
> 
> --
> Clément
> 


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: couchDB datasource

2011-07-13 Thread Thomas Ploch
Hi,

I am currently doing the same for my company as well.
You are going to face a bit of trouble here, since I can't see how you
model your couchdb views to fetch relations. See an introduction on
Entity Relations with couchdb views here:
http://wiki.apache.org/couchdb/EntityRelationship

As an addition, the approach with multiple databases (one for each
model) seems flawed, since what about bigger projects needing
master/slave replication logic. For a bigger amount of Models, this will
not be manageable.

I don't think the CouchDB view approach can be achieved without a
special CouchDB Model overriding save(), find(), etc. Since the approach
differs extremely to the approach the CakePHP Model class is handling
the relations.

Although I think that this is a good start to implement the CouchDB view
API (the BTree indexes are awfully fast :)), I think there is still a
lot to do to make it what I would call a "production ready" DataSource.

Best regards
Thomas

Am Mittwoch, den 13.07.2011, 02:10 -0700 schrieb Clément Hallet:
> Hello to cakePHP
> 
> I created a CouhDB datasource at my company, and we released it as
> open source.
> It handles CRUD methods on a document, and can query the CouchDB
> views.
> 
> Code and documentation are available here : 
> https://github.com/PathMotion/cakephp-couchsource
> 
> If you're interested in review, comment or bug-report it, please feel
> free.
> 
> --
> Clément
> 


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php