2 def db_table_exists(table
, cursor
=None):
4 Determine if a table exists in the database
7 https://gist.github.com/527113/307c2dec09ceeb647b8fa1d6d49591f3352cb034
12 from django
.db
import connection
13 cursor
= connection
.cursor()
16 table_names
= connection
.introspection
.get_table_list(cursor
)
18 raise Exception("unable to determine if the table '%s' exists" % table
)
20 return table
in table_names