[Answered ]-How do i inspect all tables in databes mssql by Django inspect

1👍

I was looking at mssql\introspection.py.
There is Databaseintrospection.get_table_list(). Sql query in this method is

sql = 'SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ' + "'" + get_schema_name() + "'"

and i look at the get_schema_name() and…
that is

def get_schema_name():
    return getattr(settings, 'SCHEMA_TO_INSPECT', 'dbo')

Cause i just delete WHERE TABLE_SCHEMA" and get all my tables.
This looks like very strange. I can`t choose schema.

0👍

I haven’t this problem. Just write each table by comma separated

Leave a comment