Re: couple bugs with schema

Jacob Smullyan <[email protected]> Fri, 13 Jan 2006 10:11:26 -0500
Newsgroups gmane.comp.web.skunkweb
Message-ID <[email protected]>
On Thu, Jan 12, 2006 at 05:47:35PM -0700, Jonathan Ellis wrote:
> autoschema(schema='xxy') returns classes found in schema xxy, but if
> there is a table with the same name defined in the public schema for
> any of those classes, name, it will return the definition from the
> table in public.

Actually, that isn't exactly what is happening, although that can be a
symptom.  The problem is the "guesscache", which stores the table
structure for classes in disk files keyed by package/classname and
which is used by default.  Unless you pass in a different module to
use, the classes think they live in pydo.base (they don't, but they
don't know any better) and the guess cache entry for
pydo.base.Whatever_table will be used regardless of schema (because
the schema isn't part of the class name).  So, whichever schema is
autoschema-ed first would generate the first cache entry and
subsequent calls for the same class name in the same module would use
it.

First, how to workaround with the current version.  If you don't want
to use the guesscache at all, simply pass "False" for the guesscache
parameter to autoschema.  Or use a different guesscache for each
schema, with the cache stored under a different path.  Or use the
module parameter and use a different module for each schema.

Second, how to fix.  The way in which the guesscache generates paths
for objects it stores should be modified so that it is schema-aware.
I'll do this.  I also wonder whether the guesscache should be used by
default anyway, for autoschema and for column-guessing.

Cheers,

js

-- 
Jacob Smullyan
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDx8MeuqamFyFXXLIRAn10AKDPNJYzXBFu9B+w9pO+VddwlMoVUgCgwmxr
f1KZ4m+y3do9FAOlmws2tBA=
=kLm5
-----END PGP SIGNATURE-----