Displaying names of the DB tables that contain specific data
I was able to get the names of the tables of DB with specific data in Python like this:
r = list(conn.cursor().execute('''select m.name
from sqlite_master m
where m.type = 'table'
and exists (select 1 from pragma_table_info(m.name) m1
where m1.name = 'customer_id')'''))
print('Names of the tables that contain customer data:\n','\n'.join(map(str, r)))
The output is: "actor" and "film actor"
Is there any way to get the same output in Django website? I just can't think of any way to do that. DB that I'm using is Sakila. I've generated model objects for every table already.