Re: [ZODB-Dev] Iterate through all objects from ZODB

2014-09-23 Thread Jim Fulton
On Mon, Sep 22, 2014 at 11:12 PM, Carlos Sanchez
 wrote:
> Hi,
>
> I was wondering if there is an official API and/or a way to iterate through
> all objects in a ZODB database.

In general, official interfaces are found in ZODB.interfaces.

IStorageCurrentRecordIteration lets you iterate over meta data about
objects in the database, including oid, tid and pickle. Both
FileStorage and ZEO implement this interface.

You can pass the oid to a connection's get method to get the object.
Iterating over the entire database requires some care to avoid
exceeding RAM.  After dealing with each object, you'll probably want
to call cacheGC on the connection to free unneeded memory.

...

> We are using RelStorage (MySQL) and ZEO (4 Dev)

I don't know if RelStorage implements IStorageCurrentRecordIteration.

Jim

-- 
Jim Fulton
http://www.linkedin.com/in/jimfulton
___
For more information about ZODB, see http://zodb.org/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] Iterate through all objects from ZODB

2014-09-22 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Carlos Sanchez wrote:
> Hi,
> 
> I was wondering if there is an official API and/or a way to iterate 
> through all objects in a ZODB database. I found an implementation at
> https://mail.zope.org/pipermail/zodb-dev/2002-October/003483.html, 
> but I was wondering if there are more recent solutions.
> 
> We are using RelStorage (MySQL) and ZEO (4 Dev)
> 

I doubt that there is such an API since every object can theoretically
implement its own storage and traversal strategy. In particular every
class can store data in subobjects or attributes that are not directly
available through an API. Zope-ish applications use a dict approach but
even this won't give you all and everything out of the box.

- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQGUBAEBAgAGBQJUIPajAAoJEADcfz7u4AZjv8sLv0nQjIL9/GJTlwBFzGVOrE0v
f8iTUhcwnsNdTYXEIOZyBm5LF5BGl/8tMyuGoE2FFdjfZKFcAT8dakO+7PF18411
MA+TRScWbMscj+ekpqOFZIdAP0E4vJ4ZN4Ao/fsGLtsW/jjnqDhqWV0uPVf3bUU6
51aqai+vHxehuHhhM7rmoal9eFIn70JnWkPA4luqcGNNeQLZUWiP41SAlbxu2VmY
xXvZuiApkYSK9eMsWTfeqftWHjsWFogvRBvgT9vAU2V6Q0W7v1AAlcWsiPIT4sgf
WBwC8MF9gTNW51bExlellQ0hl00LgeEWgj5byW4cqZBUrMF+jAwxRmpK7h5f17+T
G5uI92f05WebOJxPZGUcbbzkfBsu0I7Oy7F8SYNAuaKNoaZd+bggvmQI+5P5Z4NP
R4XnY2iQa70RVd3v9jywYJtR2ujUqmrg5rEBSvoPm5wUN3UjBK75QwLc9nZwQfgJ
Gyry0IBOACmvNJjGNcJQ1QcQymFqE2E=
=eyV6
-END PGP SIGNATURE-
___
For more information about ZODB, see http://zodb.org/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev


[ZODB-Dev] Iterate through all objects from ZODB

2014-09-22 Thread Carlos Sanchez
Hi,

I was wondering if there is an official API and/or a way to iterate through
all objects in a ZODB database. I found an implementation at
https://mail.zope.org/pipermail/zodb-dev/2002-October/003483.html, but I
was wondering if there are more recent solutions.

We are using RelStorage (MySQL) and ZEO (4 Dev)

Thanks a lot

Carlos
___
For more information about ZODB, see http://zodb.org/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev