Re: pyDO 2 alpha
Jacob Smullyan <[email protected]> Fri, 22 Apr 2005 15:52:48 -0400
| Newsgroups | gmane.comp.web.skunkweb |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Apr 22, 2005 at 11:45:57AM -0600, Jonathan Ellis wrote:
> Is there a summary of what the major changes in v2 will be from a user's
> standpoint?
This section of the manual more or less addresses that, although for
it to make sense you have to read the whole document:
http://skunkweb.org/PyDO2/manual.html#differences-from-pydo-1
For the most part, the refactoring is more or less under the hood and
the effect on the user api is mostly that is has been neatened and
consolidated (for instance, the various select methods have all been
folded into a single much improved getSome() method). However, it
isn't backwards compatible, and I may therefore change the package
name to PyDO2 in the next alpha. Converting from the old version to
the new should be quite easy, however:
# PyDO 1 class
class MyTable(PyDO):
connectionAlias="foo"
table="mytable"
fields=( ('id', 'int'),
('name', 'text'),
('whatsit', 'float') )
unique=['id', 'name']
sequenced={'id' : 'mytable_id_seq'}
#####
# PyDO 2 class
class MyTable(PyDO):
connectionAlias="foo"
table="mytable"
fields=(Sequenced('id', 'mytable_id_seq'),
Unique('name'),
'whatsit')
There are also new features. In the first alpha, the main one is the
.project() method, which returns a dynamically generated subclass with
(usually) fewer fields. (This means that you aren't always forced to
query the entire table you've defined when you aren't interested in
all the columns.) Under development but not yet ready for prime time
is an attempt to deal with cross, outer and inner joins so that you
can get multiple related objects at once. Optional runtime
introspection of table definitions is also planned.
PyDO2 is supposed to play better with threads than PyDO. (At the
moment, all this means is that db connections are stored in
thread-local storage. If you want to carry a transaction across
threads -- probably not a good idea! -- then you need to manually set
the connection for the thread.)
Also, PyDO instances now support attribute-style access as well as
dictionary-style; and PyDO is now a dict subclass. (In the old PyDO,
there was a module called "PyDO2" that did this, too, a bit buggily.)
That's about it. SQLObject is way ahead in terms of community
involvement, and it may be quixotic (oops, wrong framework!) to try to
get anyone interested in PyDO now. But since I'm maintaining it and
using it myself, I thought I should give it the sprucing up it
deserved.
Cheers,
js
--
Jacob Smullyan
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCaVYQuqamFyFXXLIRAo1yAJ9Z+H5hxTH4u6npDfu2jrwke8wtOgCbBzGh vx2d00JRNheblBcQHSPf5LY= =b0Hu -----END PGP SIGNATURE-----