Question: I want to run [inspectdb](https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-inspectdb) against an Oracle database. The user account that I use is a read only user that owns 0 tables. It, however, has access to the schema that contains all the tables. How do I specify a schema when using `inspectdb`?

My command, currently, is: `python manage.py inspectdb --database "oradb" > test_model.py`

This only outputs a file with `from django.db import models`.

Answer: 
Just if someone comes upon this thread: Andy's suggestions + I've also changed the get\_relations method to get foreign keys in the generated source, works in 1.9.1:

```
    def get_relations(self, cursor, table_name):
    """
    Returns a dictionary of {field_name: (field_name_other_table, other_table)}
    representing all relationships to the given table.
    """
    table_name = table_name.upper()

    cursor.execute("""
        SELECT a.column_name, c_pk.table_name r_table_name, c_pk.constraint_name r_pk
          FROM all_cons_columns a
          JOIN all_constraints c ON a.owner = c.owner
                                AND a.constraint_name = c.constraint_name
          JOIN all_constraints c_pk ON c.r_owner = c_pk.owner
                                   AND c.r_constraint_name = c_pk.constraint_name
         WHERE c.constraint_type = 'R'
           AND a.table_name = %s""", [table_name])

    relations = {}
    for row in cursor.fetchall():
        relations[row[0].lower()] = (row[2].lower(), row[1].lower())
    return relations

```
Try to specify the search\_path, by adding an option in your DATABASES variable at settings.py, like that:

```
'OPTIONS': {
       'options': '-c search_path=myschema'
}

```

The full DATABASES variable should be:

```
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'mydatabase',
        'USER': 'postgres',
        'PASSWORD': 'mypassword',
        'HOST': 'localhost',
        'PORT': '5432',
        'OPTIONS': {
            'options': '-c search_path=myschema'
        }
    }
}

```

After that `python migrate inspectdb` should work on your schema