Flask-SQLAlchemy check if table exists in database
<p>Flask-SQLAlchemy check if table exists in database.
I see similar problems, but I try not to succeed.</p>

<p><a href="https://stackoverflow.com/questions/32938475/flask-sqlalchemy-check-if-row-exists-in-table">Flask-SQLAlchemy check if row exists in table</a></p>

<p>I have create a table object ,like this:</p>

<pre><code>&lt;class'flask_sqlalchemy.XXX'&gt;,
</code></pre>

<p>now how to check the object if exists in database.</p>

<p>I do many try:
eg:</p>

<pre><code>   for t in db.metadata.sorted_tables:
            print("tablename",t.name)
</code></pre>

<p>some table object is created before,but it doesnt exists in database,and now they. all print.
eg:print content is </p>

<pre><code>tablename： table_1
tablename： table_2
tablename： table_3
</code></pre>

<p>but only table_1 is exist datable，table_2 and table_3 is dynamica create，now I only want use the table_1.</p>

<p>very thanks.</p>