File: //usr/share/doc/python-sqlalchemy-0.9.8/doc/core/functions.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>
SQL and Generic Functions
—
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="SQL Statements and Expressions API" href="expression_api.html" />
<link rel="next" title="Column and Data Types" href="types.html" />
<link rel="prev" title="Insert, Updates, Deletes" href="dml.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="expression_api.html" title="SQL Statements and Expressions API">Up</a> |
<a href="dml.html" title="Insert, Updates, Deletes">Prev</a> |
<a href="types.html" title="Column and Data Types">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="#">
SQL and Generic Functions
</a></h3>
<ul>
<li><a class="reference internal" href="#">SQL and Generic Functions</a></li>
</ul>
</div>
</div>
<div id="docs-body" class="withsidebar" >
<div class="section" id="module-sqlalchemy.sql.expression">
<span id="sql-and-generic-functions"></span><span id="generic-functions"></span><span id="functions-toplevel"></span><h1>SQL and Generic Functions<a class="headerlink" href="#module-sqlalchemy.sql.expression" title="Permalink to this headline">¶</a></h1>
<p>SQL functions which are known to SQLAlchemy with regards to database-specific
rendering, return types and argument behavior. Generic functions are invoked
like all SQL functions, using the <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-attr docutils literal"><span class="pre">func</span></tt></a> attribute:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">select</span><span class="p">([</span><span class="n">func</span><span class="o">.</span><span class="n">count</span><span class="p">()])</span><span class="o">.</span><span class="n">select_from</span><span class="p">(</span><span class="n">sometable</span><span class="p">)</span></pre></div>
</div>
<p>Note that any name not known to <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-attr docutils literal"><span class="pre">func</span></tt></a> generates the function name as is
- there is no restriction on what SQL functions can be called, known or
unknown to SQLAlchemy, built-in or user defined. The section here only
describes those functions where SQLAlchemy already knows what argument and
return types are in use.</p>
<span class="target" id="module-sqlalchemy.sql.functions"></span><p>SQL function API, factories, and built-in functions.</p>
<dl class="class">
<dt id="sqlalchemy.sql.functions.AnsiFunction">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">AnsiFunction</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.AnsiFunction" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.GenericFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.AnsiFunction.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'AnsiFunction'</em><a class="headerlink" href="#sqlalchemy.sql.functions.AnsiFunction.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.AnsiFunction.name">
<tt class="descname">name</tt><em class="property"> = 'AnsiFunction'</em><a class="headerlink" href="#sqlalchemy.sql.functions.AnsiFunction.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.Function">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">Function</tt><big>(</big><em>name</em>, <em>*clauses</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.Function" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement" title="sqlalchemy.sql.functions.FunctionElement"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.FunctionElement</span></tt></a></p>
<p>Describe a named SQL function.</p>
<p>See the superclass <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement" title="sqlalchemy.sql.functions.FunctionElement"><tt class="xref py py-class docutils literal"><span class="pre">FunctionElement</span></tt></a> for a description
of public methods.</p>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p><a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> - namespace which produces registered or ad-hoc
<a class="reference internal" href="#sqlalchemy.sql.functions.Function" title="sqlalchemy.sql.functions.Function"><tt class="xref py py-class docutils literal"><span class="pre">Function</span></tt></a> instances.</p>
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">GenericFunction</span></tt></a> - allows creation of registered function
types.</p>
</div>
<dl class="method">
<dt id="sqlalchemy.sql.functions.Function.__init__">
<tt class="descname">__init__</tt><big>(</big><em>name</em>, <em>*clauses</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.Function.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct a <a class="reference internal" href="#sqlalchemy.sql.functions.Function" title="sqlalchemy.sql.functions.Function"><tt class="xref py py-class docutils literal"><span class="pre">Function</span></tt></a>.</p>
<p>The <a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> construct is normally used to construct
new <a class="reference internal" href="#sqlalchemy.sql.functions.Function" title="sqlalchemy.sql.functions.Function"><tt class="xref py py-class docutils literal"><span class="pre">Function</span></tt></a> instances.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.FunctionElement">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">FunctionElement</tt><big>(</big><em>*clauses</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.FunctionElement" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.Executable" title="sqlalchemy.sql.expression.Executable"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.expression.Executable</span></tt></a>, <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.expression.ColumnElement</span></tt></a>, <a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.FromClause" title="sqlalchemy.sql.expression.FromClause"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.expression.FromClause</span></tt></a></p>
<p>Base for SQL function-oriented constructs.</p>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p><a class="reference internal" href="#sqlalchemy.sql.functions.Function" title="sqlalchemy.sql.functions.Function"><tt class="xref py py-class docutils literal"><span class="pre">Function</span></tt></a> - named SQL function.</p>
<p><a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> - namespace which produces registered or ad-hoc
<a class="reference internal" href="#sqlalchemy.sql.functions.Function" title="sqlalchemy.sql.functions.Function"><tt class="xref py py-class docutils literal"><span class="pre">Function</span></tt></a> instances.</p>
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">GenericFunction</span></tt></a> - allows creation of registered function
types.</p>
</div>
<dl class="method">
<dt id="sqlalchemy.sql.functions.FunctionElement.__init__">
<tt class="descname">__init__</tt><big>(</big><em>*clauses</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.FunctionElement.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct a <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement" title="sqlalchemy.sql.functions.FunctionElement"><tt class="xref py py-class docutils literal"><span class="pre">FunctionElement</span></tt></a>.</p>
</dd></dl>
<dl class="method">
<dt id="sqlalchemy.sql.functions.FunctionElement.alias">
<tt class="descname">alias</tt><big>(</big><em>name=None</em>, <em>flat=False</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.FunctionElement.alias" title="Permalink to this definition">¶</a></dt>
<dd><p>Produce a <a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.Alias" title="sqlalchemy.sql.expression.Alias"><tt class="xref py py-class docutils literal"><span class="pre">Alias</span></tt></a> construct against this
<a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement" title="sqlalchemy.sql.functions.FunctionElement"><tt class="xref py py-class docutils literal"><span class="pre">FunctionElement</span></tt></a>.</p>
<p>This construct wraps the function in a named alias which
is suitable for the FROM clause.</p>
<p>e.g.:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy.sql</span> <span class="kn">import</span> <span class="n">column</span>
<span class="n">stmt</span> <span class="o">=</span> <span class="n">select</span><span class="p">([</span><span class="n">column</span><span class="p">(</span><span class="s">'data'</span><span class="p">)])</span><span class="o">.</span><span class="n">select_from</span><span class="p">(</span>
<span class="n">func</span><span class="o">.</span><span class="n">unnest</span><span class="p">(</span><span class="n">Table</span><span class="o">.</span><span class="n">data</span><span class="p">)</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="s">'data_view'</span><span class="p">)</span>
<span class="p">)</span></pre></div>
</div>
<p>Would produce:</p>
<div class="highlight-sql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="k">data</span>
<span class="k">FROM</span> <span class="k">unnest</span><span class="p">(</span><span class="n">sometable</span><span class="p">.</span><span class="k">data</span><span class="p">)</span> <span class="k">AS</span> <span class="n">data_view</span></pre></div>
</div>
<div class="versionadded">
<p><span>New in version 0.9.8: </span>The <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement.alias" title="sqlalchemy.sql.functions.FunctionElement.alias"><tt class="xref py py-meth docutils literal"><span class="pre">FunctionElement.alias()</span></tt></a> method
is now supported. Previously, this method’s behavior was
undefined and did not behave consistently across versions.</p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.FunctionElement.clauses">
<tt class="descname">clauses</tt><a class="headerlink" href="#sqlalchemy.sql.functions.FunctionElement.clauses" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the underlying <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.ClauseList" title="sqlalchemy.sql.expression.ClauseList"><tt class="xref py py-class docutils literal"><span class="pre">ClauseList</span></tt></a> which contains
the arguments for this <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement" title="sqlalchemy.sql.functions.FunctionElement"><tt class="xref py py-class docutils literal"><span class="pre">FunctionElement</span></tt></a>.</p>
</dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.FunctionElement.columns">
<tt class="descname">columns</tt><a class="headerlink" href="#sqlalchemy.sql.functions.FunctionElement.columns" title="Permalink to this definition">¶</a></dt>
<dd><p>The set of columns exported by this <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement" title="sqlalchemy.sql.functions.FunctionElement"><tt class="xref py py-class docutils literal"><span class="pre">FunctionElement</span></tt></a>.</p>
<p>Function objects currently have no result column names built in;
this method returns a single-element column collection with
an anonymously named column.</p>
<p>An interim approach to providing named columns for a function
as a FROM clause is to build a <a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.select" title="sqlalchemy.sql.expression.select"><tt class="xref py py-func docutils literal"><span class="pre">select()</span></tt></a> with the
desired columns:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy.sql</span> <span class="kn">import</span> <span class="n">column</span>
<span class="n">stmt</span> <span class="o">=</span> <span class="n">select</span><span class="p">([</span><span class="n">column</span><span class="p">(</span><span class="s">'x'</span><span class="p">),</span> <span class="n">column</span><span class="p">(</span><span class="s">'y'</span><span class="p">)])</span><span class="o">.</span> <span class="n">select_from</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">myfunction</span><span class="p">())</span></pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="sqlalchemy.sql.functions.FunctionElement.execute">
<tt class="descname">execute</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.FunctionElement.execute" title="Permalink to this definition">¶</a></dt>
<dd><p>Execute this <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement" title="sqlalchemy.sql.functions.FunctionElement"><tt class="xref py py-class docutils literal"><span class="pre">FunctionElement</span></tt></a> against an embedded
‘bind’.</p>
<p>This first calls <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement.select" title="sqlalchemy.sql.functions.FunctionElement.select"><tt class="xref py py-meth docutils literal"><span class="pre">select()</span></tt></a> to
produce a SELECT construct.</p>
<p>Note that <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement" title="sqlalchemy.sql.functions.FunctionElement"><tt class="xref py py-class docutils literal"><span class="pre">FunctionElement</span></tt></a> can be passed to
the <a class="reference internal" href="connections.html#sqlalchemy.engine.Connectable.execute" title="sqlalchemy.engine.Connectable.execute"><tt class="xref py py-meth docutils literal"><span class="pre">Connectable.execute()</span></tt></a> method of <a class="reference internal" href="connections.html#sqlalchemy.engine.Connection" title="sqlalchemy.engine.Connection"><tt class="xref py py-class docutils literal"><span class="pre">Connection</span></tt></a>
or <a class="reference internal" href="connections.html#sqlalchemy.engine.Engine" title="sqlalchemy.engine.Engine"><tt class="xref py py-class docutils literal"><span class="pre">Engine</span></tt></a>.</p>
</dd></dl>
<dl class="method">
<dt id="sqlalchemy.sql.functions.FunctionElement.get_children">
<tt class="descname">get_children</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.FunctionElement.get_children" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.sql.functions.FunctionElement.over">
<tt class="descname">over</tt><big>(</big><em>partition_by=None</em>, <em>order_by=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.FunctionElement.over" title="Permalink to this definition">¶</a></dt>
<dd><p>Produce an OVER clause against this function.</p>
<p>Used against aggregate or so-called “window” functions,
for database backends that support window functions.</p>
<p>The expression:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">func</span><span class="o">.</span><span class="n">row_number</span><span class="p">()</span><span class="o">.</span><span class="n">over</span><span class="p">(</span><span class="n">order_by</span><span class="o">=</span><span class="s">'x'</span><span class="p">)</span></pre></div>
</div>
<p>is shorthand for:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">over</span>
<span class="n">over</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">row_number</span><span class="p">(),</span> <span class="n">order_by</span><span class="o">=</span><span class="s">'x'</span><span class="p">)</span></pre></div>
</div>
<p>See <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.over" title="sqlalchemy.sql.expression.over"><tt class="xref py py-func docutils literal"><span class="pre">over()</span></tt></a> for a full description.</p>
<div class="versionadded">
<p><span>New in version 0.7.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.FunctionElement.packagenames">
<tt class="descname">packagenames</tt><em class="property"> = ()</em><a class="headerlink" href="#sqlalchemy.sql.functions.FunctionElement.packagenames" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="sqlalchemy.sql.functions.FunctionElement.scalar">
<tt class="descname">scalar</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.FunctionElement.scalar" title="Permalink to this definition">¶</a></dt>
<dd><p>Execute this <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement" title="sqlalchemy.sql.functions.FunctionElement"><tt class="xref py py-class docutils literal"><span class="pre">FunctionElement</span></tt></a> against an embedded
‘bind’ and return a scalar value.</p>
<p>This first calls <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement.select" title="sqlalchemy.sql.functions.FunctionElement.select"><tt class="xref py py-meth docutils literal"><span class="pre">select()</span></tt></a> to
produce a SELECT construct.</p>
<p>Note that <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement" title="sqlalchemy.sql.functions.FunctionElement"><tt class="xref py py-class docutils literal"><span class="pre">FunctionElement</span></tt></a> can be passed to
the <a class="reference internal" href="connections.html#sqlalchemy.engine.Connectable.scalar" title="sqlalchemy.engine.Connectable.scalar"><tt class="xref py py-meth docutils literal"><span class="pre">Connectable.scalar()</span></tt></a> method of <a class="reference internal" href="connections.html#sqlalchemy.engine.Connection" title="sqlalchemy.engine.Connection"><tt class="xref py py-class docutils literal"><span class="pre">Connection</span></tt></a>
or <a class="reference internal" href="connections.html#sqlalchemy.engine.Engine" title="sqlalchemy.engine.Engine"><tt class="xref py py-class docutils literal"><span class="pre">Engine</span></tt></a>.</p>
</dd></dl>
<dl class="method">
<dt id="sqlalchemy.sql.functions.FunctionElement.select">
<tt class="descname">select</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.FunctionElement.select" title="Permalink to this definition">¶</a></dt>
<dd><p>Produce a <a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.select" title="sqlalchemy.sql.expression.select"><tt class="xref py py-func docutils literal"><span class="pre">select()</span></tt></a> construct
against this <a class="reference internal" href="#sqlalchemy.sql.functions.FunctionElement" title="sqlalchemy.sql.functions.FunctionElement"><tt class="xref py py-class docutils literal"><span class="pre">FunctionElement</span></tt></a>.</p>
<p>This is shorthand for:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">s</span> <span class="o">=</span> <span class="n">select</span><span class="p">([</span><span class="n">function_element</span><span class="p">])</span></pre></div>
</div>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.GenericFunction">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">GenericFunction</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.GenericFunction" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.Function" title="sqlalchemy.sql.functions.Function"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.Function</span></tt></a></p>
<p>Define a ‘generic’ function.</p>
<p>A generic function is a pre-established <a class="reference internal" href="#sqlalchemy.sql.functions.Function" title="sqlalchemy.sql.functions.Function"><tt class="xref py py-class docutils literal"><span class="pre">Function</span></tt></a>
class that is instantiated automatically when called
by name from the <a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> attribute. Note that
calling any name from <a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> has the effect that
a new <a class="reference internal" href="#sqlalchemy.sql.functions.Function" title="sqlalchemy.sql.functions.Function"><tt class="xref py py-class docutils literal"><span class="pre">Function</span></tt></a> instance is created automatically,
given that name. The primary use case for defining
a <a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">GenericFunction</span></tt></a> class is so that a function
of a particular name may be given a fixed return type.
It can also include custom argument parsing schemes as well
as additional methods.</p>
<p>Subclasses of <a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">GenericFunction</span></tt></a> are automatically
registered under the name of the class. For
example, a user-defined function <tt class="docutils literal"><span class="pre">as_utc()</span></tt> would
be available immediately:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy.sql.functions</span> <span class="kn">import</span> <span class="n">GenericFunction</span>
<span class="kn">from</span> <span class="nn">sqlalchemy.types</span> <span class="kn">import</span> <span class="n">DateTime</span>
<span class="k">class</span> <span class="nc">as_utc</span><span class="p">(</span><span class="n">GenericFunction</span><span class="p">):</span>
<span class="nb">type</span> <span class="o">=</span> <span class="n">DateTime</span>
<span class="k">print</span> <span class="n">select</span><span class="p">([</span><span class="n">func</span><span class="o">.</span><span class="n">as_utc</span><span class="p">()])</span></pre></div>
</div>
<p>User-defined generic functions can be organized into
packages by specifying the “package” attribute when defining
<a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">GenericFunction</span></tt></a>. Third party libraries
containing many functions may want to use this in order
to avoid name conflicts with other systems. For example,
if our <tt class="docutils literal"><span class="pre">as_utc()</span></tt> function were part of a package
“time”:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">as_utc</span><span class="p">(</span><span class="n">GenericFunction</span><span class="p">):</span>
<span class="nb">type</span> <span class="o">=</span> <span class="n">DateTime</span>
<span class="n">package</span> <span class="o">=</span> <span class="s">"time"</span></pre></div>
</div>
<p>The above function would be available from <a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a>
using the package name <tt class="docutils literal"><span class="pre">time</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">print</span> <span class="n">select</span><span class="p">([</span><span class="n">func</span><span class="o">.</span><span class="n">time</span><span class="o">.</span><span class="n">as_utc</span><span class="p">()])</span></pre></div>
</div>
<p>A final option is to allow the function to be accessed
from one name in <a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> but to render as a different name.
The <tt class="docutils literal"><span class="pre">identifier</span></tt> attribute will override the name used to
access the function as loaded from <a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a>, but will retain
the usage of <tt class="docutils literal"><span class="pre">name</span></tt> as the rendered name:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">GeoBuffer</span><span class="p">(</span><span class="n">GenericFunction</span><span class="p">):</span>
<span class="nb">type</span> <span class="o">=</span> <span class="n">Geometry</span>
<span class="n">package</span> <span class="o">=</span> <span class="s">"geo"</span>
<span class="n">name</span> <span class="o">=</span> <span class="s">"ST_Buffer"</span>
<span class="n">identifier</span> <span class="o">=</span> <span class="s">"buffer"</span></pre></div>
</div>
<p>The above function will render as follows:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">print</span> <span class="n">func</span><span class="o">.</span><span class="n">geo</span><span class="o">.</span><span class="n">buffer</span><span class="p">()</span>
<span class="go">ST_Buffer()</span></pre></div>
</div>
<div class="versionadded">
<p><span>New in version 0.8: </span><a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">GenericFunction</span></tt></a> now supports
automatic registration of new functions as well as package
and custom naming support.</p>
</div>
<div class="versionchanged">
<p><span>Changed in version 0.8: </span>The attribute name <tt class="docutils literal"><span class="pre">type</span></tt> is used
to specify the function’s return type at the class level.
Previously, the name <tt class="docutils literal"><span class="pre">__return_type__</span></tt> was used. This
name is still recognized for backwards-compatibility.</p>
</div>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.GenericFunction.coerce_arguments">
<tt class="descname">coerce_arguments</tt><em class="property"> = True</em><a class="headerlink" href="#sqlalchemy.sql.functions.GenericFunction.coerce_arguments" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.GenericFunction.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'GenericFunction'</em><a class="headerlink" href="#sqlalchemy.sql.functions.GenericFunction.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.GenericFunction.name">
<tt class="descname">name</tt><em class="property"> = 'GenericFunction'</em><a class="headerlink" href="#sqlalchemy.sql.functions.GenericFunction.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.ReturnTypeFromArgs">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">ReturnTypeFromArgs</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.ReturnTypeFromArgs" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.GenericFunction</span></tt></a></p>
<p>Define a function whose return type is the same as its arguments.</p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.ReturnTypeFromArgs.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'ReturnTypeFromArgs'</em><a class="headerlink" href="#sqlalchemy.sql.functions.ReturnTypeFromArgs.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.ReturnTypeFromArgs.name">
<tt class="descname">name</tt><em class="property"> = 'ReturnTypeFromArgs'</em><a class="headerlink" href="#sqlalchemy.sql.functions.ReturnTypeFromArgs.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.char_length">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">char_length</tt><big>(</big><em>arg</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.char_length" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.GenericFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.char_length.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'char_length'</em><a class="headerlink" href="#sqlalchemy.sql.functions.char_length.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.char_length.name">
<tt class="descname">name</tt><em class="property"> = 'char_length'</em><a class="headerlink" href="#sqlalchemy.sql.functions.char_length.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.char_length.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.char_length.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Integer</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.coalesce">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">coalesce</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.coalesce" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.ReturnTypeFromArgs" title="sqlalchemy.sql.functions.ReturnTypeFromArgs"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.ReturnTypeFromArgs</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.coalesce.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'coalesce'</em><a class="headerlink" href="#sqlalchemy.sql.functions.coalesce.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.coalesce.name">
<tt class="descname">name</tt><em class="property"> = 'coalesce'</em><a class="headerlink" href="#sqlalchemy.sql.functions.coalesce.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.concat">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">concat</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.concat" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.GenericFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.concat.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'concat'</em><a class="headerlink" href="#sqlalchemy.sql.functions.concat.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.concat.name">
<tt class="descname">name</tt><em class="property"> = 'concat'</em><a class="headerlink" href="#sqlalchemy.sql.functions.concat.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.concat.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.concat.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.count">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">count</tt><big>(</big><em>expression=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.count" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.GenericFunction</span></tt></a></p>
<p>The ANSI COUNT aggregate function. With no arguments,
emits COUNT *.</p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.count.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'count'</em><a class="headerlink" href="#sqlalchemy.sql.functions.count.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.count.name">
<tt class="descname">name</tt><em class="property"> = 'count'</em><a class="headerlink" href="#sqlalchemy.sql.functions.count.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.count.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.count.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Integer</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.current_date">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">current_date</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.current_date" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.AnsiFunction" title="sqlalchemy.sql.functions.AnsiFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.AnsiFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_date.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'current_date'</em><a class="headerlink" href="#sqlalchemy.sql.functions.current_date.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_date.name">
<tt class="descname">name</tt><em class="property"> = 'current_date'</em><a class="headerlink" href="#sqlalchemy.sql.functions.current_date.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_date.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.current_date.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Date</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.current_time">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">current_time</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.current_time" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.AnsiFunction" title="sqlalchemy.sql.functions.AnsiFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.AnsiFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_time.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'current_time'</em><a class="headerlink" href="#sqlalchemy.sql.functions.current_time.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_time.name">
<tt class="descname">name</tt><em class="property"> = 'current_time'</em><a class="headerlink" href="#sqlalchemy.sql.functions.current_time.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_time.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.current_time.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Time</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.current_timestamp">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">current_timestamp</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.current_timestamp" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.AnsiFunction" title="sqlalchemy.sql.functions.AnsiFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.AnsiFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_timestamp.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'current_timestamp'</em><a class="headerlink" href="#sqlalchemy.sql.functions.current_timestamp.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_timestamp.name">
<tt class="descname">name</tt><em class="property"> = 'current_timestamp'</em><a class="headerlink" href="#sqlalchemy.sql.functions.current_timestamp.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_timestamp.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.current_timestamp.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">DateTime</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.current_user">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">current_user</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.current_user" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.AnsiFunction" title="sqlalchemy.sql.functions.AnsiFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.AnsiFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_user.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'current_user'</em><a class="headerlink" href="#sqlalchemy.sql.functions.current_user.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_user.name">
<tt class="descname">name</tt><em class="property"> = 'current_user'</em><a class="headerlink" href="#sqlalchemy.sql.functions.current_user.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.current_user.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.current_user.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="data">
<dt id="sqlalchemy.sql.functions.func">
<tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">func</tt><em class="property"> = <sqlalchemy.sql.functions._FunctionGenerator object at 0x10371c4d0></em><a class="headerlink" href="#sqlalchemy.sql.functions.func" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate SQL function expressions.</p>
<p><a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> is a special object instance which generates SQL
functions based on name-based attributes, e.g.:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">print</span> <span class="n">func</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="go">count(:param_1)</span></pre></div>
</div>
<p>The element is a column-oriented SQL element like any other, and is
used in that way:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">print</span> <span class="n">select</span><span class="p">([</span><span class="n">func</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">id</span><span class="p">)])</span>
<span class="go">SELECT count(sometable.id) FROM sometable</span></pre></div>
</div>
<p>Any name can be given to <a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a>. If the function name is unknown to
SQLAlchemy, it will be rendered exactly as is. For common SQL functions
which SQLAlchemy is aware of, the name may be interpreted as a <em>generic
function</em> which will be compiled appropriately to the target database:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">print</span> <span class="n">func</span><span class="o">.</span><span class="n">current_timestamp</span><span class="p">()</span>
<span class="go">CURRENT_TIMESTAMP</span></pre></div>
</div>
<p>To call functions which are present in dot-separated packages,
specify them in the same manner:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">print</span> <span class="n">func</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">yield_curve</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
<span class="go">stats.yield_curve(:yield_curve_1, :yield_curve_2)</span></pre></div>
</div>
<p>SQLAlchemy can be made aware of the return type of functions to enable
type-specific lexical and result-based behavior. For example, to ensure
that a string-based function returns a Unicode value and is similarly
treated as a string in expressions, specify
<a class="reference internal" href="types.html#sqlalchemy.types.Unicode" title="sqlalchemy.types.Unicode"><tt class="xref py py-class docutils literal"><span class="pre">Unicode</span></tt></a> as the type:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">print</span> <span class="n">func</span><span class="o">.</span><span class="n">my_string</span><span class="p">(</span><span class="s">u'hi'</span><span class="p">,</span> <span class="n">type_</span><span class="o">=</span><span class="n">Unicode</span><span class="p">)</span> <span class="o">+</span> <span class="s">' '</span> <span class="o">+</span> \
<span class="gp">... </span><span class="n">func</span><span class="o">.</span><span class="n">my_string</span><span class="p">(</span><span class="s">u'there'</span><span class="p">,</span> <span class="n">type_</span><span class="o">=</span><span class="n">Unicode</span><span class="p">)</span>
<span class="go">my_string(:my_string_1) || :my_string_2 || my_string(:my_string_3)</span></pre></div>
</div>
<p>The object returned by a <a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> call is usually an instance of
<a class="reference internal" href="#sqlalchemy.sql.functions.Function" title="sqlalchemy.sql.functions.Function"><tt class="xref py py-class docutils literal"><span class="pre">Function</span></tt></a>.
This object meets the “column” interface, including comparison and labeling
functions. The object can also be passed the <a class="reference internal" href="connections.html#sqlalchemy.engine.Connectable.execute" title="sqlalchemy.engine.Connectable.execute"><tt class="xref py py-meth docutils literal"><span class="pre">execute()</span></tt></a>
method of a <a class="reference internal" href="connections.html#sqlalchemy.engine.Connection" title="sqlalchemy.engine.Connection"><tt class="xref py py-class docutils literal"><span class="pre">Connection</span></tt></a> or <a class="reference internal" href="connections.html#sqlalchemy.engine.Engine" title="sqlalchemy.engine.Engine"><tt class="xref py py-class docutils literal"><span class="pre">Engine</span></tt></a>, where it will be
wrapped inside of a SELECT statement first:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">print</span> <span class="n">connection</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">current_timestamp</span><span class="p">())</span><span class="o">.</span><span class="n">scalar</span><span class="p">()</span></pre></div>
</div>
<p>In a few exception cases, the <a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> accessor
will redirect a name to a built-in expression such as <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.cast" title="sqlalchemy.sql.expression.cast"><tt class="xref py py-func docutils literal"><span class="pre">cast()</span></tt></a>
or <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.extract" title="sqlalchemy.sql.expression.extract"><tt class="xref py py-func docutils literal"><span class="pre">extract()</span></tt></a>, as these names have well-known meaning
but are not exactly the same as “functions” from a SQLAlchemy
perspective.</p>
<div class="versionadded">
<p><span>New in version 0.8: </span><a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> can return non-function expression
constructs for common quasi-functional names like <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.cast" title="sqlalchemy.sql.expression.cast"><tt class="xref py py-func docutils literal"><span class="pre">cast()</span></tt></a>
and <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.extract" title="sqlalchemy.sql.expression.extract"><tt class="xref py py-func docutils literal"><span class="pre">extract()</span></tt></a>.</p>
</div>
<p>Functions which are interpreted as “generic” functions know how to
calculate their return type automatically. For a listing of known generic
functions, see <a class="reference internal" href="#generic-functions"><em>SQL and Generic Functions</em></a>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>The <a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> construct has only limited support for calling
standalone “stored procedures”, especially those with special
parameterization concerns.</p>
<p class="last">See the section <a class="reference internal" href="connections.html#stored-procedures"><em>Calling Stored Procedures</em></a> for details on how to use
the DBAPI-level <tt class="docutils literal"><span class="pre">callproc()</span></tt> method for fully traditional stored
procedures.</p>
</div>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.localtime">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">localtime</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.localtime" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.AnsiFunction" title="sqlalchemy.sql.functions.AnsiFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.AnsiFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.localtime.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'localtime'</em><a class="headerlink" href="#sqlalchemy.sql.functions.localtime.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.localtime.name">
<tt class="descname">name</tt><em class="property"> = 'localtime'</em><a class="headerlink" href="#sqlalchemy.sql.functions.localtime.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.localtime.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.localtime.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">DateTime</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.localtimestamp">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">localtimestamp</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.localtimestamp" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.AnsiFunction" title="sqlalchemy.sql.functions.AnsiFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.AnsiFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.localtimestamp.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'localtimestamp'</em><a class="headerlink" href="#sqlalchemy.sql.functions.localtimestamp.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.localtimestamp.name">
<tt class="descname">name</tt><em class="property"> = 'localtimestamp'</em><a class="headerlink" href="#sqlalchemy.sql.functions.localtimestamp.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.localtimestamp.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.localtimestamp.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">DateTime</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.max">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">max</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.max" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.ReturnTypeFromArgs" title="sqlalchemy.sql.functions.ReturnTypeFromArgs"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.ReturnTypeFromArgs</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.max.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'max'</em><a class="headerlink" href="#sqlalchemy.sql.functions.max.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.max.name">
<tt class="descname">name</tt><em class="property"> = 'max'</em><a class="headerlink" href="#sqlalchemy.sql.functions.max.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.min">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">min</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.min" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.ReturnTypeFromArgs" title="sqlalchemy.sql.functions.ReturnTypeFromArgs"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.ReturnTypeFromArgs</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.min.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'min'</em><a class="headerlink" href="#sqlalchemy.sql.functions.min.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.min.name">
<tt class="descname">name</tt><em class="property"> = 'min'</em><a class="headerlink" href="#sqlalchemy.sql.functions.min.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.next_value">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">next_value</tt><big>(</big><em>seq</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.next_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.GenericFunction</span></tt></a></p>
<p>Represent the ‘next value’, given a <a class="reference internal" href="defaults.html#sqlalchemy.schema.Sequence" title="sqlalchemy.schema.Sequence"><tt class="xref py py-class docutils literal"><span class="pre">Sequence</span></tt></a>
as its single argument.</p>
<p>Compiles into the appropriate function on each backend,
or will raise NotImplementedError if used on a backend
that does not provide support for sequences.</p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.next_value.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'next_value'</em><a class="headerlink" href="#sqlalchemy.sql.functions.next_value.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.next_value.name">
<tt class="descname">name</tt><em class="property"> = 'next_value'</em><a class="headerlink" href="#sqlalchemy.sql.functions.next_value.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.next_value.type">
<tt class="descname">type</tt><em class="property"> = Integer()</em><a class="headerlink" href="#sqlalchemy.sql.functions.next_value.type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.now">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">now</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.now" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.GenericFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.now.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'now'</em><a class="headerlink" href="#sqlalchemy.sql.functions.now.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.now.name">
<tt class="descname">name</tt><em class="property"> = 'now'</em><a class="headerlink" href="#sqlalchemy.sql.functions.now.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.now.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.now.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">DateTime</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.random">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">random</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.random" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.GenericFunction" title="sqlalchemy.sql.functions.GenericFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.GenericFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.random.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'random'</em><a class="headerlink" href="#sqlalchemy.sql.functions.random.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.random.name">
<tt class="descname">name</tt><em class="property"> = 'random'</em><a class="headerlink" href="#sqlalchemy.sql.functions.random.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="function">
<dt id="sqlalchemy.sql.functions.register_function">
<tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">register_function</tt><big>(</big><em>identifier</em>, <em>fn</em>, <em>package='_default'</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.register_function" title="Permalink to this definition">¶</a></dt>
<dd><p>Associate a callable with a particular func. name.</p>
<p>This is normally called by _GenericMeta, but is also
available by itself so that a non-Function construct
can be associated with the <a class="reference internal" href="#sqlalchemy.sql.functions.func" title="sqlalchemy.sql.functions.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> accessor (i.e.
CAST, EXTRACT).</p>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.session_user">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">session_user</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.session_user" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.AnsiFunction" title="sqlalchemy.sql.functions.AnsiFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.AnsiFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.session_user.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'session_user'</em><a class="headerlink" href="#sqlalchemy.sql.functions.session_user.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.session_user.name">
<tt class="descname">name</tt><em class="property"> = 'session_user'</em><a class="headerlink" href="#sqlalchemy.sql.functions.session_user.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.session_user.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.session_user.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.sum">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">sum</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.sum" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.ReturnTypeFromArgs" title="sqlalchemy.sql.functions.ReturnTypeFromArgs"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.ReturnTypeFromArgs</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.sum.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'sum'</em><a class="headerlink" href="#sqlalchemy.sql.functions.sum.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.sum.name">
<tt class="descname">name</tt><em class="property"> = 'sum'</em><a class="headerlink" href="#sqlalchemy.sql.functions.sum.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.sysdate">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">sysdate</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.sysdate" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.AnsiFunction" title="sqlalchemy.sql.functions.AnsiFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.AnsiFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.sysdate.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'sysdate'</em><a class="headerlink" href="#sqlalchemy.sql.functions.sysdate.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.sysdate.name">
<tt class="descname">name</tt><em class="property"> = 'sysdate'</em><a class="headerlink" href="#sqlalchemy.sql.functions.sysdate.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.sysdate.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.sysdate.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">DateTime</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="sqlalchemy.sql.functions.user">
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.functions.</tt><tt class="descname">user</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.functions.user" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.functions.AnsiFunction" title="sqlalchemy.sql.functions.AnsiFunction"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.functions.AnsiFunction</span></tt></a></p>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.user.identifier">
<tt class="descname">identifier</tt><em class="property"> = 'user'</em><a class="headerlink" href="#sqlalchemy.sql.functions.user.identifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.user.name">
<tt class="descname">name</tt><em class="property"> = 'user'</em><a class="headerlink" href="#sqlalchemy.sql.functions.user.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="sqlalchemy.sql.functions.user.type">
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.user.type" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
<div id="docs-bottom-navigation" class="docs-navigation-links">
Previous:
<a href="dml.html" title="previous chapter">Insert, Updates, Deletes</a>
Next:
<a href="types.html" title="next chapter">Column and Data Types</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>