<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>
<p dir="auto"><strong>Migrated issue, originally created by Anonymous</strong></p>
<p dir="auto">Objects whith bool(obj) == False are dropped from session after commit. There is nothing about it in documentation, and no warnings or exceptions raised. There is test code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from sqlalchemy import *
from sqlalchemy.orm import *

import pickle

engine = create_engine('sqlite://')

metadata = MetaData()

obj = Table('obj', metadata,
    Column('id', Integer, primary_key=True),
    Column('data', Unicode(32)),
)

class Obj(object):
    def __nonzero__(self):
        return False

mapper(Obj, obj)

metadata.create_all(bind=engine)

session = create_session(bind=engine)

o = Obj()

o.data = 'test'

session.begin()
session.save(o)
session.commit()

assert o in session"><pre class="notranslate"><code class="notranslate">from sqlalchemy import *
from sqlalchemy.orm import *

import pickle

engine = create_engine('sqlite://')

metadata = MetaData()

obj = Table('obj', metadata,
    Column('id', Integer, primary_key=True),
    Column('data', Unicode(32)),
)

class Obj(object):
    def __nonzero__(self):
        return False

mapper(Obj, obj)

metadata.create_all(bind=engine)

session = create_session(bind=engine)

o = Obj()

o.data = 'test'

session.begin()
session.save(o)
session.commit()

assert o in session
</code></pre></div>