<h1 dir="auto">Describe the bug</h1>
<p dir="auto">With the new version <code class="notranslate">1.4.0</code> the call <code class="notranslate">engine.dialect.has_table</code> fails for sqlite. This didn't happen in the previous version <code class="notranslate">1.3.23</code>.</p>
<p dir="auto"><strong>Note</strong><br>
Starting with version <code class="notranslate">1.4.0</code> it's recommended to use</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="sqlalchemy.inspect(engine).has_table(table_name)"><pre class="notranslate"><span class="pl-s1">sqlalchemy</span>.<span class="pl-en">inspect</span>(<span class="pl-s1">engine</span>).<span class="pl-en">has_table</span>(<span class="pl-s1">table_name</span>)</pre></div>
<p dir="auto">this works OK.</p>
<p dir="auto">This call</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="engine.has_table(table_name)"><pre class="notranslate"><span class="pl-s1">engine</span>.<span class="pl-en">has_table</span>(<span class="pl-s1">table_name</span>)</pre></div>
<p dir="auto">also works fine.</p>
<h1 dir="auto">Expected behavior</h1>
<p dir="auto">This should not fail.</p>
<h1 dir="auto">To Reproduce</h1>
<p dir="auto">Here's a self-contained example:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# check_table.py
import os
import sqlite3

import sqlalchemy


table_name = &quot;test_table&quot;
db_name = &quot;example.db&quot;

# Create a temporary SQLite database
if os.path.exists(db_name):
    os.remove(db_name)
con = sqlite3.connect(&quot;example.db&quot;)
cur = con.cursor()
cur.execute(f&quot;CREATE TABLE {table_name} (name TEXT)&quot;)
con.commit()
con.close()

