Skip to content

Why is only the default schema inspected when running inspectdb #104

@lukasburg

Description

@lukasburg

Disclaimer: this might be a really stupid question, I actually know very little about schemas and mssql.

I am running python manage.py inspectdb on a mssql database that contains multiple schemas.
These are a way of separating topics inside the db (I think?).
E.g. there might be a schema called users that contains the tables users.User, users.Post, users.Friendships and a second schema called games that contains other tables.

When I run inspectdb the output is empty because there are no tables in the main scheme dbo.

I changed

sql = 'SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = SCHEMA_NAME()'
to

sql = "SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES;"

and now all tables are created. Only the schemes names are not displayed correctly in db_table. It says 'User' instead of 'users.User', but that's fixed fast.

So my question: Why did you choose to only inspect tables in dbo? Did I miss something in the settings? Is creating multiple schemes something very unusual?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions