Issue 127 in couchdb-python: ViewDefinition.sync_many for many views is very unhandy

3 views
Skip to first unread message

couchdb...@googlecode.com

unread,
May 12, 2010, 10:42:14 PM5/12/10
to couchdb...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 127 by kxepal: ViewDefinition.sync_many for many views is very
unhandy
http://code.google.com/p/couchdb-python/issues/detail?id=127

What steps will reproduce the problem?
1. Create about 30 types of document schemes
2. Add about 10-15 views for each document schema
3. Try to sync views with couchdb via
couchdb.design.ViewDefinition.sync_many

What is the expected output? What do you see instead?
I expected way to sync all views by document class. Something like:
couchdb.design.ViewDefinition.sync_many(db,[Couteragents, Orders,
Cars, ...])

Instead I must describe each view for each document:
couchdb.design.ViewDefinition.sync_many(db,
[Counteragents.by_name, Counteragents.list, Counteragents.by_discount,
Counteragents.by_car, Counteragents.address_info, ..., Cars.by_model,
Cars.list, Cars.by_year, Cars.by_owner, ...]
)

What version of the product are you using? On what operating system?
Linux 2.6.32.11-calculate, couchdb 0.11.0, couchdb-python 0.7.1@33d71d3080ba

Please provide any additional information below.
I see two problems there:
1. When I'm adding new view or removing old one I must also check up for
sync_many call and add/remove view to/from second argument.
2. I may suddenly forget for some view and I will have an error. With more
than 30 views it's an easy.

I don't see this method bad, but there must be much more easy solution to
sync up all Document views.

For now, we're using such solution:

from couchdb.mapping import Document,ViewField
class DocumentWhichKnowsOwnViews(Document):
@classmethod
def list_views(cls):
return filter(lambda value: isinstance(value, ViewField),
cls.__dict__.values())

than all other documents are derived from DocumentWhichKnowsOwnViews and
then:

couchdb.design.ViewDefinition.sync_many(db,[
Counteragents.list_views(),
Orders.list_views(),
...#etc
])

Not great solution, but it's solving this problem. And it will be great to
have such functionality by default.

--
You received this message because you are subscribed to the Google Groups "CouchDB-Python" group.
To post to this group, send email to couchdb...@googlegroups.com.
To unsubscribe from this group, send email to couchdb-pytho...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/couchdb-python?hl=en.

couchdb...@googlecode.com

unread,
Jul 15, 2014, 3:25:03 AM7/15/14
to couchdb...@googlegroups.com

Comment #1 on issue 127 by djc.ochtman: ViewDefinition.sync_many for many
This issue has been migrated to GitHub. Please continue discussion here:

https://github.com/djc/couchdb-python/issues/127

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages