<p dir="auto"><strong>Migrated issue, originally created by Tiemo Kieft (<a href="https://github.com/tkieft">@tkieft</a>)</strong></p>
<p dir="auto">I have a schema that defines some Enum's, running create_all() works fine on Postgres, but on SQLite it locks up.</p>
<p dir="auto">The code below demonstrates the problem:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from sqlalchemy import create_engine, Enum
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
e = Enum('foo', 'bar', metadata=Base.metadata)

engine = create_engine('sqlite:///:memory:', echo=True)
Base.metadata.create_all(bind=engine)"><pre class="notranslate"><code class="notranslate">from sqlalchemy import create_engine, Enum
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
e = Enum('foo', 'bar', metadata=Base.metadata)

engine = create_engine('sqlite:///:memory:', echo=True)
Base.metadata.create_all(bind=engine)
</code></pre></div>
<p dir="auto">Remove the explicit <code class="notranslate">metadata</code> kwarg from the Enum constructor solves the problem. I tried running the above code with echo=True, but it doesn't report anything.</p>
<p dir="auto"><strong>Migrated issue, originally created by eevee (<a href="https://github.com/eevee">@eevee</a>)</strong></p>
<p dir="auto">Reported here, but seen someone else experience it too: <a href="http://stackoverflow.com/q/24720380/17875" rel="nofollow">http://stackoverflow.com/q/24720380/17875</a></p>
<p dir="auto">My diagnosis from figuring it out with the someone else on IRC:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="18:43 &lt;!eevee&gt; somehow calling self._on_metadata_create within the metadata's create event is adding itself as an event listener again
18:44 &lt;!eevee&gt; because, i think, it re-creates a dialect-specific enum with the same args...
18:44 &lt;!eevee&gt; looks pretty clearly like a bug wow
18:44 &lt;@Zhorken&gt; it specifically hangs with SQLite
18:44 &lt;@Zhorken&gt; or at least, not with Postgres
18:45 &lt;!eevee&gt; ah, postgres has a real enum type; sqlite doesn't so it gets a fallback"><pre class="notranslate"><code class="notranslate">18:43 &lt;!eevee&gt; somehow calling self._on_metadata_create within the metadata's create event is adding itself as an event listener again
18:44 &lt;!eevee&gt; because, i think, it re-creates a dialect-specific enum with the same args...
18:44 &lt;!eevee&gt; looks pretty clearly like a bug wow
18:44 &lt;@Zhorken&gt; it specifically hangs with SQLite
18:44 &lt;@Zhorken&gt; or at least, not with Postgres
18:45 &lt;!eevee&gt; ah, postgres has a real enum type; sqlite doesn't so it gets a fallback
</code></pre></div>