Connecting to Legacy Oracle Tables

15 views
Skip to first unread message

Christina

unread,
May 22, 2009, 12:59:16 PM5/22/09
to Django users
Hi all,

I'm trying to set up a new Django app that will have several models
based on existing Oracle tables. I'm running Django 1.0.2, python
2.5.1 and cxOracle 5.0.1.

These tables are in a different schema than the one Django connects
with, so based on previous discussion here I created views of the
tables in my schema. I've set db_table to the name of the view in
models.py. When I run syncdb I receive the error:
"cx_Oracle.DatabaseError: ORA-00955: name is already used by an
existing object." So it appears to be creating a new table instead of
recognizing the existing view. Any ideas on what I can do to get it
to recognize that the view exists and use that for the backend for my
model?


Best,
Christina

Ian Kelly

unread,
May 22, 2009, 3:25:24 PM5/22/09
to Django users
Hi Christina,

Syncdb doesn't currently recognize views or synonyms correctly. If
you have apps with models that need to be created, run manage.py
sqlall on those apps, and pass the resulting sql into sqlplus or
manage.py dbshell. You can also edit the generated sql by hand before
running it, if you need finer-grain control.

Hope that helps,
Ian

Jani Tiainen

unread,
May 24, 2009, 2:41:51 AM5/24/09
to django...@googlegroups.com
Ian Kelly kirjoitti:

In development version there is also very handy "managed" meta option
that works very well with legacy apps when set to 'false'.

--
Jani Tiainen

Reply all
Reply to author
Forward
0 new messages