# Create an engine and check if the table exists
engine = sqlalchemy.create_engine(f&quot;sqlite:///{db_name}&quot;)
print(f&quot;Does the table {table_name} exist:&quot;, engine.dialect.has_table(engine, table_name))

# Remove the temporary SQLite database
os.remove(db_name)"><pre class="notranslate"><span class="pl-c"># check_table.py</span>
<span class="pl-k">import</span> <span class="pl-s1">os</span>
<span class="pl-k">import</span> <span class="pl-s1">sqlite3</span>

<span class="pl-k">import</span> <span class="pl-s1">sqlalchemy</span>


<span class="pl-s1">table_name</span> <span class="pl-c1">=</span> <span class="pl-s">"test_table"</span>
<span class="pl-s1">db_name</span> <span class="pl-c1">=</span> <span class="pl-s">"example.db"</span>

<span class="pl-c"># Create a temporary SQLite database</span>
<span class="pl-k">if</span> <span class="pl-s1">os</span>.<span class="pl-s1">path</span>.<span class="pl-en">exists</span>(<span class="pl-s1">db_name</span>):
    <span class="pl-s1">os</span>.<span class="pl-en">remove</span>(<span class="pl-s1">db_name</span>)
<span class="pl-s1">con</span> <span class="pl-c1">=</span> <span class="pl-s1">sqlite3</span>.<span class="pl-en">connect</span>(<span class="pl-s">"example.db"</span>)
<span class="pl-s1">cur</span> <span class="pl-c1">=</span> <span class="pl-s1">con</span>.<span class="pl-en">cursor</span>()
<span class="pl-s1">cur</span>.<span class="pl-en">execute</span>(<span class="pl-s">f"CREATE TABLE <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">table_name</span><span class="pl-kos">}</span></span> (name TEXT)"</span>)
<span class="pl-s1">con</span>.<span class="pl-en">commit</span>()
<span class="pl-s1">con</span>.<span class="pl-en">close</span>()

<span class="pl-c"># Create an engine and check if the table exists</span>
<span class="pl-s1">engine</span> <span class="pl-c1">=</span> <span class="pl-s1">sqlalchemy</span>.<span class="pl-en">create_engine</span>(<span class="pl-s">f"sqlite:///<span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">db_name</span><span class="pl-kos">}</span></span>"</span>)
<span class="pl-en">print</span>(<span class="pl-s">f"Does the table <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">table_name</span><span class="pl-kos">}</span></span> exist:"</span>, <span class="pl-s1">engine</span>.<span class="pl-s1">dialect</span>.<span class="pl-en">has_table</span>(<span class="pl-s1">engine</span>, <span class="pl-s1">table_name</span>))

<span class="pl-c"># Remove the temporary SQLite database</span>
<span class="pl-s1">os</span>.<span class="pl-en">remove</span>(<span class="pl-s1">db_name</span>)</pre></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pip install sqlalchemy==1.4.0
python check_table.py"><pre class="notranslate">pip install sqlalchemy==1.4.0
python check_table.py</pre></div>
<p dir="auto"><strong>Error</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;check_table.py&quot;, line 21, in &lt;module&gt;
    print(f&quot;Does the table {table_name} exist:&quot;, engine.dialect.has_table(engine, table_name))
  File &quot;/Users/me/venv/lib/python3.8/site-packages/sqlalchemy/dialects/sqlite/base.py&quot;, line 1998, in has_table
    info = self._get_table_pragma(
  File &quot;/Users/me/venv/lib/python3.8/site-packages/sqlalchemy/dialects/sqlite/base.py&quot;, line 2520, in _get_table_pragma
    cursor = connection.exec_driver_sql(statement)
AttributeError: 'Engine' object has no attribute 'exec_driver_sql'"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "check_table.py", line 21, in &lt;module&gt;
    print(f"Does the table {table_name} exist:", engine.dialect.has_table(engine, table_name))
  File "/Users/me/venv/lib/python3.8/site-packages/sqlalchemy/dialects/sqlite/base.py", line 1998, in has_table
    info = self._get_table_pragma(
  File "/Users/me/venv/lib/python3.8/site-packages/sqlalchemy/dialects/sqlite/base.py", line 2520, in _get_table_pragma
    cursor = connection.exec_driver_sql(statement)
AttributeError: 'Engine' object has no attribute 'exec_driver_sql'
</code></pre></div>
<h1 dir="auto">Versions</h1>
<ul dir="auto">
<li>OS: macOS Catalina 10.15.7</li>
<li>Python: <code class="notranslate">3.8.6</code></li>
<li>SQLAlchemy: <code class="notranslate">1.4.0</code></li>
<li>Database: SQLite</li>
<li>DBAPI: <code class="notranslate">sqlite</code></li>
</ul>
<p dir="auto"><strong>Describe the bug</strong><br>
This code</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import sqlalchemy

print(sqlalchemy.__version__)
engine = sqlalchemy.create_engine('sqlite://')
# this works on 1.3.20
engine.dialect.has_table(engine, 'mytable')"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">sqlalchemy</span>

<span class="pl-en">print</span>(<span class="pl-s1">sqlalchemy</span>.<span class="pl-s1">__version__</span>)
<span class="pl-s1">engine</span> <span class="pl-c1">=</span> <span class="pl-s1">sqlalchemy</span>.<span class="pl-en">create_engine</span>(<span class="pl-s">'sqlite://'</span>)
<span class="pl-c"># this works on 1.3.20</span>
<span class="pl-s1">engine</span>.<span class="pl-s1">dialect</span>.<span class="pl-en">has_table</span>(<span class="pl-s1">engine</span>, <span class="pl-s">'mytable'</span>)</pre></div>
<p dir="auto">Raises the following exception:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% python bug.py
1.4.0b1
Traceback (most recent call last):
  File &quot;bug.py&quot;, line 6, in &lt;module&gt;
    engine.dialect.has_table(engine, 'mytable')
  File &quot;/Users/gbrown/.virtualenvs/foo/lib/python3.8/site-packages/sqlalchemy/dialects/sqlite/base.py&quot;, line 1650, in has_table
    info = self._get_table_pragma(
  File &quot;/Users/gbrown/.virtualenvs/foo/lib/python3.8/site-packages/sqlalchemy/dialects/sqlite/base.py&quot;, line 2172, in _get_table_pragma
    cursor = connection.exec_driver_sql(statement)
AttributeError: 'Engine' object has no attribute 'exec_driver_sql'"><pre class="notranslate"><code class="notranslate">% python bug.py
1.4.0b1
Traceback (most recent call last):
  File "bug.py", line 6, in &lt;module&gt;
    engine.dialect.has_table(engine, 'mytable')
  File "/Users/gbrown/.virtualenvs/foo/lib/python3.8/site-packages/sqlalchemy/dialects/sqlite/base.py", line 1650, in has_table
    info = self._get_table_pragma(
  File "/Users/gbrown/.virtualenvs/foo/lib/python3.8/site-packages/sqlalchemy/dialects/sqlite/base.py", line 2172, in _get_table_pragma
    cursor = connection.exec_driver_sql(statement)
AttributeError: 'Engine' object has no attribute 'exec_driver_sql'
</code></pre></div>
<p dir="auto"><strong>Expected behavior</strong><br>
I expected it to return <code class="notranslate">False</code> with no traceback as it used to under 1.3.20.</p>
<p dir="auto"><strong>To Reproduce</strong><br>
See bug description above.</p>
<p dir="auto"><strong>Versions.</strong></p>
<ul dir="auto">
<li>OS: macOS Catalina</li>
<li>Python: 3.8.6</li>
<li>SQLAlchemy: 1.4.0b1</li>
<li>Database: SQLite</li>
<li>DBAPI:</li>
</ul>
<p dir="auto"><strong>Additional context</strong><br>
Maybe I should have been using <code class="notranslate">engine.has_table('mytable')</code> and I see that is being deprecated.  I know how to fix my code to avoid this.  I just registering as an FYI.  Thanks.</p>
<p dir="auto"><strong>Have a nice day!</strong><br>
You too.  Cheers.</p>