On Tue, May 20, 2014 at 5:38 AM, Fabio C. Barrionuevo da Luz <
bna...@gmail.com> wrote:

> Hello Django core developers.
> Sorry if this is not the correct place to handle this.
>

Not really - this mailing list is for discussing the development of Django
itself, not for solving usage questions.


> I have a legacy database in PostgreSQL, which is still in production.
> I want to migrate it to Django.
> I tried to do the reverse engineering of the database to generate models
> classes
>
> I set my settings like this:
>
> DATABASES = {
>     # this read/write into "public" postgresql schema
>     'default': {
>         'ENGINE': 'django.db.backends.postgresql_psycopg2',
>         'NAME': 'neweposse',
>         'USER': 'neweposse_user',
>         'PASSWORD': 'neweposse_user',
>         'HOST': '127.0.0.1',
>         'PORT': '5432',
>     },
>     # legacy database
>     'eposse': {
>         'ENGINE': 'django.db.backends.postgresql_psycopg2',
>         'NAME': 'eposse',
>         'USER': 'eposse_user',
>         'PASSWORD': 'eposse_user',
>         'HOST': '127.0.0.1',
>         'PORT': '5432',
>     }
> }
>
>
> in terminal:
>
> (django1.7a5)sutransdev@sutransdev:~/webdocpy$ python manage.py inspectdb
> ...
> from __future__ import unicode_literals
>
> from django.db import models
>
> (django1.7a5)sutransdev@sutransdev:~/webdocpy$ python manage.py inspectdb
> --database=eposse
> ...
> from __future__ import unicode_literals
>
> from django.db import models
>
>
>
> inspectdb not identify the tables in the database and does not generate
> the model classes
>
>
> The question is?
>
> 1) Am I doing something wrong. Currently there any way he could get Django
> to recognize a schema different from the "public" database schema?
>
> 2) This is really a bug, and I need to create a ticket for this?
>

Well, there's *something* going wrong. inspectdb definitely works if you
point it at a PostgreSQL database. I can only assume that either:

 a) The "neweposse" and "eposse" databases are actually empty, and don't
actually contain schema, or

 b) An error is being raised when connecting to the database, which is
being silenced incorrectly

If (b) is happening, that would be a bug; you can check if this is the case
by running "manage.py dbshell"; if you can't connect a shell to the
database, inspectdb won't work either. If dbshell *does* work, then you can
run /dt to confirm that tables actually exist in the database.


> 3) or Django does not currently support different database schema, but
> this feature will be added when Marc Tamlyn add enhanced features to
> postgresql, as described here:
>
> https://www.kickstarter.com/projects/mjtamlyn/improved-postgresql-support-in-django?
>
>
AFAIK, nothing Marc is doing will change inspectdb functionality.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAJxq84-0-0-WOqjrOHz3mh1Z%3DU9yu1c_wrVqPJBD5mXrDWt%3DHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to