Hi,

I've hit a problem very recently with autoloading of table info from
an oracle schema which I believe is caused by a problem inside the
_resolve_synonym method of oracle/base.py. I've googled around a bit
but didn't find this issue reported previously. It may well be a
problem with our db setup but I'm hoping folks on this list will be
able to shed some light on it either way :)

What's happening is that in the db there are two rows returned when
running the query

select OWNER, TABLE_OWNER, TABLE_NAME, SYNONYM_NAME from ALL_SYNONYMS
WHERE table_name = 'REQUESTS';

Result:

AINV_REPORT     AINV_OWNER      REQUESTS        REQUESTS
AINV_USER       AINV_OWNER      REQUESTS        REQUESTS

Inside _resolve_synonym this query is run and if len(rows) >1 the
following error is raised:

"There are multiple tables visible to the schema, you must specify
owner"

I tried specifying the owner (AINV_USER) by using the schema parameter
of Tables() but that in turn causes errors because parent/child
relations cannot be automatically determined (which they can just fine
if the script runs from the table owner's schema). The error is:
"Could not determine join condition between parent/child tables on
relation..." It looks like synonyms don't make the foreign key
constraints visible, just the table names themselves (but that's just
a guess).

Since I rely heavily on autoload, I'd have to specify a lot of
primaryjoins for the relations if I used the schema parameter.

I was thinking that perhaps the query used inside _resolve_synonyms
could/should include a check on the synonym owner to exclude multiple
matches of the same table exists as a synonym in another user's
schema. Or would that break other things?

In the meantime I'm trying to get rid of the extra synonyms but I'm
not sure if that can always be avoided nor if that's too fragile
overall. In the end that would mean that by creating extra synonyms
for another user a working script could break. Or am I missing
something here?

Any insight greatly appreciated! :)

Cheers,
Sven

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to