How can I check 1 table from a database that contains 1000 tables

I have a schema that contains 1000 tables and I don’t need many of them, how can I just check the fair tables that I need?

+7
oracle django
source share
2 answers

You can do this in the python console or in the * .py file:

from django.core.management.commands.inspectdb import Command from django.conf import settings from your_project_dir.settings import DATABASES # replace `your_project_dir` settings.configure() settings.DATABASES = DATABASES Command().execute(table_name_filter=lambda table_name: table_name in ('table_what_you_need_1', 'table_what_you_need_2', ), database='default') 

https://github.com/django/django/blob/master/django/core/management/commands/inspectdb.py#L32

+6
source share

You can create a separate table model by running this command

python manage.py inspectdb TableName

This also works if you want to generate a view model.

+4
source share

All Articles