File: //usr/share/doc/python-sqlalchemy-0.9.8/doc/orm/extensions/instrumentation.html
<!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>
Alternate Class Instrumentation
—
SQLAlchemy 0.9 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/sphinx_paramlinks.css" type="text/css" />
<link rel="stylesheet" href="../../_static/changelog.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.9.8',
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.9 Documentation" href="../../index.html" />
<link rel="up" title="ORM Extensions" href="index.html" />
<link rel="next" title="ORM Examples" href="../examples.html" />
<link rel="prev" title="Hybrid Attributes" href="hybrid.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.9.8</span> | Release Date: October 13, 2014
</div>
<h1>SQLAlchemy 0.9 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.9 Documentation</a></h3>
<p id="sidebar-paginate">
<a href="index.html" title="ORM Extensions">Up</a> |
<a href="hybrid.html" title="Hybrid Attributes">Prev</a> |
<a href="../examples.html" title="ORM Examples">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="#">
Alternate Class Instrumentation
</a></h3>
<ul>
<li><a class="reference internal" href="#">Alternate Class Instrumentation</a><ul>
<li><a class="reference internal" href="#api-reference">API Reference</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="docs-body" class="withsidebar" >
<div class="section" id="module-sqlalchemy.ext.instrumentation">
<span id="alternate-class-instrumentation"></span><span id="instrumentation-toplevel"></span><h1>Alternate Class Instrumentation<a class="headerlink" href="#module-sqlalchemy.ext.instrumentation" title="Permalink to this headline">¶</a></h1>
<p>Extensible class instrumentation.</p>
<p>The <a class="reference internal" href="#module-sqlalchemy.ext.instrumentation" title="sqlalchemy.ext.instrumentation"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.ext.instrumentation</span></tt></a> package provides for alternate
systems of class instrumentation within the ORM. Class instrumentation
refers to how the ORM places attributes on the class which maintain
data and track changes to that data, as well as event hooks installed
on the class.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The extension package is provided for the benefit of integration
with other object management packages, which already perform
their own instrumentation. It is not intended for general use.</p>
</div>
<p>For examples of how the instrumentation extension is used,
see the example <a class="reference internal" href="../examples.html#examples-instrumentation"><em>Attribute Instrumentation</em></a>.</p>
<div class="versionchanged">
<p><span>Changed in version 0.8: </span>The <a class="reference internal" href="../events.html#module-sqlalchemy.orm.instrumentation" title="sqlalchemy.orm.instrumentation"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.orm.instrumentation</span></tt></a> was split out so
that all functionality having to do with non-standard
instrumentation was moved out to <a class="reference internal" href="#module-sqlalchemy.ext.instrumentation" title="sqlalchemy.ext.instrumentation"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.ext.instrumentation</span></tt></a>.
When imported, the module installs itself within
<a class="reference internal" href="../events.html#module-sqlalchemy.orm.instrumentation" title="sqlalchemy.orm.instrumentation"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.orm.instrumentation</span></tt></a> so that it
takes effect, including recognition of
<tt class="docutils literal"><span class="pre">__sa_instrumentation_manager__</span></tt> on mapped classes, as
well <a class="reference internal" href="#sqlalchemy.ext.instrumentation.instrumentation_finders" title="sqlalchemy.ext.instrumentation.instrumentation_finders"><tt class="xref py py-data docutils literal"><span class="pre">instrumentation_finders</span></tt></a>
being used to determine class instrumentation resolution.</p>
</div>
<div class="section" id="api-reference">
<h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h2>
<dl class="data">
<dt id="sqlalchemy.ext.instrumentation.INSTRUMENTATION_MANAGER">
<tt class="descclassname">sqlalchemy.ext.instrumentation.</tt><tt class="descname">INSTRUMENTATION_MANAGER</tt><em class="property"> = '__sa_instrumentation_manager__'</em><a class="headerlink" href="#sqlalchemy.ext.instrumentation.INSTRUMENTATION_MANAGER" title="Permalink to this definition">¶</a></dt>
<dd><p>Attribute, elects custom instrumentation when present on a mapped class.</p>
<p>Allows a class to specify a slightly or wildly different technique for
tracking changes made to mapped attributes and collections.</p>
<p>Only one instrumentation implementation is allowed in a given object
inheritance hierarchy.</p>
<p>The value of this attribute must be a callable and will be passed a class
object. The callable must return one of:</p>
<blockquote>
<div><ul class="simple">
<li>An instance of an InstrumentationManager or subclass</li>
<li>An object implementing all or some of InstrumentationManager (TODO)</li>
<li>A dictionary of callables, implementing all or some of the above (TODO)</li>
<li>An instance of a ClassManager or subclass</li>
</ul>
</div></blockquote>
<p>This attribute is consulted by SQLAlchemy instrumentation
resolution, once the <a class="reference internal" href="#module-sqlalchemy.ext.instrumentation" title="sqlalchemy.ext.instrumentation"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.ext.instrumentation</span></tt></a> module
has been imported. If custom finders are installed in the global
instrumentation_finders list, they may or may not choose to honor this
attribute.</p>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.orm.instrumentation.InstrumentationFactory">
<em class="property">class </em><tt class="descclassname">sqlalchemy.orm.instrumentation.</tt><tt class="descname">InstrumentationFactory</tt><a class="headerlink" href="#sqlalchemy.orm.instrumentation.InstrumentationFactory" title="Permalink to this definition">¶</a></dt>
<dd><p>Factory for new ClassManager instances.</p>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager">
<em class="property">class </em><tt class="descclassname">sqlalchemy.ext.instrumentation.</tt><tt class="descname">InstrumentationManager</tt><big>(</big><em>class_</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager" title="Permalink to this definition">¶</a></dt>
<dd><p>User-defined class instrumentation extension.</p>
<p><a class="reference internal" href="#sqlalchemy.ext.instrumentation.InstrumentationManager" title="sqlalchemy.ext.instrumentation.InstrumentationManager"><tt class="xref py py-class docutils literal"><span class="pre">InstrumentationManager</span></tt></a> can be subclassed in order
to change
how class instrumentation proceeds. This class exists for
the purposes of integration with other object management
frameworks which would like to entirely modify the
instrumentation methodology of the ORM, and is not intended
for regular usage. For interception of class instrumentation
events, see <a class="reference internal" href="../events.html#sqlalchemy.orm.events.InstrumentationEvents" title="sqlalchemy.orm.events.InstrumentationEvents"><tt class="xref py py-class docutils literal"><span class="pre">InstrumentationEvents</span></tt></a>.</p>
<p>The API for this class should be considered as semi-stable,
and may change slightly with new releases.</p>
<div class="versionchanged">
<p><span>Changed in version 0.8: </span><a class="reference internal" href="#sqlalchemy.ext.instrumentation.InstrumentationManager" title="sqlalchemy.ext.instrumentation.InstrumentationManager"><tt class="xref py py-class docutils literal"><span class="pre">InstrumentationManager</span></tt></a> was moved from
<a class="reference internal" href="../events.html#module-sqlalchemy.orm.instrumentation" title="sqlalchemy.orm.instrumentation"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.orm.instrumentation</span></tt></a> to
<a class="reference internal" href="#module-sqlalchemy.ext.instrumentation" title="sqlalchemy.ext.instrumentation"><tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.ext.instrumentation</span></tt></a>.</p>
</div>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.dict_getter">
<tt class="descname">dict_getter</tt><big>(</big><em>class_</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.dict_getter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.dispose">
<tt class="descname">dispose</tt><big>(</big><em>class_</em>, <em>manager</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.dispose" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.get_instance_dict">
<tt class="descname">get_instance_dict</tt><big>(</big><em>class_</em>, <em>instance</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.get_instance_dict" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.initialize_instance_dict">
<tt class="descname">initialize_instance_dict</tt><big>(</big><em>class_</em>, <em>instance</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.initialize_instance_dict" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.install_descriptor">
<tt class="descname">install_descriptor</tt><big>(</big><em>class_</em>, <em>key</em>, <em>inst</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.install_descriptor" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.install_member">
<tt class="descname">install_member</tt><big>(</big><em>class_</em>, <em>key</em>, <em>implementation</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.install_member" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.install_state">
<tt class="descname">install_state</tt><big>(</big><em>class_</em>, <em>instance</em>, <em>state</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.install_state" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.instrument_attribute">
<tt class="descname">instrument_attribute</tt><big>(</big><em>class_</em>, <em>key</em>, <em>inst</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.instrument_attribute" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.instrument_collection_class">
<tt class="descname">instrument_collection_class</tt><big>(</big><em>class_</em>, <em>key</em>, <em>collection_class</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.instrument_collection_class" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.manage">
<tt class="descname">manage</tt><big>(</big><em>class_</em>, <em>manager</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.manage" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.manager_getter">
<tt class="descname">manager_getter</tt><big>(</big><em>class_</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.manager_getter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.post_configure_attribute">
<tt class="descname">post_configure_attribute</tt><big>(</big><em>class_</em>, <em>key</em>, <em>inst</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.post_configure_attribute" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.remove_state">
<tt class="descname">remove_state</tt><big>(</big><em>class_</em>, <em>instance</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.remove_state" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.state_getter">
<tt class="descname">state_getter</tt><big>(</big><em>class_</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.state_getter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.uninstall_descriptor">
<tt class="descname">uninstall_descriptor</tt><big>(</big><em>class_</em>, <em>key</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.uninstall_descriptor" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.ext.instrumentation.InstrumentationManager.uninstall_member">
<tt class="descname">uninstall_member</tt><big>(</big><em>class_</em>, <em>key</em><big>)</big><a class="headerlink" href="#sqlalchemy.ext.instrumentation.InstrumentationManager.uninstall_member" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="data">
<dt id="sqlalchemy.ext.instrumentation.instrumentation_finders">
<tt class="descclassname">sqlalchemy.ext.instrumentation.</tt><tt class="descname">instrumentation_finders</tt><em class="property"> = [<function find_native_user_instrumentation_hook at 0x110187c08>]</em><a class="headerlink" href="#sqlalchemy.ext.instrumentation.instrumentation_finders" title="Permalink to this definition">¶</a></dt>
<dd><p>An extensible sequence of callables which return instrumentation
implementations</p>
<p>When a class is registered, each callable will be passed a class object.
If None is returned, the
next finder in the sequence is consulted. Otherwise the return must be an
instrumentation factory that follows the same guidelines as
sqlalchemy.ext.instrumentation.INSTRUMENTATION_MANAGER.</p>
<p>By default, the only finder is find_native_user_instrumentation_hook, which
searches for INSTRUMENTATION_MANAGER. If all finders return None, standard
ClassManager instrumentation is used.</p>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.ext.instrumentation.ExtendedInstrumentationRegistry">
<em class="property">class </em><tt class="descclassname">sqlalchemy.ext.instrumentation.</tt><tt class="descname">ExtendedInstrumentationRegistry</tt><a class="headerlink" href="#sqlalchemy.ext.instrumentation.ExtendedInstrumentationRegistry" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.orm.instrumentation.InstrumentationFactory" title="sqlalchemy.orm.instrumentation.InstrumentationFactory"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.orm.instrumentation.InstrumentationFactory</span></tt></a></p>
<p>Extends <a class="reference internal" href="#sqlalchemy.orm.instrumentation.InstrumentationFactory" title="sqlalchemy.orm.instrumentation.InstrumentationFactory"><tt class="xref py py-class docutils literal"><span class="pre">InstrumentationFactory</span></tt></a> with additional
bookkeeping, to accommodate multiple types of
class managers.</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div id="docs-bottom-navigation" class="docs-navigation-links">
Previous:
<a href="hybrid.html" title="previous chapter">Hybrid Attributes</a>
Next:
<a href="../examples.html" title="next chapter">ORM Examples</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>