Comments (4)
"Catalog" is the usual term in ZODB-land (because a catalog contains one or more indexes). These aren't provided by ZODB itself, but there are packages that provide them on top of ZODB. E.g. one of those is repoze.catalog.
I haven't used catalogs much personally, so I cannot give recommendations.
from zodb.
Good answer. Thanks Marius.
To elaborate a bit, catalogs are objects that maintain multiple indexes on
a collection of objects. They provide for querying on one or more among
multiple indexes. When querying multiple indexes. They rely on some
low-level machinery provided by BTrees for doing set operations on results
from searching multiple indexes.
Jim
On Thu, Feb 11, 2016 at 8:13 AM, Marius Gedminas [email protected]
wrote:
"Catalog" is the usual term in ZODB-land (because a catalog contains one
or more indexes). These aren't provided by ZODB itself, but there are
packages that provide them on top of ZODB. E.g. one of those is
repoze.catalog http://docs.repoze.org/catalog/overview.html.I haven't used catalogs much personally, so I cannot give recommendations.
—
Reply to this email directly or view it on GitHub
#44 (comment).
Jim Fulton
http://jimfulton.info
from zodb.
@jimfulton , @mgedmin Thank you for your quick answer.
I didn't know about repoze.catalog (in fact i thought that repoze had only to do with authn/authz middleware).
I played a bit with it, and it seems that Catalog
objects can be persisted into a ZODB database. It also seems that the catalog doesn't own the indexed objects (and so cannot retrieve by docid), so an external mapping (i.e a DocumentMap
) must be maintained side-by-side and also be persisted into the database.
Am i correct? Is the following example valid?
class User(Persistent):
pass # Implement __cmp__, carry a `name` attribute
# Populate our containers
user_catalog = Catalog()
user_catalog['name'] = CatalogFieldIndex('name')
user_map = DocumentMap()
u1 = User('Totos')
u2 = User('Foo')
user_catalog.index_doc(1, u1)
user_map.add(u1, 1)
user_catalog.index_doc(2, u2)
user_map.add(u2, 2)
# Commit to database
db = DB(FileStorage('users.zodb'))
conn = db.open()
root = conn.root()
root['user_map'] = user_map
root['user_catalog'] = user_catalog
transaction.commit()
conn.close
My main concern lies at this warning: http://docs.repoze.org/catalog/usage.html#restrictions.
But maybe this is resolved by subclassing objects directly from object
??
from zodb.
You might want to look at souper. Its a single data structure that keeps
internal indexes so you can search it.
https://pypi.python.org/pypi/souper
On Fri, 12 Feb 2016 6:41 pm MichailAlexakis [email protected]
wrote:
@jimfulton https://github.com/jimfulton , @mgedmin
https://github.com/mgedmin Thank you for your quick answer.I didn't know about repoze.catalog (in fact i thought that repoze had only
to do with authn/authz middleware).I played a bit with it, and it seems that Catalog objects can be
persisted into a ZODB database. It also seems that the catalog doesn't own
the indexed objects (and so cannot retrieve by docid), so an external
mapping (i.e a DocumentMap) must be maintained side-by-side and also be
persisted into the database.Am i correct? Is the following example valid?
class User(Persistent):
pass # Implement cmp, carry aname
attributePopulate our containers
user_catalog = Catalog()
user_catalog['name'] = CatalogFieldIndex('name')
user_map = DocumentMap()u1 = User('Totos')
u2 = User('Foo')user_catalog.index_doc(1, u1)
user_map.add(u1, 1)
user_catalog.index_doc(2, u2)
user_map.add(u2, 2)Commit to database
db = DB(FileStorage('users.zodb'))
conn = db.open()
root = conn.root()root['user_map'] = user_map
root['user_catalog'] = user_catalog
transaction.commit()conn.close
My main concern lies at this warning:
http://docs.repoze.org/catalog/usage.html#restrictions.
But maybe this is resolved by subclassing objects directly from object ??—
Reply to this email directly or view it on GitHub
#44 (comment).
from zodb.
Related Issues (20)
- `fsstats` no longer matches output of `fsdump`
- Change `pack_date` interpretation?
- Any objections to releasing 5.7.0? HOT 3
- Blob usage depending on file size HOT 4
- 5.7.0: missing git tag? HOT 2
- 5.7.0: documentation build fails with sphinx 5.x HOT 11
- 5.7.0: pytest warning and ZODB/tests should not be installed HOT 13
- PyInstaller fails to find ZODB's config.xml and exe will no run when using a provided config from URL HOT 2
- Incorporating Blob with ClientStorage HOT 8
- Dual Inquiry: 2022 Best Practices for ZODB usage outside of ZOPE using ZEO SharedStorage HOT 1
- FileStorage and other api doesn't support pathlib interface. HOT 1
- with transaction() doesn't work as expected
- On ZODB's scalability HOT 6
- [Question] documentation for contributor of ZODB ecosystem HOT 1
- Switch test name prefix from `check` to `test`. HOT 2
- ZODB with nogil Python HOT 1
- check7ZODBThreads -> failed with InvalidObjectReference HOT 5
- PyPI Owner rights for ZODB HOT 2
- Question on ZODB License HOT 3
- The ZODB should create the "tmp" directory for savepoint automatically if the target directory does not exist. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zodb.