1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml">
6
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11
SQL and Generic Functions
13
SQLAlchemy 0.8 Documentation
17
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
18
<link rel="stylesheet" href="../_static/docs.css" type="text/css" />
20
<script type="text/javascript">
21
var DOCUMENTATION_OPTIONS = {
24
COLLAPSE_MODINDEX: false,
28
<script type="text/javascript" src="../_static/jquery.js"></script>
29
<script type="text/javascript" src="../_static/underscore.js"></script>
30
<script type="text/javascript" src="../_static/doctools.js"></script>
31
<script type="text/javascript" src="../_static/init.js"></script>
32
<link rel="index" title="Index" href="../genindex.html" />
33
<link rel="search" title="Search" href="../search.html" />
34
<link rel="copyright" title="Copyright" href="../copyright.html" />
35
<link rel="top" title="SQLAlchemy 0.8 Documentation" href="../index.html" />
36
<link rel="up" title="SQL Statements and Expressions API" href="expression_api.html" />
37
<link rel="next" title="Column and Data Types" href="types.html" />
38
<link rel="prev" title="Insert, Updates, Deletes" href="dml.html" />
53
<div id="docs-container">
57
<div id="docs-header">
58
<h1>SQLAlchemy 0.8 Documentation</h1>
60
<div id="docs-search">
62
<form class="search" action="../search.html" method="get">
63
<input type="text" name="q" size="18" /> <input type="submit" value="Search" />
64
<input type="hidden" name="check_keywords" value="yes" />
65
<input type="hidden" name="area" value="default" />
69
<div id="docs-version-header">
70
Release: <span class="version-num">0.8.3</span> | Release Date: October 26, 2013
77
<div id="docs-top-navigation">
78
<div id="docs-top-page-control" class="docs-navigation-links">
81
<a href="dml.html" title="previous chapter">Insert, Updates, Deletes</a>
84
<a href="types.html" title="next chapter">Column and Data Types</a>
88
<a href="../contents.html">Table of Contents</a> |
89
<a href="../genindex.html">Index</a>
90
| <a href="../_sources/core/functions.txt">view source
95
<div id="docs-navigation-banner">
96
<a href="../index.html">SQLAlchemy 0.8 Documentation</a>
97
» <a href="index.html" title="SQLAlchemy Core">SQLAlchemy Core</a>
98
» <a href="expression_api.html" title="SQL Statements and Expressions API">SQL Statements and Expressions API</a>
100
SQL and Generic Functions
105
SQL and Generic Functions
112
<div id="docs-body-container">
114
<div id="docs-sidebar">
115
<h3><a href="../index.html">Table of Contents</a></h3>
117
<li><a class="reference internal" href="#">SQL and Generic Functions</a></li>
121
<h4>Previous Topic</h4>
123
<a href="dml.html" title="previous chapter">Insert, Updates, Deletes</a>
127
<a href="types.html" title="next chapter">Column and Data Types</a>
131
<h4>Quick Search</h4>
133
<form class="search" action="../search.html" method="get">
134
<input type="text" name="q" size="18" /> <input type="submit" value="Search" />
135
<input type="hidden" name="check_keywords" value="yes" />
136
<input type="hidden" name="area" value="default" />
142
<div id="docs-body" class="withsidebar" >
144
<div class="section" id="module-sqlalchemy.sql.expression">
145
<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>
146
<p>SQL functions which are known to SQLAlchemy with regards to database-specific
147
rendering, return types and argument behavior. Generic functions are invoked
148
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>
149
<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>
151
<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
152
- there is no restriction on what SQL functions can be called, known or
153
unknown to SQLAlchemy, built-in or user defined. The section here only
154
describes those functions where SQLAlchemy already knows what argument and
155
return types are in use.</p>
156
<span class="target" id="module-sqlalchemy.sql.functions"></span><dl class="class">
157
<dt id="sqlalchemy.sql.functions.AnsiFunction">
158
<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>
159
<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>
160
<dl class="attribute">
161
<dt id="sqlalchemy.sql.functions.AnsiFunction.identifier">
162
<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>
165
<dl class="attribute">
166
<dt id="sqlalchemy.sql.functions.AnsiFunction.name">
167
<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>
173
<dt id="sqlalchemy.sql.functions.GenericFunction">
174
<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>
175
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.expression.Function</span></tt></p>
176
<p>Define a ‘generic’ function.</p>
177
<p>A generic function is a pre-established <tt class="xref py py-class docutils literal"><span class="pre">Function</span></tt>
178
class that is instantiated automatically when called
179
by name from the <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> attribute. Note that
180
calling any name from <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> has the effect that
181
a new <tt class="xref py py-class docutils literal"><span class="pre">Function</span></tt> instance is created automatically,
182
given that name. The primary use case for defining
183
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
184
of a particular name may be given a fixed return type.
185
It can also include custom argument parsing schemes as well
186
as additional methods.</p>
187
<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
188
registered under the name of the class. For
189
example, a user-defined function <tt class="docutils literal"><span class="pre">as_utc()</span></tt> would
190
be available immediately:</p>
191
<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>
192
<span class="kn">from</span> <span class="nn">sqlalchemy.types</span> <span class="kn">import</span> <span class="n">DateTime</span>
194
<span class="k">class</span> <span class="nc">as_utc</span><span class="p">(</span><span class="n">GenericFunction</span><span class="p">):</span>
195
<span class="nb">type</span> <span class="o">=</span> <span class="n">DateTime</span>
197
<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>
199
<p>User-defined generic functions can be organized into
200
packages by specifying the “package” attribute when defining
201
<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
202
containing many functions may want to use this in order
203
to avoid name conflicts with other systems. For example,
204
if our <tt class="docutils literal"><span class="pre">as_utc()</span></tt> function were part of a package
205
“time”:</p>
206
<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>
207
<span class="nb">type</span> <span class="o">=</span> <span class="n">DateTime</span>
208
<span class="n">package</span> <span class="o">=</span> <span class="s">"time"</span></pre></div>
210
<p>The above function would be available from <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a>
211
using the package name <tt class="docutils literal"><span class="pre">time</span></tt>:</p>
212
<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>
214
<p>A final option is to allow the function to be accessed
215
from one name in <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> but to render as a different name.
216
The <tt class="docutils literal"><span class="pre">identifier</span></tt> attribute will override the name used to
217
access the function as loaded from <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a>, but will retain
218
the usage of <tt class="docutils literal"><span class="pre">name</span></tt> as the rendered name:</p>
219
<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>
220
<span class="nb">type</span> <span class="o">=</span> <span class="n">Geometry</span>
221
<span class="n">package</span> <span class="o">=</span> <span class="s">"geo"</span>
222
<span class="n">name</span> <span class="o">=</span> <span class="s">"ST_Buffer"</span>
223
<span class="n">identifier</span> <span class="o">=</span> <span class="s">"buffer"</span></pre></div>
225
<p>The above function will render as follows:</p>
226
<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>
227
<span class="go">ST_Buffer()</span></pre></div>
229
<div class="versionadded">
230
<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
231
automatic registration of new functions as well as package
232
and custom naming support.</p>
234
<div class="versionchanged">
235
<p><span>Changed in version 0.8: </span>The attribute name <tt class="docutils literal"><span class="pre">type</span></tt> is used
236
to specify the function’s return type at the class level.
237
Previously, the name <tt class="docutils literal"><span class="pre">__return_type__</span></tt> was used. This
238
name is still recognized for backwards-compatibility.</p>
240
<dl class="attribute">
241
<dt id="sqlalchemy.sql.functions.GenericFunction.coerce_arguments">
242
<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>
245
<dl class="attribute">
246
<dt id="sqlalchemy.sql.functions.GenericFunction.identifier">
247
<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>
250
<dl class="attribute">
251
<dt id="sqlalchemy.sql.functions.GenericFunction.name">
252
<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>
258
<dt id="sqlalchemy.sql.functions.ReturnTypeFromArgs">
259
<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>
260
<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>
261
<p>Define a function whose return type is the same as its arguments.</p>
262
<dl class="attribute">
263
<dt id="sqlalchemy.sql.functions.ReturnTypeFromArgs.identifier">
264
<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>
267
<dl class="attribute">
268
<dt id="sqlalchemy.sql.functions.ReturnTypeFromArgs.name">
269
<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>
275
<dt id="sqlalchemy.sql.functions.char_length">
276
<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>
277
<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>
278
<dl class="attribute">
279
<dt id="sqlalchemy.sql.functions.char_length.identifier">
280
<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>
283
<dl class="attribute">
284
<dt id="sqlalchemy.sql.functions.char_length.name">
285
<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>
288
<dl class="attribute">
289
<dt id="sqlalchemy.sql.functions.char_length.type">
290
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.char_length.type" title="Permalink to this definition">¶</a></dt>
291
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Integer</span></tt></p>
297
<dt id="sqlalchemy.sql.functions.coalesce">
298
<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>
299
<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>
300
<dl class="attribute">
301
<dt id="sqlalchemy.sql.functions.coalesce.identifier">
302
<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>
305
<dl class="attribute">
306
<dt id="sqlalchemy.sql.functions.coalesce.name">
307
<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>
313
<dt id="sqlalchemy.sql.functions.concat">
314
<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>
315
<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>
316
<dl class="attribute">
317
<dt id="sqlalchemy.sql.functions.concat.identifier">
318
<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>
321
<dl class="attribute">
322
<dt id="sqlalchemy.sql.functions.concat.name">
323
<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>
326
<dl class="attribute">
327
<dt id="sqlalchemy.sql.functions.concat.type">
328
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.concat.type" title="Permalink to this definition">¶</a></dt>
329
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></p>
335
<dt id="sqlalchemy.sql.functions.count">
336
<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>
337
<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>
338
<p>The ANSI COUNT aggregate function. With no arguments,
340
<dl class="attribute">
341
<dt id="sqlalchemy.sql.functions.count.identifier">
342
<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>
345
<dl class="attribute">
346
<dt id="sqlalchemy.sql.functions.count.name">
347
<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>
350
<dl class="attribute">
351
<dt id="sqlalchemy.sql.functions.count.type">
352
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.count.type" title="Permalink to this definition">¶</a></dt>
353
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Integer</span></tt></p>
359
<dt id="sqlalchemy.sql.functions.current_date">
360
<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>
361
<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>
362
<dl class="attribute">
363
<dt id="sqlalchemy.sql.functions.current_date.identifier">
364
<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>
367
<dl class="attribute">
368
<dt id="sqlalchemy.sql.functions.current_date.name">
369
<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>
372
<dl class="attribute">
373
<dt id="sqlalchemy.sql.functions.current_date.type">
374
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.current_date.type" title="Permalink to this definition">¶</a></dt>
375
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Date</span></tt></p>
381
<dt id="sqlalchemy.sql.functions.current_time">
382
<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>
383
<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>
384
<dl class="attribute">
385
<dt id="sqlalchemy.sql.functions.current_time.identifier">
386
<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>
389
<dl class="attribute">
390
<dt id="sqlalchemy.sql.functions.current_time.name">
391
<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>
394
<dl class="attribute">
395
<dt id="sqlalchemy.sql.functions.current_time.type">
396
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.current_time.type" title="Permalink to this definition">¶</a></dt>
397
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Time</span></tt></p>
403
<dt id="sqlalchemy.sql.functions.current_timestamp">
404
<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>
405
<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>
406
<dl class="attribute">
407
<dt id="sqlalchemy.sql.functions.current_timestamp.identifier">
408
<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>
411
<dl class="attribute">
412
<dt id="sqlalchemy.sql.functions.current_timestamp.name">
413
<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>
416
<dl class="attribute">
417
<dt id="sqlalchemy.sql.functions.current_timestamp.type">
418
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.current_timestamp.type" title="Permalink to this definition">¶</a></dt>
419
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">DateTime</span></tt></p>
425
<dt id="sqlalchemy.sql.functions.current_user">
426
<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>
427
<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>
428
<dl class="attribute">
429
<dt id="sqlalchemy.sql.functions.current_user.identifier">
430
<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>
433
<dl class="attribute">
434
<dt id="sqlalchemy.sql.functions.current_user.name">
435
<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>
438
<dl class="attribute">
439
<dt id="sqlalchemy.sql.functions.current_user.type">
440
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.current_user.type" title="Permalink to this definition">¶</a></dt>
441
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></p>
447
<dt id="sqlalchemy.sql.functions.localtime">
448
<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>
449
<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>
450
<dl class="attribute">
451
<dt id="sqlalchemy.sql.functions.localtime.identifier">
452
<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>
455
<dl class="attribute">
456
<dt id="sqlalchemy.sql.functions.localtime.name">
457
<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>
460
<dl class="attribute">
461
<dt id="sqlalchemy.sql.functions.localtime.type">
462
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.localtime.type" title="Permalink to this definition">¶</a></dt>
463
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">DateTime</span></tt></p>
469
<dt id="sqlalchemy.sql.functions.localtimestamp">
470
<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>
471
<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>
472
<dl class="attribute">
473
<dt id="sqlalchemy.sql.functions.localtimestamp.identifier">
474
<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>
477
<dl class="attribute">
478
<dt id="sqlalchemy.sql.functions.localtimestamp.name">
479
<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>
482
<dl class="attribute">
483
<dt id="sqlalchemy.sql.functions.localtimestamp.type">
484
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.localtimestamp.type" title="Permalink to this definition">¶</a></dt>
485
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">DateTime</span></tt></p>
491
<dt id="sqlalchemy.sql.functions.max">
492
<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>
493
<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>
494
<dl class="attribute">
495
<dt id="sqlalchemy.sql.functions.max.identifier">
496
<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>
499
<dl class="attribute">
500
<dt id="sqlalchemy.sql.functions.max.name">
501
<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>
507
<dt id="sqlalchemy.sql.functions.min">
508
<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>
509
<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>
510
<dl class="attribute">
511
<dt id="sqlalchemy.sql.functions.min.identifier">
512
<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>
515
<dl class="attribute">
516
<dt id="sqlalchemy.sql.functions.min.name">
517
<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>
523
<dt id="sqlalchemy.sql.functions.next_value">
524
<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>
525
<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>
526
<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>
527
as it’s single argument.</p>
528
<p>Compiles into the appropriate function on each backend,
529
or will raise NotImplementedError if used on a backend
530
that does not provide support for sequences.</p>
531
<dl class="attribute">
532
<dt id="sqlalchemy.sql.functions.next_value.identifier">
533
<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>
536
<dl class="attribute">
537
<dt id="sqlalchemy.sql.functions.next_value.name">
538
<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>
541
<dl class="attribute">
542
<dt id="sqlalchemy.sql.functions.next_value.type">
543
<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>
549
<dt id="sqlalchemy.sql.functions.now">
550
<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>
551
<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>
552
<dl class="attribute">
553
<dt id="sqlalchemy.sql.functions.now.identifier">
554
<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>
557
<dl class="attribute">
558
<dt id="sqlalchemy.sql.functions.now.name">
559
<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>
562
<dl class="attribute">
563
<dt id="sqlalchemy.sql.functions.now.type">
564
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.now.type" title="Permalink to this definition">¶</a></dt>
565
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">DateTime</span></tt></p>
571
<dt id="sqlalchemy.sql.functions.random">
572
<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>
573
<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>
574
<dl class="attribute">
575
<dt id="sqlalchemy.sql.functions.random.identifier">
576
<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>
579
<dl class="attribute">
580
<dt id="sqlalchemy.sql.functions.random.name">
581
<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>
586
<dl class="function">
587
<dt id="sqlalchemy.sql.functions.register_function">
588
<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>
589
<dd><p>Associate a callable with a particular func. name.</p>
590
<p>This is normally called by _GenericMeta, but is also
591
available by itself so that a non-Function construct
592
can be associated with the <a class="reference internal" href="sqlelement.html#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> accessor (i.e.
597
<dt id="sqlalchemy.sql.functions.session_user">
598
<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>
599
<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>
600
<dl class="attribute">
601
<dt id="sqlalchemy.sql.functions.session_user.identifier">
602
<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>
605
<dl class="attribute">
606
<dt id="sqlalchemy.sql.functions.session_user.name">
607
<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>
610
<dl class="attribute">
611
<dt id="sqlalchemy.sql.functions.session_user.type">
612
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.session_user.type" title="Permalink to this definition">¶</a></dt>
613
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></p>
619
<dt id="sqlalchemy.sql.functions.sum">
620
<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>
621
<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>
622
<dl class="attribute">
623
<dt id="sqlalchemy.sql.functions.sum.identifier">
624
<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>
627
<dl class="attribute">
628
<dt id="sqlalchemy.sql.functions.sum.name">
629
<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>
635
<dt id="sqlalchemy.sql.functions.sysdate">
636
<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>
637
<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>
638
<dl class="attribute">
639
<dt id="sqlalchemy.sql.functions.sysdate.identifier">
640
<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>
643
<dl class="attribute">
644
<dt id="sqlalchemy.sql.functions.sysdate.name">
645
<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>
648
<dl class="attribute">
649
<dt id="sqlalchemy.sql.functions.sysdate.type">
650
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.sysdate.type" title="Permalink to this definition">¶</a></dt>
651
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">DateTime</span></tt></p>
657
<dt id="sqlalchemy.sql.functions.user">
658
<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>
659
<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>
660
<dl class="attribute">
661
<dt id="sqlalchemy.sql.functions.user.identifier">
662
<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>
665
<dl class="attribute">
666
<dt id="sqlalchemy.sql.functions.user.name">
667
<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>
670
<dl class="attribute">
671
<dt id="sqlalchemy.sql.functions.user.type">
672
<tt class="descname">type</tt><a class="headerlink" href="#sqlalchemy.sql.functions.user.type" title="Permalink to this definition">¶</a></dt>
673
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></p>
684
<div id="docs-bottom-navigation" class="docs-navigation-links">
686
<a href="dml.html" title="previous chapter">Insert, Updates, Deletes</a>
688
<a href="types.html" title="next chapter">Column and Data Types</a>
690
<div id="docs-copyright">
691
© <a href="../copyright.html">Copyright</a> 2007-2013, the SQLAlchemy authors and contributors.
692
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2b1.