All,
So have a 'working' solution but think it is pretty bad... Someone
MUST have a better solution. Here is what I had to do:
1. Have create_all explictly not test for tables existing (or else it
finds it in wrong schema)
create_all(checkfirst = False)
2. Explictly set the schema and owner
options_defaults['table_options'] = {'schema':'cram','owner':'cram'}
3. Modify every Foreign_Key reference and prefix the schema name
created_by = Field(Integer, ForeignKey('cram.app_user.control_number',
name = 'property_profile_created_by_fk', use_alter = False), nullable
= True, index = True) #Link field for link CreatedBy
4. Turn off use_alter in each Foreign Key ref (see above)
5. *** Modify schema.py default Index creation to truncate at 30
chars uniquely
global _i_count
_i_count+=1
Index('ix_%s%d' % (self._label[:22],_i_count), self,
unique=self.unique)
5b. The above will go away in next pass when I set index=False and
manually add the Indexes
Anyone else have a cleaner incantation?
Thanks,
Brandon
On May 23, 3:10 pm, Brandon Goldfedder <[EMAIL PROTECTED]> wrote:
> All,
> Perhaps someone can help me here since I am in that 'bad place' where
> I am retrying things again and getting deeper than I want into it.
>
> I am trying to create a database (using elixir model although the
> problem appears to be in sqlalchemy so asking here) in Oracle
> Express.
>
> The problem I think is that the table names I am using exist in other
> schemas.
>
> Before I set schema and owner I was getting the ORA-00942 error which
> I think was that it was finding the table names in other schemas and
> attempting to use them in the foreign key reference.
>
> Now, I am passing both schema and owner explictly for the table
> (using_table_options(schema='cram',owner='cram')) and I now get:
>
> File "C:\PYTHON25\lib\site-packages\sqlalchemy-0.4.6-py2.5.egg
> \sqlalchemy\sche
> ma.py", line 788, in column
> "foreign key" % tname)
> sqlalchemy.exceptions.NoReferencedTableError: Could not find table
> 'property_ite
> m' with which to generate a foreign key
>
> Debating if I abandon using sqlalchemy to generate the creation DDL
> and just use it for mapping or if there is a better solution anyone
> has.
>
> Any help/Best Practices/Incantations in getting Oracle to work right
> appreciated,
>
> Thanks,
> Brandon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---