<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> ORM Exceptions — SQLAlchemy 0.8 Documentation </title> <!-- begin iterate through SQLA + sphinx environment css_files --> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../_static/docs.css" type="text/css" /> <link rel="stylesheet" href="../_static/changelog.css" type="text/css" /> <link rel="stylesheet" href="../_static/sphinx_paramlinks.css" type="text/css" /> <!-- end iterate through SQLA + sphinx environment css_files --> <!-- begin layout.mako headers --> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '0.8.7', COLLAPSE_MODINDEX: false, FILE_SUFFIX: '.html' }; </script> <!-- begin iterate through sphinx environment script_files --> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <!-- end iterate through sphinx environment script_files --> <script type="text/javascript" src="../_static/detectmobile.js"></script> <script type="text/javascript" src="../_static/init.js"></script> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="copyright" title="Copyright" href="../copyright.html" /> <link rel="top" title="SQLAlchemy 0.8 Documentation" href="../index.html" /> <link rel="up" title="SQLAlchemy ORM" href="index.html" /> <link rel="next" title="ORM Internals" href="internals.html" /> <link rel="prev" title="Examples" href="examples.html" /> <!-- end layout.mako headers --> </head> <body> <div id="docs-container"> <div id="docs-top-navigation-container" class="body-background"> <div id="docs-header"> <div id="docs-version-header"> Release: <span class="version-num">0.8.7</span> | Release Date: July 22, 2014 </div> <h1>SQLAlchemy 0.8 Documentation</h1> </div> </div> <div id="docs-body-container"> <div id="fixed-sidebar" class="withsidebar"> <div id="docs-sidebar-popout"> <h3><a href="../index.html">SQLAlchemy 0.8 Documentation</a></h3> <p id="sidebar-paginate"> <a href="index.html" title="SQLAlchemy ORM">Up</a> | <a href="examples.html" title="Examples">Prev</a> | <a href="internals.html" title="ORM Internals">Next</a> </p> <p id="sidebar-topnav"> <a href="../index.html">Contents</a> | <a href="../genindex.html">Index</a> </p> <div id="sidebar-search"> <form class="search" action="../search.html" method="get"> <input type="text" name="q" size="12" /> <input type="submit" value="Search" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div id="docs-sidebar"> <h3><a href="#"> ORM Exceptions </a></h3> <ul> <li><a class="reference internal" href="#">ORM Exceptions</a></li> </ul> </div> </div> <div id="docs-body" class="withsidebar" > <div class="section" id="module-sqlalchemy.orm.exc"> <span id="orm-exceptions"></span><h1>ORM Exceptions<a class="headerlink" href="#module-sqlalchemy.orm.exc" title="Permalink to this headline">¶</a></h1> <p>SQLAlchemy ORM exceptions.</p> <dl class="attribute"> <dt id="sqlalchemy.orm.exc.ConcurrentModificationError"> <tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">ConcurrentModificationError</tt><a class="headerlink" href="#sqlalchemy.orm.exc.ConcurrentModificationError" title="Permalink to this definition">¶</a></dt> <dd><p>alias of <a class="reference internal" href="#sqlalchemy.orm.exc.StaleDataError" title="sqlalchemy.orm.exc.StaleDataError"><tt class="xref py py-class docutils literal"><span class="pre">StaleDataError</span></tt></a></p> </dd></dl> <dl class="exception"> <dt id="sqlalchemy.orm.exc.DetachedInstanceError"> <em class="property">exception </em><tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">DetachedInstanceError</tt><a class="headerlink" href="#sqlalchemy.orm.exc.DetachedInstanceError" title="Permalink to this definition">¶</a></dt> <dd><p>An attempt to access unloaded attributes on a mapped instance that is detached.</p> </dd></dl> <dl class="exception"> <dt id="sqlalchemy.orm.exc.FlushError"> <em class="property">exception </em><tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">FlushError</tt><a class="headerlink" href="#sqlalchemy.orm.exc.FlushError" title="Permalink to this definition">¶</a></dt> <dd><p>A invalid condition was detected during flush().</p> </dd></dl> <dl class="exception"> <dt id="sqlalchemy.orm.exc.MultipleResultsFound"> <em class="property">exception </em><tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">MultipleResultsFound</tt><a class="headerlink" href="#sqlalchemy.orm.exc.MultipleResultsFound" title="Permalink to this definition">¶</a></dt> <dd><p>A single database result was required but more than one were found.</p> </dd></dl> <dl class="data"> <dt id="sqlalchemy.orm.exc.NO_STATE"> <tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">NO_STATE</tt><em class="property"> = (<type 'exceptions.AttributeError'>, <type 'exceptions.KeyError'>)</em><a class="headerlink" href="#sqlalchemy.orm.exc.NO_STATE" title="Permalink to this definition">¶</a></dt> <dd><p>Exception types that may be raised by instrumentation implementations.</p> </dd></dl> <dl class="exception"> <dt id="sqlalchemy.orm.exc.NoResultFound"> <em class="property">exception </em><tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">NoResultFound</tt><a class="headerlink" href="#sqlalchemy.orm.exc.NoResultFound" title="Permalink to this definition">¶</a></dt> <dd><p>A database result was required but none was found.</p> </dd></dl> <dl class="exception"> <dt id="sqlalchemy.orm.exc.ObjectDeletedError"> <em class="property">exception </em><tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">ObjectDeletedError</tt><big>(</big><em>state</em>, <em>msg=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.orm.exc.ObjectDeletedError" title="Permalink to this definition">¶</a></dt> <dd><p>A refresh operation failed to retrieve the database row corresponding to an object’s known primary key identity.</p> <p>A refresh operation proceeds when an expired attribute is accessed on an object, or when <a class="reference internal" href="query.html#sqlalchemy.orm.query.Query.get" title="sqlalchemy.orm.query.Query.get"><tt class="xref py py-meth docutils literal"><span class="pre">Query.get()</span></tt></a> is used to retrieve an object which is, upon retrieval, detected as expired. A SELECT is emitted for the target row based on primary key; if no row is returned, this exception is raised.</p> <p>The true meaning of this exception is simply that no row exists for the primary key identifier associated with a persistent object. The row may have been deleted, or in some cases the primary key updated to a new value, outside of the ORM’s management of the target object.</p> </dd></dl> <dl class="exception"> <dt id="sqlalchemy.orm.exc.ObjectDereferencedError"> <em class="property">exception </em><tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">ObjectDereferencedError</tt><a class="headerlink" href="#sqlalchemy.orm.exc.ObjectDereferencedError" title="Permalink to this definition">¶</a></dt> <dd><p>An operation cannot complete due to an object being garbage collected.</p> </dd></dl> <dl class="exception"> <dt id="sqlalchemy.orm.exc.StaleDataError"> <em class="property">exception </em><tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">StaleDataError</tt><a class="headerlink" href="#sqlalchemy.orm.exc.StaleDataError" title="Permalink to this definition">¶</a></dt> <dd><p>An operation encountered database state that is unaccounted for.</p> <p>Conditions which cause this to happen include:</p> <ul> <li><p class="first">A flush may have attempted to update or delete rows and an unexpected number of rows were matched during the UPDATE or DELETE statement. Note that when version_id_col is used, rows in UPDATE or DELETE statements are also matched against the current known version identifier.</p> </li> <li><p class="first">A mapped object with version_id_col was refreshed, and the version number coming back from the database does not match that of the object itself.</p> </li> <li><p class="first">A object is detached from its parent object, however the object was previously attached to a different parent identity which was garbage collected, and a decision cannot be made if the new parent was really the most recent “parent”.</p> <div class="versionadded"> <p><span>New in version 0.7.4.</span></p> </div> </li> </ul> </dd></dl> <dl class="exception"> <dt id="sqlalchemy.orm.exc.UnmappedClassError"> <em class="property">exception </em><tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">UnmappedClassError</tt><big>(</big><em>cls</em>, <em>msg=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.orm.exc.UnmappedClassError" title="Permalink to this definition">¶</a></dt> <dd><p>An mapping operation was requested for an unknown class.</p> </dd></dl> <dl class="exception"> <dt id="sqlalchemy.orm.exc.UnmappedColumnError"> <em class="property">exception </em><tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">UnmappedColumnError</tt><a class="headerlink" href="#sqlalchemy.orm.exc.UnmappedColumnError" title="Permalink to this definition">¶</a></dt> <dd><p>Mapping operation was requested on an unknown column.</p> </dd></dl> <dl class="exception"> <dt id="sqlalchemy.orm.exc.UnmappedError"> <em class="property">exception </em><tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">UnmappedError</tt><a class="headerlink" href="#sqlalchemy.orm.exc.UnmappedError" title="Permalink to this definition">¶</a></dt> <dd><p>Base for exceptions that involve expected mappings not present.</p> </dd></dl> <dl class="exception"> <dt id="sqlalchemy.orm.exc.UnmappedInstanceError"> <em class="property">exception </em><tt class="descclassname">sqlalchemy.orm.exc.</tt><tt class="descname">UnmappedInstanceError</tt><big>(</big><em>obj</em>, <em>msg=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.orm.exc.UnmappedInstanceError" title="Permalink to this definition">¶</a></dt> <dd><p>An mapping operation was requested for an unknown instance.</p> </dd></dl> </div> </div> </div> <div id="docs-bottom-navigation" class="docs-navigation-links"> Previous: <a href="examples.html" title="previous chapter">Examples</a> Next: <a href="internals.html" title="next chapter">ORM Internals</a> <div id="docs-copyright"> © <a href="../copyright.html">Copyright</a> 2007-2014, the SQLAlchemy authors and contributors. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2b1. </div> </div> </div> </body> </html>