Thanks for the help; I took a CVS update and rebuilt and the random module worked fine.  The sqlalchemy package imports with no errors, and I've poked around executing some parts of the code that don't need a database connection (utility code, etc).

So I think I'm now at the point of needing either a sqlalchemy backend for zxJDBC, or a mock backend I can use to exercise more of the code.

It looks like my next step should be to contact Frank and Jason about their work so far to get a lay of the zxJDBC land and see where I might be able to help out.

On Mon, Apr 14, 2008 at 1:54 PM, Philip Jenvey <> wrote:

On Apr 14, 2008, at 9:31 AM, Christopher Collier wrote:

I'm working on a J2EE project, and I'm building a suite of custom development tools for the dev team in Jython.  I could really us an OR mapper, so I thought I'd do some research on getting SQLAlchemy working (using a Java OR mapper is not an option for me).

Question 1: Is it worth my time doing this?  Am I duplicating effort w/ something someone else is doing?

Sure! Frank Wierzbicki has taken a crack at this. He had some patches to get it working with mysql in a sort of unofficial way (though those patches might be outdated by now).

The SQLAlchemy test suite heavily uses decorators (which Jython currently doesn't support, but hopefully soon will) -- but Jason Kirtland, one of the SQLAlchemy developers, actually wrote a script that will convert all those decorators into normal function calls, so the tests can run on Jython.

Last time he tried it, Jason said that quite a high number of tests were already passing on Jython.

Jason's also started some work on refactoring the dialect handling to work better with Jython:

Since I'm new to the jython source, it's taking me some time to track down the very first problem I've encountered.  I'm seeing the following exception  upon executing the above import statement:

java.lang.NoClassDefFoundError: org/python/modules/random/PyRandom$Random_seed_exposer
       at org.python.modules.random.PyRandom$PyExposer.<init>(Unknown Source)

When I look in the jython jar file I built, the Random_seed_exposer inner class name has an initial lowercase "r", not upper.  This looks to me like this is a problem with the random module, not something specific to sqlalchemy ("from random import *" yields a similar stack dump)

Random_seed was renamed from random_seed just recently. It sounds like you somehow retained an old version of PyRandom and its exposed pieces. Try doing an ant clean, then a full rebuild, and you should be ok.

I'm going to need some help finding the problem here.  My current theories are:

1.  It looks like the convention for "exposer" class names may be all lower, did this one get an initial cap somehow erroneously?

Exposed methods will have a name of <type>_<method_name>. In most cases the type name is lowercase (like str, unicode), but in this case the Random type is title cased. Refer to the @ExposedType annotation on the java class for that name. PyRandom is exposed as _random.Random: only the part after the last '.' counts as the actual type name.

2.  The @ExposedMethod annotation for the Ramdom_seed(PyObject) method in PyRandom has a defaults = "null" parameter set.  I don't see this on other methods in the random module.  Could this be changing the exposer generation behavior (e.g. causing #1)?

The defaults argument here refers to the method's default arguments. That is, if you call seed() in Jython with no arguments, that will translate to Random_seed being called with seed=null.

Philip Jenvey

Christopher Z. Collier