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
Column Elements and Expressions
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="Selectables, Tables, FROM objects" href="selectable.html" />
38
<link rel="prev" title="SQL Statements and Expressions API" href="expression_api.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="expression_api.html" title="previous chapter">SQL Statements and Expressions API</a>
84
<a href="selectable.html" title="next chapter">Selectables, Tables, FROM objects</a>
88
<a href="../contents.html">Table of Contents</a> |
89
<a href="../genindex.html">Index</a>
90
| <a href="../_sources/core/sqlelement.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
Column Elements and Expressions
105
Column Elements and Expressions
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="#">Column Elements and Expressions</a></li>
121
<h4>Previous Topic</h4>
123
<a href="expression_api.html" title="previous chapter">SQL Statements and Expressions API</a>
127
<a href="selectable.html" title="next chapter">Selectables, Tables, FROM objects</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="column-elements-and-expressions"></span><h1>Column Elements and Expressions<a class="headerlink" href="#module-sqlalchemy.sql.expression" title="Permalink to this headline">¶</a></h1>
146
<p>The most fundamental part of the SQL expression API are the “column elements”,
147
which allow for basic SQL expression support. The core of all SQL expression
148
constructs is the <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>, which is the base for several
149
sub-branches. The <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> class is the fundamental unit
150
used to construct any kind of typed SQL expression.</p>
151
<dl class="function">
152
<dt id="sqlalchemy.sql.expression.and_">
153
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">and_</tt><big>(</big><em>*clauses</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.and_" title="Permalink to this definition">¶</a></dt>
154
<dd><p>Join a list of clauses together using the <tt class="docutils literal"><span class="pre">AND</span></tt> operator.</p>
155
<p>The <tt class="docutils literal"><span class="pre">&</span></tt> operator is also overloaded on all <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>
156
subclasses to produce the
160
<dl class="function">
161
<dt id="sqlalchemy.sql.expression.asc">
162
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">asc</tt><big>(</big><em>column</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.asc" title="Permalink to this definition">¶</a></dt>
163
<dd><p>Return an ascending <tt class="docutils literal"><span class="pre">ORDER</span> <span class="pre">BY</span></tt> clause element.</p>
165
<div class="highlight-python"><div class="highlight"><pre><span class="n">someselect</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="n">asc</span><span class="p">(</span><span class="n">table1</span><span class="o">.</span><span class="n">mycol</span><span class="p">))</span></pre></div>
168
<div class="highlight-python"><pre>ORDER BY mycol ASC</pre>
172
<dl class="function">
173
<dt id="sqlalchemy.sql.expression.between">
174
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">between</tt><big>(</big><em>ctest</em>, <em>cleft</em>, <em>cright</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.between" title="Permalink to this definition">¶</a></dt>
175
<dd><p>Return a <tt class="docutils literal"><span class="pre">BETWEEN</span></tt> predicate clause.</p>
176
<p>Equivalent of SQL <tt class="docutils literal"><span class="pre">clausetest</span> <span class="pre">BETWEEN</span> <span class="pre">clauseleft</span> <span class="pre">AND</span> <span class="pre">clauseright</span></tt>.</p>
177
<p>The <a class="reference internal" href="#sqlalchemy.sql.expression.between" title="sqlalchemy.sql.expression.between"><tt class="xref py py-func docutils literal"><span class="pre">between()</span></tt></a> method on all
178
<a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> subclasses provides
179
similar functionality.</p>
182
<dl class="function">
183
<dt id="sqlalchemy.sql.expression.bindparam">
184
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">bindparam</tt><big>(</big><em>key</em>, <em>value=<symbol 'NO_ARG></em>, <em>type_=None</em>, <em>unique=False</em>, <em>required=<symbol 'NO_ARG></em>, <em>quote=None</em>, <em>callable_=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.bindparam" title="Permalink to this definition">¶</a></dt>
185
<dd><p>Create a bind parameter clause with the given key.</p>
186
<table class="docutils field-list" frame="void" rules="none">
187
<col class="field-name" />
188
<col class="field-body" />
190
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
191
<li><strong>key</strong> – the key for this bind param. Will be used in the generated
192
SQL statement for dialects that use named parameters. This
193
value may be modified when part of a compilation operation,
194
if other <a class="reference internal" href="#sqlalchemy.sql.expression.BindParameter" title="sqlalchemy.sql.expression.BindParameter"><tt class="xref py py-class docutils literal"><span class="pre">BindParameter</span></tt></a> objects exist with the same
195
key, or if its length is too long and truncation is
197
<li><strong>value</strong> – <p>Initial value for this bind param. This value may be
198
overridden by the dictionary of parameters sent to statement
199
compilation/execution.</p>
200
<p>Defaults to <tt class="docutils literal"><span class="pre">None</span></tt>, however if neither <tt class="docutils literal"><span class="pre">value</span></tt> nor
201
<tt class="docutils literal"><span class="pre">callable</span></tt> are passed explicitly, the <tt class="docutils literal"><span class="pre">required</span></tt> flag will be
202
set to <tt class="docutils literal"><span class="pre">True</span></tt> which has the effect of requiring a value be present
203
when the statement is actually executed.</p>
204
<div class="versionchanged">
205
<p><span>Changed in version 0.8: </span>The <tt class="docutils literal"><span class="pre">required</span></tt> flag is set to <tt class="docutils literal"><span class="pre">True</span></tt>
206
automatically if <tt class="docutils literal"><span class="pre">value</span></tt> or <tt class="docutils literal"><span class="pre">callable</span></tt> is not passed.</p>
209
<li><strong>callable_</strong> – A callable function that takes the place of “value”. The function
210
will be called at statement execution time to determine the
211
ultimate value. Used for scenarios where the actual bind
212
value cannot be determined at the point at which the clause
213
construct is created, but embedded bind values are still desirable.</li>
214
<li><strong>type_</strong> – A <tt class="docutils literal"><span class="pre">TypeEngine</span></tt> object that will be used to pre-process the
215
value corresponding to this <a class="reference internal" href="#sqlalchemy.sql.expression.BindParameter" title="sqlalchemy.sql.expression.BindParameter"><tt class="xref py py-class docutils literal"><span class="pre">BindParameter</span></tt></a> at
217
<li><strong>unique</strong> – if True, the key name of this BindParamClause will be
218
modified if another <a class="reference internal" href="#sqlalchemy.sql.expression.BindParameter" title="sqlalchemy.sql.expression.BindParameter"><tt class="xref py py-class docutils literal"><span class="pre">BindParameter</span></tt></a> of the same name
219
already has been located within the containing
220
<a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>.</li>
221
<li><strong>required</strong> – <p>If <tt class="docutils literal"><span class="pre">True</span></tt>, a value is required at execution time. If not passed,
222
is set to <tt class="docutils literal"><span class="pre">True</span></tt> or <tt class="docutils literal"><span class="pre">False</span></tt> based on whether or not
223
one of <tt class="docutils literal"><span class="pre">value</span></tt> or <tt class="docutils literal"><span class="pre">callable</span></tt> were passed..</p>
224
<div class="versionchanged">
225
<p><span>Changed in version 0.8: </span>If the <tt class="docutils literal"><span class="pre">required</span></tt> flag is not specified,
226
it will be set automatically to <tt class="docutils literal"><span class="pre">True</span></tt> or <tt class="docutils literal"><span class="pre">False</span></tt> depending
227
on whether or not the <tt class="docutils literal"><span class="pre">value</span></tt> or <tt class="docutils literal"><span class="pre">callable</span></tt> parameters
231
<li><strong>quote</strong> – True if this parameter name requires quoting and is not
232
currently known as a SQLAlchemy reserved word; this currently
233
only applies to the Oracle backend.</li>
241
<dl class="function">
242
<dt id="sqlalchemy.sql.expression.case">
243
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">case</tt><big>(</big><em>whens</em>, <em>value=None</em>, <em>else_=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.case" title="Permalink to this definition">¶</a></dt>
244
<dd><p>Produce a <tt class="docutils literal"><span class="pre">CASE</span></tt> statement.</p>
245
<dl class="docutils">
247
<dd>A sequence of pairs, or alternatively a dict,
248
to be translated into “WHEN / THEN” clauses.</dd>
250
<dd>Optional for simple case statements, produces
251
a column expression as in “CASE <expr> WHEN ...”</dd>
253
<dd>Optional as well, for case defaults produces
254
the “ELSE” portion of the “CASE” statement.</dd>
256
<p>The expressions used for THEN and ELSE,
257
when specified as strings, will be interpreted
258
as bound values. To specify textual SQL expressions
259
for these, use the <a class="reference internal" href="#sqlalchemy.sql.expression.literal_column" title="sqlalchemy.sql.expression.literal_column"><tt class="xref py py-func docutils literal"><span class="pre">literal_column()</span></tt></a>
261
<p>The expressions used for the WHEN criterion
262
may only be literal strings when “value” is
263
present, i.e. CASE table.somecol WHEN “x” THEN “y”.
264
Otherwise, literal strings are not accepted
265
in this position, and either the text(<string>)
266
or literal(<string>) constructs must be used to
267
interpret raw string values.</p>
268
<p>Usage examples:</p>
269
<div class="highlight-python"><div class="highlight"><pre><span class="n">case</span><span class="p">([(</span><span class="n">orderline</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">qty</span> <span class="o">></span> <span class="mi">100</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">specialprice</span><span class="p">),</span>
270
<span class="p">(</span><span class="n">orderline</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">qty</span> <span class="o">></span> <span class="mi">10</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">bulkprice</span><span class="p">)</span>
271
<span class="p">],</span> <span class="n">else_</span><span class="o">=</span><span class="n">item</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">regularprice</span><span class="p">)</span>
272
<span class="n">case</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="n">emp</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="n">whens</span><span class="o">=</span><span class="p">{</span>
273
<span class="s">'engineer'</span><span class="p">:</span> <span class="n">emp</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">salary</span> <span class="o">*</span> <span class="mf">1.1</span><span class="p">,</span>
274
<span class="s">'manager'</span><span class="p">:</span> <span class="n">emp</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">salary</span> <span class="o">*</span> <span class="mi">3</span><span class="p">,</span>
275
<span class="p">})</span></pre></div>
277
<p>Using <a class="reference internal" href="#sqlalchemy.sql.expression.literal_column" title="sqlalchemy.sql.expression.literal_column"><tt class="xref py py-func docutils literal"><span class="pre">literal_column()</span></tt></a>, to allow for databases that
278
do not support bind parameters in the <tt class="docutils literal"><span class="pre">then</span></tt> clause. The type
279
can be specified which determines the type of the <a class="reference internal" href="#sqlalchemy.sql.expression.case" title="sqlalchemy.sql.expression.case"><tt class="xref py py-func docutils literal"><span class="pre">case()</span></tt></a> construct
281
<div class="highlight-python"><div class="highlight"><pre><span class="n">case</span><span class="p">([(</span><span class="n">orderline</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">qty</span> <span class="o">></span> <span class="mi">100</span><span class="p">,</span>
282
<span class="n">literal_column</span><span class="p">(</span><span class="s">"'greaterthan100'"</span><span class="p">,</span> <span class="n">String</span><span class="p">)),</span>
283
<span class="p">(</span><span class="n">orderline</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">qty</span> <span class="o">></span> <span class="mi">10</span><span class="p">,</span> <span class="n">literal_column</span><span class="p">(</span><span class="s">"'greaterthan10'"</span><span class="p">,</span>
284
<span class="n">String</span><span class="p">))</span>
285
<span class="p">],</span> <span class="n">else_</span><span class="o">=</span><span class="n">literal_column</span><span class="p">(</span><span class="s">"'lethan10'"</span><span class="p">,</span> <span class="n">String</span><span class="p">))</span></pre></div>
289
<dl class="function">
290
<dt id="sqlalchemy.sql.expression.cast">
291
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">cast</tt><big>(</big><em>clause</em>, <em>totype</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.cast" title="Permalink to this definition">¶</a></dt>
292
<dd><p>Return a <tt class="docutils literal"><span class="pre">CAST</span></tt> function.</p>
293
<p>Equivalent of SQL <tt class="docutils literal"><span class="pre">CAST(clause</span> <span class="pre">AS</span> <span class="pre">totype)</span></tt>.</p>
294
<p>Use with a <a class="reference internal" href="types.html#sqlalchemy.types.TypeEngine" title="sqlalchemy.types.TypeEngine"><tt class="xref py py-class docutils literal"><span class="pre">TypeEngine</span></tt></a> subclass, i.e:</p>
295
<div class="highlight-python"><div class="highlight"><pre><span class="n">cast</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">unit_price</span> <span class="o">*</span> <span class="n">table</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">qty</span><span class="p">,</span> <span class="n">Numeric</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mi">4</span><span class="p">))</span></pre></div>
298
<div class="highlight-python"><div class="highlight"><pre><span class="n">cast</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">timestamp</span><span class="p">,</span> <span class="n">DATE</span><span class="p">)</span></pre></div>
302
<dl class="function">
303
<dt id="sqlalchemy.sql.expression.column">
304
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">column</tt><big>(</big><em>text</em>, <em>type_=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.column" title="Permalink to this definition">¶</a></dt>
305
<dd><p>Return a textual column clause, as would be in the columns clause of a
306
<tt class="docutils literal"><span class="pre">SELECT</span></tt> statement.</p>
307
<p>The object returned is an instance of <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnClause" title="sqlalchemy.sql.expression.ColumnClause"><tt class="xref py py-class docutils literal"><span class="pre">ColumnClause</span></tt></a>, which
308
represents the “syntactical” portion of the schema-level
309
<a class="reference internal" href="metadata.html#sqlalchemy.schema.Column" title="sqlalchemy.schema.Column"><tt class="xref py py-class docutils literal"><span class="pre">Column</span></tt></a> object. It is often used directly
310
within <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> constructs or with lightweight
311
<a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.table" title="sqlalchemy.sql.expression.table"><tt class="xref py py-func docutils literal"><span class="pre">table()</span></tt></a> constructs.</p>
312
<p>Note that the <a class="reference internal" href="#sqlalchemy.sql.expression.column" title="sqlalchemy.sql.expression.column"><tt class="xref py py-func docutils literal"><span class="pre">column()</span></tt></a> function is not part of
313
the <tt class="docutils literal"><span class="pre">sqlalchemy</span></tt> namespace. It must be imported from the
314
<tt class="docutils literal"><span class="pre">sql</span></tt> package:</p>
315
<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">table</span><span class="p">,</span> <span class="n">column</span></pre></div>
317
<table class="docutils field-list" frame="void" rules="none">
318
<col class="field-name" />
319
<col class="field-body" />
321
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
322
<li><strong>text</strong> – the name of the column. Quoting rules will be applied
323
to the clause like any other column name. For textual column constructs
324
that are not to be quoted, use the <a class="reference internal" href="#sqlalchemy.sql.expression.literal_column" title="sqlalchemy.sql.expression.literal_column"><tt class="xref py py-func docutils literal"><span class="pre">literal_column()</span></tt></a> function.</li>
325
<li><strong>type_</strong> – an optional <a class="reference internal" href="types.html#sqlalchemy.types.TypeEngine" title="sqlalchemy.types.TypeEngine"><tt class="xref py py-class docutils literal"><span class="pre">TypeEngine</span></tt></a> object
326
which will provide result-set translation for this column.</li>
332
<p>See <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnClause" title="sqlalchemy.sql.expression.ColumnClause"><tt class="xref py py-class docutils literal"><span class="pre">ColumnClause</span></tt></a> for further examples.</p>
335
<dl class="function">
336
<dt id="sqlalchemy.sql.expression.collate">
337
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">collate</tt><big>(</big><em>expression</em>, <em>collation</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.collate" title="Permalink to this definition">¶</a></dt>
338
<dd><p>Return the clause <tt class="docutils literal"><span class="pre">expression</span> <span class="pre">COLLATE</span> <span class="pre">collation</span></tt>.</p>
340
<div class="highlight-python"><div class="highlight"><pre><span class="n">collate</span><span class="p">(</span><span class="n">mycolumn</span><span class="p">,</span> <span class="s">'utf8_bin'</span><span class="p">)</span></pre></div>
343
<div class="highlight-python"><pre>mycolumn COLLATE utf8_bin</pre>
347
<dl class="function">
348
<dt id="sqlalchemy.sql.expression.desc">
349
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">desc</tt><big>(</big><em>column</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.desc" title="Permalink to this definition">¶</a></dt>
350
<dd><p>Return a descending <tt class="docutils literal"><span class="pre">ORDER</span> <span class="pre">BY</span></tt> clause element.</p>
352
<div class="highlight-python"><div class="highlight"><pre><span class="n">someselect</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="n">desc</span><span class="p">(</span><span class="n">table1</span><span class="o">.</span><span class="n">mycol</span><span class="p">))</span></pre></div>
355
<div class="highlight-python"><pre>ORDER BY mycol DESC</pre>
359
<dl class="function">
360
<dt id="sqlalchemy.sql.expression.distinct">
361
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">distinct</tt><big>(</big><em>expr</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.distinct" title="Permalink to this definition">¶</a></dt>
362
<dd><p>Return a <tt class="docutils literal"><span class="pre">DISTINCT</span></tt> clause.</p>
364
<div class="highlight-python"><div class="highlight"><pre><span class="n">distinct</span><span class="p">(</span><span class="n">a</span><span class="p">)</span></pre></div>
367
<div class="highlight-python"><pre>DISTINCT a</pre>
371
<dl class="function">
372
<dt id="sqlalchemy.sql.expression.extract">
373
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">extract</tt><big>(</big><em>field</em>, <em>expr</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.extract" title="Permalink to this definition">¶</a></dt>
374
<dd><p>Return the clause <tt class="docutils literal"><span class="pre">extract(field</span> <span class="pre">FROM</span> <span class="pre">expr)</span></tt>.</p>
377
<dl class="function">
378
<dt id="sqlalchemy.sql.expression.false">
379
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">false</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.false" title="Permalink to this definition">¶</a></dt>
380
<dd><p>Return a <tt class="xref py py-class docutils literal"><span class="pre">False_</span></tt> object, which compiles to <tt class="docutils literal"><span class="pre">false</span></tt>, or the
381
boolean equivalent for the target dialect.</p>
385
<dt id="sqlalchemy.sql.expression.func">
386
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">func</tt><em class="property"> = <sqlalchemy.sql.expression._FunctionGenerator object at 0x10216cf90></em><a class="headerlink" href="#sqlalchemy.sql.expression.func" title="Permalink to this definition">¶</a></dt>
387
<dd><p>Generate SQL function expressions.</p>
388
<p><a class="reference internal" href="#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> is a special object instance which generates SQL
389
functions based on name-based attributes, e.g.:</p>
390
<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>
391
<span class="go">count(:param_1)</span></pre></div>
393
<p>The element is a column-oriented SQL element like any other, and is
394
used in that way:</p>
395
<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>
396
<span class="go">SELECT count(sometable.id) FROM sometable</span></pre></div>
398
<p>Any name can be given to <a class="reference internal" href="#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a>. If the function name is unknown to
399
SQLAlchemy, it will be rendered exactly as is. For common SQL functions
400
which SQLAlchemy is aware of, the name may be interpreted as a <em>generic
401
function</em> which will be compiled appropriately to the target database:</p>
402
<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>
403
<span class="go">CURRENT_TIMESTAMP</span></pre></div>
405
<p>To call functions which are present in dot-separated packages,
406
specify them in the same manner:</p>
407
<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>
408
<span class="go">stats.yield_curve(:yield_curve_1, :yield_curve_2)</span></pre></div>
410
<p>SQLAlchemy can be made aware of the return type of functions to enable
411
type-specific lexical and result-based behavior. For example, to ensure
412
that a string-based function returns a Unicode value and is similarly
413
treated as a string in expressions, specify
414
<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>
415
<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> \
416
<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>
417
<span class="go">my_string(:my_string_1) || :my_string_2 || my_string(:my_string_3)</span></pre></div>
419
<p>The object returned by a <a class="reference internal" href="#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> call is usually an instance of
420
<tt class="xref py py-class docutils literal"><span class="pre">Function</span></tt>.
421
This object meets the “column” interface, including comparison and labeling
422
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>
423
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
424
wrapped inside of a SELECT statement first:</p>
425
<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>
427
<p>In a few exception cases, the <a class="reference internal" href="#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
428
will redirect a name to a built-in expression such as <a class="reference internal" href="#sqlalchemy.sql.expression.cast" title="sqlalchemy.sql.expression.cast"><tt class="xref py py-func docutils literal"><span class="pre">cast()</span></tt></a>
429
or <a class="reference internal" href="#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
430
but are not exactly the same as “functions” from a SQLAlchemy
432
<div class="versionadded">
433
<p><span>New in version 0.8: </span><a class="reference internal" href="#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a> can return non-function expression
434
constructs for common quasi-functional names like <a class="reference internal" href="#sqlalchemy.sql.expression.cast" title="sqlalchemy.sql.expression.cast"><tt class="xref py py-func docutils literal"><span class="pre">cast()</span></tt></a>
435
and <a class="reference internal" href="#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>
437
<p>Functions which are interpreted as “generic” functions know how to
438
calculate their return type automatically. For a listing of known generic
439
functions, see <a class="reference internal" href="functions.html#generic-functions"><em>SQL and Generic Functions</em></a>.</p>
442
<dl class="function">
443
<dt id="sqlalchemy.sql.expression.label">
444
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">label</tt><big>(</big><em>name</em>, <em>obj</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.label" title="Permalink to this definition">¶</a></dt>
445
<dd><p>Return a <tt class="xref py py-class docutils literal"><span class="pre">Label</span></tt> object for the
446
given <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>.</p>
447
<p>A label changes the name of an element in the columns clause of a
448
<tt class="docutils literal"><span class="pre">SELECT</span></tt> statement, typically via the <tt class="docutils literal"><span class="pre">AS</span></tt> SQL keyword.</p>
449
<p>This functionality is more conveniently available via the
450
<a class="reference internal" href="#sqlalchemy.sql.expression.label" title="sqlalchemy.sql.expression.label"><tt class="xref py py-func docutils literal"><span class="pre">label()</span></tt></a> method on <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>.</p>
451
<dl class="docutils">
455
<dd>a <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>.</dd>
459
<dl class="function">
460
<dt id="sqlalchemy.sql.expression.literal">
461
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">literal</tt><big>(</big><em>value</em>, <em>type_=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.literal" title="Permalink to this definition">¶</a></dt>
462
<dd><p>Return a literal clause, bound to a bind parameter.</p>
463
<p>Literal clauses are created automatically when non- <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>
464
objects (such as strings, ints, dates, etc.) are used in a comparison
465
operation with a <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>
466
subclass, such as a <a class="reference internal" href="metadata.html#sqlalchemy.schema.Column" title="sqlalchemy.schema.Column"><tt class="xref py py-class docutils literal"><span class="pre">Column</span></tt></a> object.
467
Use this function to force the
468
generation of a literal clause, which will be created as a
469
<a class="reference internal" href="#sqlalchemy.sql.expression.BindParameter" title="sqlalchemy.sql.expression.BindParameter"><tt class="xref py py-class docutils literal"><span class="pre">BindParameter</span></tt></a> with a bound value.</p>
470
<table class="docutils field-list" frame="void" rules="none">
471
<col class="field-name" />
472
<col class="field-body" />
474
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
475
<li><strong>value</strong> – the value to be bound. Can be any Python object supported by
476
the underlying DB-API, or is translatable via the given type argument.</li>
477
<li><strong>type_</strong> – an optional <a class="reference internal" href="types.html#sqlalchemy.types.TypeEngine" title="sqlalchemy.types.TypeEngine"><tt class="xref py py-class docutils literal"><span class="pre">TypeEngine</span></tt></a> which
478
will provide bind-parameter translation for this literal.</li>
486
<dl class="function">
487
<dt id="sqlalchemy.sql.expression.literal_column">
488
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">literal_column</tt><big>(</big><em>text</em>, <em>type_=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.literal_column" title="Permalink to this definition">¶</a></dt>
489
<dd><p>Return a textual column expression, as would be in the columns
490
clause of a <tt class="docutils literal"><span class="pre">SELECT</span></tt> statement.</p>
491
<p>The object returned supports further expressions in the same way as any
492
other column object, including comparison, math and string operations.
493
The type_ parameter is important to determine proper expression behavior
494
(such as, ‘+’ means string concatenation or numerical addition based on
496
<table class="docutils field-list" frame="void" rules="none">
497
<col class="field-name" />
498
<col class="field-body" />
500
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
501
<li><strong>text</strong> – the text of the expression; can be any SQL expression.
502
Quoting rules will not be applied. To specify a column-name expression
503
which should be subject to quoting rules, use the <a class="reference internal" href="#sqlalchemy.sql.expression.column" title="sqlalchemy.sql.expression.column"><tt class="xref py py-func docutils literal"><span class="pre">column()</span></tt></a>
505
<li><strong>type_</strong> – an optional <a class="reference internal" href="types.html#sqlalchemy.types.TypeEngine" title="sqlalchemy.types.TypeEngine"><tt class="xref py py-class docutils literal"><span class="pre">TypeEngine</span></tt></a>
507
provide result-set translation and additional expression semantics for
508
this column. If left as None the type will be NullType.</li>
516
<dl class="function">
517
<dt id="sqlalchemy.sql.expression.not_">
518
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">not_</tt><big>(</big><em>clause</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.not_" title="Permalink to this definition">¶</a></dt>
519
<dd><p>Return a negation of the given clause, i.e. <tt class="docutils literal"><span class="pre">NOT(clause)</span></tt>.</p>
520
<p>The <tt class="docutils literal"><span class="pre">~</span></tt> operator is also overloaded on all
521
<a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> subclasses to produce the
525
<dl class="function">
526
<dt id="sqlalchemy.sql.expression.null">
527
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">null</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.null" title="Permalink to this definition">¶</a></dt>
528
<dd><p>Return a <tt class="xref py py-class docutils literal"><span class="pre">Null</span></tt> object, which compiles to <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
531
<dl class="function">
532
<dt id="sqlalchemy.sql.expression.nullsfirst">
533
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">nullsfirst</tt><big>(</big><em>column</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.nullsfirst" title="Permalink to this definition">¶</a></dt>
534
<dd><p>Return a NULLS FIRST <tt class="docutils literal"><span class="pre">ORDER</span> <span class="pre">BY</span></tt> clause element.</p>
536
<div class="highlight-python"><div class="highlight"><pre><span class="n">someselect</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="n">desc</span><span class="p">(</span><span class="n">table1</span><span class="o">.</span><span class="n">mycol</span><span class="p">)</span><span class="o">.</span><span class="n">nullsfirst</span><span class="p">())</span></pre></div>
539
<div class="highlight-python"><pre>ORDER BY mycol DESC NULLS FIRST</pre>
543
<dl class="function">
544
<dt id="sqlalchemy.sql.expression.nullslast">
545
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">nullslast</tt><big>(</big><em>column</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.nullslast" title="Permalink to this definition">¶</a></dt>
546
<dd><p>Return a NULLS LAST <tt class="docutils literal"><span class="pre">ORDER</span> <span class="pre">BY</span></tt> clause element.</p>
548
<div class="highlight-python"><div class="highlight"><pre><span class="n">someselect</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="n">desc</span><span class="p">(</span><span class="n">table1</span><span class="o">.</span><span class="n">mycol</span><span class="p">)</span><span class="o">.</span><span class="n">nullslast</span><span class="p">())</span></pre></div>
551
<div class="highlight-python"><pre>ORDER BY mycol DESC NULLS LAST</pre>
555
<dl class="function">
556
<dt id="sqlalchemy.sql.expression.or_">
557
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">or_</tt><big>(</big><em>*clauses</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.or_" title="Permalink to this definition">¶</a></dt>
558
<dd><p>Join a list of clauses together using the <tt class="docutils literal"><span class="pre">OR</span></tt> operator.</p>
559
<p>The <tt class="docutils literal"><span class="pre">|</span></tt> operator is also overloaded on all
560
<a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> subclasses to produce the
564
<dl class="function">
565
<dt id="sqlalchemy.sql.expression.outparam">
566
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">outparam</tt><big>(</big><em>key</em>, <em>type_=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.outparam" title="Permalink to this definition">¶</a></dt>
567
<dd><p>Create an ‘OUT’ parameter for usage in functions (stored procedures),
568
for databases which support them.</p>
569
<p>The <tt class="docutils literal"><span class="pre">outparam</span></tt> can be used like a regular function parameter.
570
The “output” value will be available from the
571
<a class="reference internal" href="connections.html#sqlalchemy.engine.ResultProxy" title="sqlalchemy.engine.ResultProxy"><tt class="xref py py-class docutils literal"><span class="pre">ResultProxy</span></tt></a> object via its <tt class="docutils literal"><span class="pre">out_parameters</span></tt>
572
attribute, which returns a dictionary containing the values.</p>
575
<dl class="function">
576
<dt id="sqlalchemy.sql.expression.over">
577
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">over</tt><big>(</big><em>func</em>, <em>partition_by=None</em>, <em>order_by=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.over" title="Permalink to this definition">¶</a></dt>
578
<dd><p>Produce an OVER clause against a function.</p>
579
<p>Used against aggregate or so-called “window” functions,
580
for database backends that support window functions.</p>
582
<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>
583
<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>
585
<p>Would produce “ROW_NUMBER() OVER(ORDER BY x)”.</p>
586
<table class="docutils field-list" frame="void" rules="none">
587
<col class="field-name" />
588
<col class="field-body" />
590
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
591
<li><strong>func</strong> – a <tt class="xref py py-class docutils literal"><span class="pre">FunctionElement</span></tt> construct, typically
592
generated by <a class="reference internal" href="#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a>.</li>
593
<li><strong>partition_by</strong> – a column element or string, or a list
594
of such, that will be used as the PARTITION BY clause
595
of the OVER construct.</li>
596
<li><strong>order_by</strong> – a column element or string, or a list
597
of such, that will be used as the ORDER BY clause
598
of the OVER construct.</li>
604
<p>This function is also available from the <a class="reference internal" href="#sqlalchemy.sql.expression.func" title="sqlalchemy.sql.expression.func"><tt class="xref py py-data docutils literal"><span class="pre">func</span></tt></a>
605
construct itself via the <tt class="xref py py-meth docutils literal"><span class="pre">FunctionElement.over()</span></tt> method.</p>
606
<div class="versionadded">
607
<p><span>New in version 0.7.</span></p>
611
<dl class="function">
612
<dt id="sqlalchemy.sql.expression.text">
613
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">text</tt><big>(</big><em>text</em>, <em>bind=None</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.text" title="Permalink to this definition">¶</a></dt>
614
<dd><p>Create a SQL construct that is represented by a literal string.</p>
616
<div class="highlight-python"><div class="highlight"><pre><span class="n">t</span> <span class="o">=</span> <span class="n">text</span><span class="p">(</span><span class="s">"SELECT * FROM users"</span><span class="p">)</span>
617
<span class="n">result</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">t</span><span class="p">)</span></pre></div>
619
<p>The advantages <a class="reference internal" href="#sqlalchemy.sql.expression.text" title="sqlalchemy.sql.expression.text"><tt class="xref py py-func docutils literal"><span class="pre">text()</span></tt></a> provides over a plain string are
620
backend-neutral support for bind parameters, per-statement
621
execution options, as well as
622
bind parameter and result-column typing behavior, allowing
623
SQLAlchemy type constructs to play a role when executing
624
a statement that is specified literally.</p>
625
<p>Bind parameters are specified by name, using the format <tt class="docutils literal"><span class="pre">:name</span></tt>.
627
<div class="highlight-python"><div class="highlight"><pre><span class="n">t</span> <span class="o">=</span> <span class="n">text</span><span class="p">(</span><span class="s">"SELECT * FROM users WHERE id=:user_id"</span><span class="p">)</span>
628
<span class="n">result</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">user_id</span><span class="o">=</span><span class="mi">12</span><span class="p">)</span></pre></div>
630
<p>To invoke SQLAlchemy typing logic for bind parameters, the
631
<tt class="docutils literal"><span class="pre">bindparams</span></tt> list allows specification of <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a>
632
constructs which specify the type for a given name:</p>
633
<div class="highlight-python"><div class="highlight"><pre><span class="n">t</span> <span class="o">=</span> <span class="n">text</span><span class="p">(</span><span class="s">"SELECT id FROM users WHERE updated_at>:updated"</span><span class="p">,</span>
634
<span class="n">bindparams</span><span class="o">=</span><span class="p">[</span><span class="n">bindparam</span><span class="p">(</span><span class="s">'updated'</span><span class="p">,</span> <span class="n">DateTime</span><span class="p">())]</span>
635
<span class="p">)</span></pre></div>
637
<p>Typing during result row processing is also an important concern.
639
are specified using the <tt class="docutils literal"><span class="pre">typemap</span></tt> dictionary, where the keys
640
match the names of columns. These names are taken from what
641
the DBAPI returns as <tt class="docutils literal"><span class="pre">cursor.description</span></tt>:</p>
642
<div class="highlight-python"><div class="highlight"><pre><span class="n">t</span> <span class="o">=</span> <span class="n">text</span><span class="p">(</span><span class="s">"SELECT id, name FROM users"</span><span class="p">,</span>
643
<span class="n">typemap</span><span class="o">=</span><span class="p">{</span>
644
<span class="s">'id'</span><span class="p">:</span><span class="n">Integer</span><span class="p">,</span>
645
<span class="s">'name'</span><span class="p">:</span><span class="n">Unicode</span>
646
<span class="p">}</span>
647
<span class="p">)</span></pre></div>
649
<p>The <a class="reference internal" href="#sqlalchemy.sql.expression.text" title="sqlalchemy.sql.expression.text"><tt class="xref py py-func docutils literal"><span class="pre">text()</span></tt></a> construct is used internally for most cases when
650
a literal string is specified for part of a larger query, such as
651
within <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>, <a class="reference internal" href="dml.html#sqlalchemy.sql.expression.update" title="sqlalchemy.sql.expression.update"><tt class="xref py py-func docutils literal"><span class="pre">update()</span></tt></a>,
652
<a class="reference internal" href="dml.html#sqlalchemy.sql.expression.insert" title="sqlalchemy.sql.expression.insert"><tt class="xref py py-func docutils literal"><span class="pre">insert()</span></tt></a> or <a class="reference internal" href="dml.html#sqlalchemy.sql.expression.delete" title="sqlalchemy.sql.expression.delete"><tt class="xref py py-func docutils literal"><span class="pre">delete()</span></tt></a>. In those cases, the same
653
bind parameter syntax is applied:</p>
654
<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">users</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="n">users</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">name</span><span class="p">])</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="s">"id=:user_id"</span><span class="p">)</span>
655
<span class="n">result</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">user_id</span><span class="o">=</span><span class="mi">12</span><span class="p">)</span></pre></div>
657
<p>Using <a class="reference internal" href="#sqlalchemy.sql.expression.text" title="sqlalchemy.sql.expression.text"><tt class="xref py py-func docutils literal"><span class="pre">text()</span></tt></a> explicitly usually implies the construction
658
of a full, standalone statement. As such, SQLAlchemy refers
659
to it as an <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">Executable</span></tt></a> object, and it supports
660
the <a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.Executable.execution_options" title="sqlalchemy.sql.expression.Executable.execution_options"><tt class="xref py py-meth docutils literal"><span class="pre">Executable.execution_options()</span></tt></a> method. For example,
661
a <a class="reference internal" href="#sqlalchemy.sql.expression.text" title="sqlalchemy.sql.expression.text"><tt class="xref py py-func docutils literal"><span class="pre">text()</span></tt></a> construct that should be subject to “autocommit”
662
can be set explicitly so using the <tt class="docutils literal"><span class="pre">autocommit</span></tt> option:</p>
663
<div class="highlight-python"><div class="highlight"><pre><span class="n">t</span> <span class="o">=</span> <span class="n">text</span><span class="p">(</span><span class="s">"EXEC my_procedural_thing()"</span><span class="p">)</span><span class="o">.</span>\
664
<span class="n">execution_options</span><span class="p">(</span><span class="n">autocommit</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span></pre></div>
666
<p>Note that SQLAlchemy’s usual “autocommit” behavior applies to
667
<a class="reference internal" href="#sqlalchemy.sql.expression.text" title="sqlalchemy.sql.expression.text"><tt class="xref py py-func docutils literal"><span class="pre">text()</span></tt></a> constructs - that is, statements which begin
668
with a phrase such as <tt class="docutils literal"><span class="pre">INSERT</span></tt>, <tt class="docutils literal"><span class="pre">UPDATE</span></tt>, <tt class="docutils literal"><span class="pre">DELETE</span></tt>,
669
or a variety of other phrases specific to certain backends, will
670
be eligible for autocommit if no transaction is in progress.</p>
671
<table class="docutils field-list" frame="void" rules="none">
672
<col class="field-name" />
673
<col class="field-body" />
675
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
676
<li><strong>text</strong> – the text of the SQL statement to be created. use <tt class="docutils literal"><span class="pre">:<param></span></tt>
677
to specify bind parameters; they will be compiled to their
678
engine-specific format.</li>
679
<li><strong>autocommit</strong> – Deprecated. Use .execution_options(autocommit=<True|False>)
680
to set the autocommit option.</li>
681
<li><strong>bind</strong> – an optional connection or engine to be used for this text query.</li>
682
<li><strong>bindparams</strong> – a list of <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a> instances which can be used to define
683
the types and/or initial values for the bind parameters within
684
the textual statement; the keynames of the bindparams must match
685
those within the text of the statement. The types will be used
686
for pre-processing on bind values.</li>
687
<li><strong>typemap</strong> – a dictionary mapping the names of columns represented in the
688
columns clause of a <tt class="docutils literal"><span class="pre">SELECT</span></tt> statement to type objects,
689
which will be used to perform post-processing on columns within
690
the result set. This argument applies to any expression
691
that returns result sets.</li>
699
<dl class="function">
700
<dt id="sqlalchemy.sql.expression.true">
701
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">true</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.true" title="Permalink to this definition">¶</a></dt>
702
<dd><p>Return a <tt class="xref py py-class docutils literal"><span class="pre">True_</span></tt> object, which compiles to <tt class="docutils literal"><span class="pre">true</span></tt>, or the
703
boolean equivalent for the target dialect.</p>
706
<dl class="function">
707
<dt id="sqlalchemy.sql.expression.tuple_">
708
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">tuple_</tt><big>(</big><em>*expr</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.tuple_" title="Permalink to this definition">¶</a></dt>
709
<dd><p>Return a SQL tuple.</p>
710
<p>Main usage is to produce a composite IN construct:</p>
711
<div class="highlight-python"><div class="highlight"><pre><span class="n">tuple_</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">col1</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">col2</span><span class="p">)</span><span class="o">.</span><span class="n">in_</span><span class="p">(</span>
712
<span class="p">[(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">12</span><span class="p">),</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">19</span><span class="p">)]</span>
713
<span class="p">)</span></pre></div>
715
<div class="admonition warning">
716
<p class="first admonition-title">Warning</p>
717
<p class="last">The composite IN construct is not supported by all backends,
718
and is currently known to work on Postgresql and MySQL,
719
but not SQLite. Unsupported backends will raise
720
a subclass of <a class="reference internal" href="exceptions.html#sqlalchemy.exc.DBAPIError" title="sqlalchemy.exc.DBAPIError"><tt class="xref py py-class docutils literal"><span class="pre">DBAPIError</span></tt></a> when such
721
an expression is invoked.</p>
725
<dl class="function">
726
<dt id="sqlalchemy.sql.expression.type_coerce">
727
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">type_coerce</tt><big>(</big><em>expr</em>, <em>type_</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.type_coerce" title="Permalink to this definition">¶</a></dt>
728
<dd><p>Coerce the given expression into the given type,
729
on the Python side only.</p>
730
<p><a class="reference internal" href="#sqlalchemy.sql.expression.type_coerce" title="sqlalchemy.sql.expression.type_coerce"><tt class="xref py py-func docutils literal"><span class="pre">type_coerce()</span></tt></a> is roughly similar to <a class="reference internal" href="#sqlalchemy.sql.expression.cast" title="sqlalchemy.sql.expression.cast"><tt class="xref py py-func docutils literal"><span class="pre">cast()</span></tt></a>, except no
731
“CAST” expression is rendered - the given type is only applied towards
732
expression typing and against received result values.</p>
734
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy.types</span> <span class="kn">import</span> <span class="n">TypeDecorator</span>
735
<span class="kn">import</span> <span class="nn">uuid</span>
737
<span class="k">class</span> <span class="nc">AsGuid</span><span class="p">(</span><span class="n">TypeDecorator</span><span class="p">):</span>
738
<span class="n">impl</span> <span class="o">=</span> <span class="n">String</span>
740
<span class="k">def</span> <span class="nf">process_bind_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">dialect</span><span class="p">):</span>
741
<span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
742
<span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
743
<span class="k">else</span><span class="p">:</span>
744
<span class="k">return</span> <span class="bp">None</span>
746
<span class="k">def</span> <span class="nf">process_result_value</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">dialect</span><span class="p">):</span>
747
<span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
748
<span class="k">return</span> <span class="n">uuid</span><span class="o">.</span><span class="n">UUID</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
749
<span class="k">else</span><span class="p">:</span>
750
<span class="k">return</span> <span class="bp">None</span>
752
<span class="n">conn</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span>
753
<span class="n">select</span><span class="p">([</span><span class="n">type_coerce</span><span class="p">(</span><span class="n">mytable</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">ident</span><span class="p">,</span> <span class="n">AsGuid</span><span class="p">)])</span><span class="o">.</span>\
754
<span class="n">where</span><span class="p">(</span>
755
<span class="n">type_coerce</span><span class="p">(</span><span class="n">mytable</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">ident</span><span class="p">,</span> <span class="n">AsGuid</span><span class="p">)</span> <span class="o">==</span>
756
<span class="n">uuid</span><span class="o">.</span><span class="n">uuid3</span><span class="p">(</span><span class="n">uuid</span><span class="o">.</span><span class="n">NAMESPACE_URL</span><span class="p">,</span> <span class="s">'bar'</span><span class="p">)</span>
757
<span class="p">)</span>
758
<span class="p">)</span></pre></div>
763
<dt id="sqlalchemy.sql.expression.BinaryExpression">
764
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">BinaryExpression</tt><big>(</big><em>left</em>, <em>right</em>, <em>operator</em>, <em>type_=None</em>, <em>negate=None</em>, <em>modifiers=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BinaryExpression" title="Permalink to this definition">¶</a></dt>
765
<dd><p>Bases: <a class="reference internal" href="#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></p>
766
<p>Represent an expression that is <tt class="docutils literal"><span class="pre">LEFT</span> <span class="pre"><operator></span> <span class="pre">RIGHT</span></tt>.</p>
767
<p>A <a class="reference internal" href="#sqlalchemy.sql.expression.BinaryExpression" title="sqlalchemy.sql.expression.BinaryExpression"><tt class="xref py py-class docutils literal"><span class="pre">BinaryExpression</span></tt></a> is generated automatically
768
whenever two column expressions are used in a Python binary expresion:</p>
769
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlalchemy.sql</span> <span class="kn">import</span> <span class="n">column</span>
770
<span class="gp">>>> </span><span class="n">column</span><span class="p">(</span><span class="s">'a'</span><span class="p">)</span> <span class="o">+</span> <span class="n">column</span><span class="p">(</span><span class="s">'b'</span><span class="p">)</span>
771
<span class="go"><sqlalchemy.sql.expression.BinaryExpression object at 0x101029dd0></span>
772
<span class="gp">>>> </span><span class="k">print</span> <span class="n">column</span><span class="p">(</span><span class="s">'a'</span><span class="p">)</span> <span class="o">+</span> <span class="n">column</span><span class="p">(</span><span class="s">'b'</span><span class="p">)</span>
773
<span class="go">a + b</span></pre></div>
775
<table class="docutils field-list" frame="void" rules="none">
776
<col class="field-name" />
777
<col class="field-body" />
779
<tr class="field-odd field"><th class="field-name" colspan="2">Inherited-members :</th></tr>
780
<tr class="field-odd field"><td> </td><td class="field-body"></td>
785
<dt id="sqlalchemy.sql.expression.BinaryExpression.compare">
786
<tt class="descname">compare</tt><big>(</big><em>other</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BinaryExpression.compare" title="Permalink to this definition">¶</a></dt>
787
<dd><p>Compare this <a class="reference internal" href="#sqlalchemy.sql.expression.BinaryExpression" title="sqlalchemy.sql.expression.BinaryExpression"><tt class="xref py py-class docutils literal"><span class="pre">BinaryExpression</span></tt></a> against the
788
given <a class="reference internal" href="#sqlalchemy.sql.expression.BinaryExpression" title="sqlalchemy.sql.expression.BinaryExpression"><tt class="xref py py-class docutils literal"><span class="pre">BinaryExpression</span></tt></a>.</p>
794
<dt id="sqlalchemy.sql.expression.BindParameter">
795
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">BindParameter</tt><big>(</big><em>key</em>, <em>value</em>, <em>type_=None</em>, <em>unique=False</em>, <em>callable_=None</em>, <em>isoutparam=False</em>, <em>required=False</em>, <em>quote=None</em>, <em>_compared_to_operator=None</em>, <em>_compared_to_type=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter" title="Permalink to this definition">¶</a></dt>
796
<dd><p>Bases: <a class="reference internal" href="#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></p>
797
<p>Represent a bind parameter.</p>
798
<p>Public constructor is the <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a> function.</p>
800
<dt id="sqlalchemy.sql.expression.BindParameter.__eq__">
801
<tt class="descname">__eq__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.__eq__" title="Permalink to this definition">¶</a></dt>
802
<dd><div class="inherited-member container">
803
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__eq__" title="sqlalchemy.sql.operators.ColumnOperators.__eq__"><tt class="xref py py-meth docutils literal"><span class="pre">__eq__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
804
<p>Implement the <tt class="docutils literal"><span class="pre">==</span></tt> operator.</p>
805
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">=</span> <span class="pre">b</span></tt>.
806
If the target is <tt class="docutils literal"><span class="pre">None</span></tt>, produces <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IS</span> <span class="pre">NULL</span></tt>.</p>
810
<dt id="sqlalchemy.sql.expression.BindParameter.__init__">
811
<tt class="descname">__init__</tt><big>(</big><em>key</em>, <em>value</em>, <em>type_=None</em>, <em>unique=False</em>, <em>callable_=None</em>, <em>isoutparam=False</em>, <em>required=False</em>, <em>quote=None</em>, <em>_compared_to_operator=None</em>, <em>_compared_to_type=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.__init__" title="Permalink to this definition">¶</a></dt>
812
<dd><p>Construct a BindParameter.</p>
813
<table class="docutils field-list" frame="void" rules="none">
814
<col class="field-name" />
815
<col class="field-body" />
817
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
818
<li><strong>key</strong> – the key for this bind param. Will be used in the generated
819
SQL statement for dialects that use named parameters. This
820
value may be modified when part of a compilation operation,
821
if other <a class="reference internal" href="#sqlalchemy.sql.expression.BindParameter" title="sqlalchemy.sql.expression.BindParameter"><tt class="xref py py-class docutils literal"><span class="pre">BindParameter</span></tt></a> objects exist with the same
822
key, or if its length is too long and truncation is
824
<li><strong>value</strong> – Initial value for this bind param. This value may be
825
overridden by the dictionary of parameters sent to statement
826
compilation/execution.</li>
827
<li><strong>callable_</strong> – A callable function that takes the place of “value”. The function
828
will be called at statement execution time to determine the
829
ultimate value. Used for scenarios where the actual bind
830
value cannot be determined at the point at which the clause
831
construct is created, but embedded bind values are still desirable.</li>
832
<li><strong>type_</strong> – A <tt class="docutils literal"><span class="pre">TypeEngine</span></tt> object that will be used to pre-process the
833
value corresponding to this <a class="reference internal" href="#sqlalchemy.sql.expression.BindParameter" title="sqlalchemy.sql.expression.BindParameter"><tt class="xref py py-class docutils literal"><span class="pre">BindParameter</span></tt></a> at
835
<li><strong>unique</strong> – if True, the key name of this BindParamClause will be
836
modified if another <a class="reference internal" href="#sqlalchemy.sql.expression.BindParameter" title="sqlalchemy.sql.expression.BindParameter"><tt class="xref py py-class docutils literal"><span class="pre">BindParameter</span></tt></a> of the same name
837
already has been located within the containing
838
<a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>.</li>
839
<li><strong>quote</strong> – True if this parameter name requires quoting and is not
840
currently known as a SQLAlchemy reserved word; this currently
841
only applies to the Oracle backend.</li>
842
<li><strong>required</strong> – a value is required at execution time.</li>
843
<li><strong>isoutparam</strong> – if True, the parameter should be treated like a stored procedure
844
“OUT” parameter.</li>
853
<dt id="sqlalchemy.sql.expression.BindParameter.__le__">
854
<tt class="descname">__le__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.__le__" title="Permalink to this definition">¶</a></dt>
855
<dd><div class="inherited-member container">
856
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__le__" title="sqlalchemy.sql.operators.ColumnOperators.__le__"><tt class="xref py py-meth docutils literal"><span class="pre">__le__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
857
<p>Implement the <tt class="docutils literal"><span class="pre"><=</span></tt> operator.</p>
858
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre"><=</span> <span class="pre">b</span></tt>.</p>
862
<dt id="sqlalchemy.sql.expression.BindParameter.__lt__">
863
<tt class="descname">__lt__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.__lt__" title="Permalink to this definition">¶</a></dt>
864
<dd><div class="inherited-member container">
865
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__lt__" title="sqlalchemy.sql.operators.ColumnOperators.__lt__"><tt class="xref py py-meth docutils literal"><span class="pre">__lt__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
866
<p>Implement the <tt class="docutils literal"><span class="pre"><</span></tt> operator.</p>
867
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre"><</span> <span class="pre">b</span></tt>.</p>
871
<dt id="sqlalchemy.sql.expression.BindParameter.__ne__">
872
<tt class="descname">__ne__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.__ne__" title="Permalink to this definition">¶</a></dt>
873
<dd><div class="inherited-member container">
874
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__ne__" title="sqlalchemy.sql.operators.ColumnOperators.__ne__"><tt class="xref py py-meth docutils literal"><span class="pre">__ne__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
875
<p>Implement the <tt class="docutils literal"><span class="pre">!=</span></tt> operator.</p>
876
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">!=</span> <span class="pre">b</span></tt>.
877
If the target is <tt class="docutils literal"><span class="pre">None</span></tt>, produces <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IS</span> <span class="pre">NOT</span> <span class="pre">NULL</span></tt>.</p>
880
<dl class="attribute">
881
<dt id="sqlalchemy.sql.expression.BindParameter.anon_label">
882
<tt class="descname">anon_label</tt><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.anon_label" title="Permalink to this definition">¶</a></dt>
883
<dd><div class="inherited-member container">
884
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement.anon_label" title="sqlalchemy.sql.expression.ColumnElement.anon_label"><tt class="xref py py-attr docutils literal"><span class="pre">anon_label</span></tt></a> <em>attribute of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a></div>
885
<p>provides a constant ‘anonymous label’ for this ColumnElement.</p>
886
<p>This is a label() expression which will be named at compile time.
887
The same label() is returned each time anon_label is called so
888
that expressions can reference anon_label multiple times, producing
889
the same label name at compile time.</p>
890
<p>the compiler uses this function automatically at compile time
891
for expressions that are known to be ‘unnamed’ like binary
892
expressions and function calls.</p>
896
<dt id="sqlalchemy.sql.expression.BindParameter.asc">
897
<tt class="descname">asc</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.asc" title="Permalink to this definition">¶</a></dt>
898
<dd><div class="inherited-member container">
899
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.asc" title="sqlalchemy.sql.operators.ColumnOperators.asc"><tt class="xref py py-meth docutils literal"><span class="pre">asc()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
900
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.asc" title="sqlalchemy.sql.expression.asc"><tt class="xref py py-func docutils literal"><span class="pre">asc()</span></tt></a> clause against the
905
<dt id="sqlalchemy.sql.expression.BindParameter.between">
906
<tt class="descname">between</tt><big>(</big><em>cleft</em>, <em>cright</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.between" title="Permalink to this definition">¶</a></dt>
907
<dd><div class="inherited-member container">
908
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.between" title="sqlalchemy.sql.operators.ColumnOperators.between"><tt class="xref py py-meth docutils literal"><span class="pre">between()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
909
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.between" title="sqlalchemy.sql.expression.between"><tt class="xref py py-func docutils literal"><span class="pre">between()</span></tt></a> clause against
910
the parent object, given the lower and upper range.</p>
914
<dt id="sqlalchemy.sql.expression.BindParameter.collate">
915
<tt class="descname">collate</tt><big>(</big><em>collation</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.collate" title="Permalink to this definition">¶</a></dt>
916
<dd><div class="inherited-member container">
917
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.collate" title="sqlalchemy.sql.operators.ColumnOperators.collate"><tt class="xref py py-meth docutils literal"><span class="pre">collate()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
918
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.collate" title="sqlalchemy.sql.expression.collate"><tt class="xref py py-func docutils literal"><span class="pre">collate()</span></tt></a> clause against
919
the parent object, given the collation string.</p>
923
<dt id="sqlalchemy.sql.expression.BindParameter.compare">
924
<tt class="descname">compare</tt><big>(</big><em>other</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.compare" title="Permalink to this definition">¶</a></dt>
925
<dd><p>Compare this <a class="reference internal" href="#sqlalchemy.sql.expression.BindParameter" title="sqlalchemy.sql.expression.BindParameter"><tt class="xref py py-class docutils literal"><span class="pre">BindParameter</span></tt></a> to the given
930
<dt id="sqlalchemy.sql.expression.BindParameter.compile">
931
<tt class="descname">compile</tt><big>(</big><em>bind=None</em>, <em>dialect=None</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.compile" title="Permalink to this definition">¶</a></dt>
932
<dd><div class="inherited-member container">
933
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.compile" title="sqlalchemy.sql.expression.ClauseElement.compile"><tt class="xref py py-meth docutils literal"><span class="pre">compile()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
934
<p>Compile this SQL expression.</p>
935
<p>The return value is a <a class="reference internal" href="internals.html#sqlalchemy.engine.interfaces.Compiled" title="sqlalchemy.engine.interfaces.Compiled"><tt class="xref py py-class docutils literal"><span class="pre">Compiled</span></tt></a> object.
936
Calling <tt class="docutils literal"><span class="pre">str()</span></tt> or <tt class="docutils literal"><span class="pre">unicode()</span></tt> on the returned value will yield a
937
string representation of the result. The
938
<a class="reference internal" href="internals.html#sqlalchemy.engine.interfaces.Compiled" title="sqlalchemy.engine.interfaces.Compiled"><tt class="xref py py-class docutils literal"><span class="pre">Compiled</span></tt></a> object also can return a
939
dictionary of bind parameter names and values
940
using the <tt class="docutils literal"><span class="pre">params</span></tt> accessor.</p>
941
<table class="docutils field-list" frame="void" rules="none">
942
<col class="field-name" />
943
<col class="field-body" />
945
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
946
<li><strong>bind</strong> – An <tt class="docutils literal"><span class="pre">Engine</span></tt> or <tt class="docutils literal"><span class="pre">Connection</span></tt> from which a
947
<tt class="docutils literal"><span class="pre">Compiled</span></tt> will be acquired. This argument takes precedence over
948
this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>‘s bound engine, if any.</li>
949
<li><strong>column_keys</strong> – Used for INSERT and UPDATE statements, a list of
950
column names which should be present in the VALUES clause of the
951
compiled statement. If <tt class="docutils literal"><span class="pre">None</span></tt>, all columns from the target table
952
object are rendered.</li>
953
<li><strong>dialect</strong> – A <tt class="docutils literal"><span class="pre">Dialect</span></tt> instance from which a <tt class="docutils literal"><span class="pre">Compiled</span></tt>
954
will be acquired. This argument takes precedence over the <cite>bind</cite>
955
argument as well as this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>‘s bound engine, if
957
<li><strong>inline</strong> – Used for INSERT statements, for a dialect which does
958
not support inline retrieval of newly generated primary key
959
columns, will force the expression used to create the new primary
960
key value to be rendered inline within the INSERT statement’s
961
VALUES clause. This typically refers to Sequence execution but may
962
also refer to any server-side default generation function
963
associated with a primary key <cite>Column</cite>.</li>
972
<dt id="sqlalchemy.sql.expression.BindParameter.concat">
973
<tt class="descname">concat</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.concat" title="Permalink to this definition">¶</a></dt>
974
<dd><div class="inherited-member container">
975
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.concat" title="sqlalchemy.sql.operators.ColumnOperators.concat"><tt class="xref py py-meth docutils literal"><span class="pre">concat()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
976
<p>Implement the ‘concat’ operator.</p>
977
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">||</span> <span class="pre">b</span></tt>,
978
or uses the <tt class="docutils literal"><span class="pre">concat()</span></tt> operator on MySQL.</p>
982
<dt id="sqlalchemy.sql.expression.BindParameter.contains">
983
<tt class="descname">contains</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.contains" title="Permalink to this definition">¶</a></dt>
984
<dd><div class="inherited-member container">
985
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.contains" title="sqlalchemy.sql.operators.ColumnOperators.contains"><tt class="xref py py-meth docutils literal"><span class="pre">contains()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
986
<p>Implement the ‘contains’ operator.</p>
987
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%<other>%'</span></tt></p>
991
<dt id="sqlalchemy.sql.expression.BindParameter.desc">
992
<tt class="descname">desc</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.desc" title="Permalink to this definition">¶</a></dt>
993
<dd><div class="inherited-member container">
994
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.desc" title="sqlalchemy.sql.operators.ColumnOperators.desc"><tt class="xref py py-meth docutils literal"><span class="pre">desc()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
995
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.desc" title="sqlalchemy.sql.expression.desc"><tt class="xref py py-func docutils literal"><span class="pre">desc()</span></tt></a> clause against the
1000
<dt id="sqlalchemy.sql.expression.BindParameter.distinct">
1001
<tt class="descname">distinct</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.distinct" title="Permalink to this definition">¶</a></dt>
1002
<dd><div class="inherited-member container">
1003
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.distinct" title="sqlalchemy.sql.operators.ColumnOperators.distinct"><tt class="xref py py-meth docutils literal"><span class="pre">distinct()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1004
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.distinct" title="sqlalchemy.sql.expression.distinct"><tt class="xref py py-func docutils literal"><span class="pre">distinct()</span></tt></a> clause against the
1008
<dl class="attribute">
1009
<dt id="sqlalchemy.sql.expression.BindParameter.effective_value">
1010
<tt class="descname">effective_value</tt><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.effective_value" title="Permalink to this definition">¶</a></dt>
1011
<dd><p>Return the value of this bound parameter,
1012
taking into account if the <tt class="docutils literal"><span class="pre">callable</span></tt> parameter
1014
<p>The <tt class="docutils literal"><span class="pre">callable</span></tt> value will be evaluated
1015
and returned if present, else <tt class="docutils literal"><span class="pre">value</span></tt>.</p>
1019
<dt id="sqlalchemy.sql.expression.BindParameter.endswith">
1020
<tt class="descname">endswith</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.endswith" title="Permalink to this definition">¶</a></dt>
1021
<dd><div class="inherited-member container">
1022
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.endswith" title="sqlalchemy.sql.operators.ColumnOperators.endswith"><tt class="xref py py-meth docutils literal"><span class="pre">endswith()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1023
<p>Implement the ‘endswith’ operator.</p>
1024
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%<other>'</span></tt></p>
1027
<dl class="attribute">
1028
<dt id="sqlalchemy.sql.expression.BindParameter.expression">
1029
<tt class="descname">expression</tt><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.expression" title="Permalink to this definition">¶</a></dt>
1030
<dd><div class="inherited-member container">
1031
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement.expression" title="sqlalchemy.sql.expression.ColumnElement.expression"><tt class="xref py py-attr docutils literal"><span class="pre">expression</span></tt></a> <em>attribute of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a></div>
1032
<p>Return a column expression.</p>
1033
<p>Part of the inspection interface; returns self.</p>
1037
<dt id="sqlalchemy.sql.expression.BindParameter.get_children">
1038
<tt class="descname">get_children</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.get_children" title="Permalink to this definition">¶</a></dt>
1039
<dd><div class="inherited-member container">
1040
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.get_children" title="sqlalchemy.sql.expression.ClauseElement.get_children"><tt class="xref py py-meth docutils literal"><span class="pre">get_children()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
1041
<p>Return immediate child elements of this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>.</p>
1042
<p>This is used for visit traversal.</p>
1043
<p>**kwargs may contain flags that change the collection that is
1044
returned, for example to return a subset of items in order to
1045
cut down on larger traversals, or to return child items from a
1046
different context (such as schema-level collections instead of
1051
<dt id="sqlalchemy.sql.expression.BindParameter.ilike">
1052
<tt class="descname">ilike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.ilike" title="Permalink to this definition">¶</a></dt>
1053
<dd><div class="inherited-member container">
1054
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ilike()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1055
<p>Implement the <tt class="docutils literal"><span class="pre">ilike</span></tt> operator.</p>
1056
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">ILIKE</span> <span class="pre">other</span></tt>.</p>
1058
<div class="highlight-python"><div class="highlight"><pre><span class="n">select</span><span class="p">([</span><span class="n">sometable</span><span class="p">])</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">sometable</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">column</span><span class="o">.</span><span class="n">ilike</span><span class="p">(</span><span class="s">"</span><span class="si">%f</span><span class="s">oobar%"</span><span class="p">))</span></pre></div>
1060
<table class="docutils field-list" frame="void" rules="none">
1061
<col class="field-name" />
1062
<col class="field-body" />
1063
<tbody valign="top">
1064
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
1065
<li><strong>other</strong> – expression to be compared</li>
1066
<li><strong>escape</strong> – <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
1068
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">ilike</span><span class="p">(</span><span class="s">"foo/%bar"</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">"/"</span><span class="p">)</span></pre></div>
1076
<div class="admonition seealso">
1077
<p class="first admonition-title">See also</p>
1078
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a></p>
1083
<dt id="sqlalchemy.sql.expression.BindParameter.in_">
1084
<tt class="descname">in_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.in_" title="Permalink to this definition">¶</a></dt>
1085
<dd><div class="inherited-member container">
1086
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="sqlalchemy.sql.operators.ColumnOperators.in_"><tt class="xref py py-meth docutils literal"><span class="pre">in_()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1087
<p>Implement the <tt class="docutils literal"><span class="pre">in</span></tt> operator.</p>
1088
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IN</span> <span class="pre">other</span></tt>.
1089
“other” may be a tuple/list of column expressions,
1090
or 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.</p>
1094
<dt id="sqlalchemy.sql.expression.BindParameter.is_">
1095
<tt class="descname">is_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.is_" title="Permalink to this definition">¶</a></dt>
1096
<dd><div class="inherited-member container">
1097
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.is_" title="sqlalchemy.sql.operators.ColumnOperators.is_"><tt class="xref py py-meth docutils literal"><span class="pre">is_()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1098
<p>Implement the <tt class="docutils literal"><span class="pre">IS</span></tt> operator.</p>
1099
<p>Normally, <tt class="docutils literal"><span class="pre">IS</span></tt> is generated automatically when comparing to a
1100
value of <tt class="docutils literal"><span class="pre">None</span></tt>, which resolves to <tt class="docutils literal"><span class="pre">NULL</span></tt>. However, explicit
1101
usage of <tt class="docutils literal"><span class="pre">IS</span></tt> may be desirable if comparing to boolean values
1102
on certain platforms.</p>
1103
<div class="versionadded">
1104
<p><span>New in version 0.7.9.</span></p>
1106
<div class="admonition seealso">
1107
<p class="first admonition-title">See also</p>
1108
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.isnot" title="sqlalchemy.sql.operators.ColumnOperators.isnot"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.isnot()</span></tt></a></p>
1113
<dt id="sqlalchemy.sql.expression.BindParameter.isnot">
1114
<tt class="descname">isnot</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.isnot" title="Permalink to this definition">¶</a></dt>
1115
<dd><div class="inherited-member container">
1116
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.isnot" title="sqlalchemy.sql.operators.ColumnOperators.isnot"><tt class="xref py py-meth docutils literal"><span class="pre">isnot()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1117
<p>Implement the <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> operator.</p>
1118
<p>Normally, <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> is generated automatically when comparing to a
1119
value of <tt class="docutils literal"><span class="pre">None</span></tt>, which resolves to <tt class="docutils literal"><span class="pre">NULL</span></tt>. However, explicit
1120
usage of <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> may be desirable if comparing to boolean values
1121
on certain platforms.</p>
1122
<div class="versionadded">
1123
<p><span>New in version 0.7.9.</span></p>
1125
<div class="admonition seealso">
1126
<p class="first admonition-title">See also</p>
1127
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.is_" title="sqlalchemy.sql.operators.ColumnOperators.is_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.is_()</span></tt></a></p>
1132
<dt id="sqlalchemy.sql.expression.BindParameter.label">
1133
<tt class="descname">label</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.label" title="Permalink to this definition">¶</a></dt>
1134
<dd><div class="inherited-member container">
1135
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement.label" title="sqlalchemy.sql.expression.ColumnElement.label"><tt class="xref py py-meth docutils literal"><span class="pre">label()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a></div>
1136
<p>Produce a column label, i.e. <tt class="docutils literal"><span class="pre"><columnname></span> <span class="pre">AS</span> <span class="pre"><name></span></tt>.</p>
1137
<p>This is a shortcut to the <a class="reference internal" href="#sqlalchemy.sql.expression.label" title="sqlalchemy.sql.expression.label"><tt class="xref py py-func docutils literal"><span class="pre">label()</span></tt></a> function.</p>
1138
<p>if ‘name’ is None, an anonymous label name will be generated.</p>
1142
<dt id="sqlalchemy.sql.expression.BindParameter.like">
1143
<tt class="descname">like</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.like" title="Permalink to this definition">¶</a></dt>
1144
<dd><div class="inherited-member container">
1145
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">like()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1146
<p>Implement the <tt class="docutils literal"><span class="pre">like</span></tt> operator.</p>
1147
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">LIKE</span> <span class="pre">other</span></tt>.</p>
1149
<div class="highlight-python"><div class="highlight"><pre><span class="n">select</span><span class="p">([</span><span class="n">sometable</span><span class="p">])</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">sometable</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">column</span><span class="o">.</span><span class="n">like</span><span class="p">(</span><span class="s">"</span><span class="si">%f</span><span class="s">oobar%"</span><span class="p">))</span></pre></div>
1151
<table class="docutils field-list" frame="void" rules="none">
1152
<col class="field-name" />
1153
<col class="field-body" />
1154
<tbody valign="top">
1155
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
1156
<li><strong>other</strong> – expression to be compared</li>
1157
<li><strong>escape</strong> – <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
1159
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">like</span><span class="p">(</span><span class="s">"foo/%bar"</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">"/"</span><span class="p">)</span></pre></div>
1167
<div class="admonition seealso">
1168
<p class="first admonition-title">See also</p>
1169
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a></p>
1174
<dt id="sqlalchemy.sql.expression.BindParameter.match">
1175
<tt class="descname">match</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.match" title="Permalink to this definition">¶</a></dt>
1176
<dd><div class="inherited-member container">
1177
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.match" title="sqlalchemy.sql.operators.ColumnOperators.match"><tt class="xref py py-meth docutils literal"><span class="pre">match()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1178
<p>Implements the ‘match’ operator.</p>
1179
<p>In a column context, this produces a MATCH clause, i.e.
1180
<tt class="docutils literal"><span class="pre">MATCH</span> <span class="pre">'<other>'</span></tt>. The allowed contents of <tt class="docutils literal"><span class="pre">other</span></tt>
1181
are database backend specific.</p>
1185
<dt id="sqlalchemy.sql.expression.BindParameter.notilike">
1186
<tt class="descname">notilike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.notilike" title="Permalink to this definition">¶</a></dt>
1187
<dd><div class="inherited-member container">
1188
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.notilike" title="sqlalchemy.sql.operators.ColumnOperators.notilike"><tt class="xref py py-meth docutils literal"><span class="pre">notilike()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1189
<p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">ILIKE</span></tt> operator.</p>
1190
<p>This is equivalent to using negation with
1191
<a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a>, i.e. <tt class="docutils literal"><span class="pre">~x.ilike(y)</span></tt>.</p>
1192
<div class="versionadded">
1193
<p><span>New in version 0.8.</span></p>
1195
<div class="admonition seealso">
1196
<p class="first admonition-title">See also</p>
1197
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a></p>
1202
<dt id="sqlalchemy.sql.expression.BindParameter.notin_">
1203
<tt class="descname">notin_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.notin_" title="Permalink to this definition">¶</a></dt>
1204
<dd><div class="inherited-member container">
1205
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.notin_" title="sqlalchemy.sql.operators.ColumnOperators.notin_"><tt class="xref py py-meth docutils literal"><span class="pre">notin_()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1206
<p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">IN</span></tt> operator.</p>
1207
<p>This is equivalent to using negation with <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="sqlalchemy.sql.operators.ColumnOperators.in_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.in_()</span></tt></a>,
1208
i.e. <tt class="docutils literal"><span class="pre">~x.in_(y)</span></tt>.</p>
1209
<div class="versionadded">
1210
<p><span>New in version 0.8.</span></p>
1212
<div class="admonition seealso">
1213
<p class="first admonition-title">See also</p>
1214
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="sqlalchemy.sql.operators.ColumnOperators.in_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.in_()</span></tt></a></p>
1219
<dt id="sqlalchemy.sql.expression.BindParameter.notlike">
1220
<tt class="descname">notlike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.notlike" title="Permalink to this definition">¶</a></dt>
1221
<dd><div class="inherited-member container">
1222
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.notlike" title="sqlalchemy.sql.operators.ColumnOperators.notlike"><tt class="xref py py-meth docutils literal"><span class="pre">notlike()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1223
<p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">LIKE</span></tt> operator.</p>
1224
<p>This is equivalent to using negation with
1225
<a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a>, i.e. <tt class="docutils literal"><span class="pre">~x.like(y)</span></tt>.</p>
1226
<div class="versionadded">
1227
<p><span>New in version 0.8.</span></p>
1229
<div class="admonition seealso">
1230
<p class="first admonition-title">See also</p>
1231
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a></p>
1236
<dt id="sqlalchemy.sql.expression.BindParameter.nullsfirst">
1237
<tt class="descname">nullsfirst</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.nullsfirst" title="Permalink to this definition">¶</a></dt>
1238
<dd><div class="inherited-member container">
1239
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.nullsfirst" title="sqlalchemy.sql.operators.ColumnOperators.nullsfirst"><tt class="xref py py-meth docutils literal"><span class="pre">nullsfirst()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1240
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.nullsfirst" title="sqlalchemy.sql.expression.nullsfirst"><tt class="xref py py-func docutils literal"><span class="pre">nullsfirst()</span></tt></a> clause against the
1245
<dt id="sqlalchemy.sql.expression.BindParameter.nullslast">
1246
<tt class="descname">nullslast</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.nullslast" title="Permalink to this definition">¶</a></dt>
1247
<dd><div class="inherited-member container">
1248
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.nullslast" title="sqlalchemy.sql.operators.ColumnOperators.nullslast"><tt class="xref py py-meth docutils literal"><span class="pre">nullslast()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1249
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.nullslast" title="sqlalchemy.sql.expression.nullslast"><tt class="xref py py-func docutils literal"><span class="pre">nullslast()</span></tt></a> clause against the
1254
<dt id="sqlalchemy.sql.expression.BindParameter.op">
1255
<tt class="descname">op</tt><big>(</big><em>opstring</em>, <em>precedence=0</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.op" title="Permalink to this definition">¶</a></dt>
1256
<dd><div class="inherited-member container">
1257
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators.op" title="sqlalchemy.sql.operators.Operators.op"><tt class="xref py py-meth docutils literal"><span class="pre">op()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators" title="sqlalchemy.sql.operators.Operators"><tt class="xref py py-class docutils literal"><span class="pre">Operators</span></tt></a></div>
1258
<p>produce a generic operator function.</p>
1260
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">op</span><span class="p">(</span><span class="s">"*"</span><span class="p">)(</span><span class="mi">5</span><span class="p">)</span></pre></div>
1263
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span> <span class="o">*</span> <span class="mi">5</span></pre></div>
1265
<p>This function can also be used to make bitwise operators explicit. For
1267
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">op</span><span class="p">(</span><span class="s">'&'</span><span class="p">)(</span><span class="mh">0xff</span><span class="p">)</span></pre></div>
1269
<p>is a bitwise AND of the value in <tt class="docutils literal"><span class="pre">somecolumn</span></tt>.</p>
1270
<table class="docutils field-list" frame="void" rules="none">
1271
<col class="field-name" />
1272
<col class="field-body" />
1273
<tbody valign="top">
1274
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
1275
<li><strong>operator</strong> – a string which will be output as the infix operator
1276
between this element and the expression passed to the
1277
generated function.</li>
1278
<li><strong>precedence</strong> – <p>precedence to apply to the operator, when
1279
parenthesizing expressions. A lower number will cause the expression
1280
to be parenthesized when applied against another operator with
1281
higher precedence. The default value of <tt class="docutils literal"><span class="pre">0</span></tt> is lower than all
1282
operators except for the comma (<tt class="docutils literal"><span class="pre">,</span></tt>) and <tt class="docutils literal"><span class="pre">AS</span></tt> operators.
1283
A value of 100 will be higher or equal to all operators, and -100
1284
will be lower than or equal to all operators.</p>
1285
<div class="versionadded">
1286
<p><span>New in version 0.8: </span>- added the ‘precedence’ argument.</p>
1294
<div class="admonition seealso">
1295
<p class="first admonition-title">See also</p>
1296
<p class="last"><a class="reference internal" href="types.html#types-operators"><em>Redefining and Creating New Operators</em></a></p>
1301
<dt id="sqlalchemy.sql.expression.BindParameter.params">
1302
<tt class="descname">params</tt><big>(</big><em>*optionaldict</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.params" title="Permalink to this definition">¶</a></dt>
1303
<dd><div class="inherited-member container">
1304
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.params" title="sqlalchemy.sql.expression.ClauseElement.params"><tt class="xref py py-meth docutils literal"><span class="pre">params()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
1305
<p>Return a copy with <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a> elements replaced.</p>
1306
<p>Returns a copy of this ClauseElement with <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a>
1307
elements replaced with values taken from the given dictionary:</p>
1308
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">clause</span> <span class="o">=</span> <span class="n">column</span><span class="p">(</span><span class="s">'x'</span><span class="p">)</span> <span class="o">+</span> <span class="n">bindparam</span><span class="p">(</span><span class="s">'foo'</span><span class="p">)</span>
1309
<span class="gp">>>> </span><span class="k">print</span> <span class="n">clause</span><span class="o">.</span><span class="n">compile</span><span class="p">()</span><span class="o">.</span><span class="n">params</span>
1310
<span class="go">{'foo':None}</span>
1311
<span class="gp">>>> </span><span class="k">print</span> <span class="n">clause</span><span class="o">.</span><span class="n">params</span><span class="p">({</span><span class="s">'foo'</span><span class="p">:</span><span class="mi">7</span><span class="p">})</span><span class="o">.</span><span class="n">compile</span><span class="p">()</span><span class="o">.</span><span class="n">params</span>
1312
<span class="go">{'foo':7}</span></pre></div>
1317
<dt id="sqlalchemy.sql.expression.BindParameter.self_group">
1318
<tt class="descname">self_group</tt><big>(</big><em>against=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.self_group" title="Permalink to this definition">¶</a></dt>
1319
<dd><div class="inherited-member container">
1320
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.self_group" title="sqlalchemy.sql.expression.ClauseElement.self_group"><tt class="xref py py-meth docutils literal"><span class="pre">self_group()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
1321
<p>Apply a ‘grouping’ to this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>.</p>
1322
<p>This method is overridden by subclasses to return a
1323
“grouping” construct, i.e. parenthesis. In particular
1324
it’s used by “binary” expressions to provide a grouping
1325
around themselves when placed into a larger expression,
1326
as well as by <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> constructs when placed into
1327
the FROM clause of another <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>. (Note that
1328
subqueries should be normally created using the
1329
<tt class="xref py py-func docutils literal"><span class="pre">Select.alias()</span></tt> method, as many platforms require
1330
nested SELECT statements to be named).</p>
1331
<p>As expressions are composed together, the application of
1332
<a class="reference internal" href="#sqlalchemy.sql.expression.BindParameter.self_group" title="sqlalchemy.sql.expression.BindParameter.self_group"><tt class="xref py py-meth docutils literal"><span class="pre">self_group()</span></tt></a> is automatic - end-user code should never
1333
need to use this method directly. Note that SQLAlchemy’s
1334
clause constructs take operator precedence into account -
1335
so parenthesis might not be needed, for example, in
1336
an expression like <tt class="docutils literal"><span class="pre">x</span> <span class="pre">OR</span> <span class="pre">(y</span> <span class="pre">AND</span> <span class="pre">z)</span></tt> - AND takes precedence
1338
<p>The base <a class="reference internal" href="#sqlalchemy.sql.expression.BindParameter.self_group" title="sqlalchemy.sql.expression.BindParameter.self_group"><tt class="xref py py-meth docutils literal"><span class="pre">self_group()</span></tt></a> method of <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>
1339
just returns self.</p>
1343
<dt id="sqlalchemy.sql.expression.BindParameter.shares_lineage">
1344
<tt class="descname">shares_lineage</tt><big>(</big><em>othercolumn</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.shares_lineage" title="Permalink to this definition">¶</a></dt>
1345
<dd><div class="inherited-member container">
1346
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement.shares_lineage" title="sqlalchemy.sql.expression.ColumnElement.shares_lineage"><tt class="xref py py-meth docutils literal"><span class="pre">shares_lineage()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a></div>
1347
<p>Return True if the given <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>
1348
has a common ancestor to this <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>.</p>
1352
<dt id="sqlalchemy.sql.expression.BindParameter.startswith">
1353
<tt class="descname">startswith</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.startswith" title="Permalink to this definition">¶</a></dt>
1354
<dd><div class="inherited-member container">
1355
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.startswith" title="sqlalchemy.sql.operators.ColumnOperators.startswith"><tt class="xref py py-meth docutils literal"><span class="pre">startswith()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1356
<p>Implement the <tt class="docutils literal"><span class="pre">startwith</span></tt> operator.</p>
1357
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'<other>%'</span></tt></p>
1361
<dt id="sqlalchemy.sql.expression.BindParameter.unique_params">
1362
<tt class="descname">unique_params</tt><big>(</big><em>*optionaldict</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.BindParameter.unique_params" title="Permalink to this definition">¶</a></dt>
1363
<dd><div class="inherited-member container">
1364
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.unique_params" title="sqlalchemy.sql.expression.ClauseElement.unique_params"><tt class="xref py py-meth docutils literal"><span class="pre">unique_params()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
1365
<p>Return a copy with <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a> elements replaced.</p>
1366
<p>Same functionality as <tt class="docutils literal"><span class="pre">params()</span></tt>, except adds <cite>unique=True</cite>
1367
to affected bind parameters so that multiple statements can be
1374
<dt id="sqlalchemy.sql.expression.ClauseElement">
1375
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">ClauseElement</tt><a class="headerlink" href="#sqlalchemy.sql.expression.ClauseElement" title="Permalink to this definition">¶</a></dt>
1376
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.visitors.Visitable</span></tt></p>
1377
<p>Base class for elements of a programmatically constructed SQL
1380
<dt id="sqlalchemy.sql.expression.ClauseElement.compare">
1381
<tt class="descname">compare</tt><big>(</big><em>other</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ClauseElement.compare" title="Permalink to this definition">¶</a></dt>
1382
<dd><p>Compare this ClauseElement to the given ClauseElement.</p>
1383
<p>Subclasses should override the default behavior, which is a
1384
straight identity comparison.</p>
1385
<p>**kw are arguments consumed by subclass compare() methods and
1386
may be used to modify the criteria for comparison.
1387
(see <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>)</p>
1391
<dt id="sqlalchemy.sql.expression.ClauseElement.compile">
1392
<tt class="descname">compile</tt><big>(</big><em>bind=None</em>, <em>dialect=None</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ClauseElement.compile" title="Permalink to this definition">¶</a></dt>
1393
<dd><p>Compile this SQL expression.</p>
1394
<p>The return value is a <a class="reference internal" href="internals.html#sqlalchemy.engine.interfaces.Compiled" title="sqlalchemy.engine.interfaces.Compiled"><tt class="xref py py-class docutils literal"><span class="pre">Compiled</span></tt></a> object.
1395
Calling <tt class="docutils literal"><span class="pre">str()</span></tt> or <tt class="docutils literal"><span class="pre">unicode()</span></tt> on the returned value will yield a
1396
string representation of the result. The
1397
<a class="reference internal" href="internals.html#sqlalchemy.engine.interfaces.Compiled" title="sqlalchemy.engine.interfaces.Compiled"><tt class="xref py py-class docutils literal"><span class="pre">Compiled</span></tt></a> object also can return a
1398
dictionary of bind parameter names and values
1399
using the <tt class="docutils literal"><span class="pre">params</span></tt> accessor.</p>
1400
<table class="docutils field-list" frame="void" rules="none">
1401
<col class="field-name" />
1402
<col class="field-body" />
1403
<tbody valign="top">
1404
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
1405
<li><strong>bind</strong> – An <tt class="docutils literal"><span class="pre">Engine</span></tt> or <tt class="docutils literal"><span class="pre">Connection</span></tt> from which a
1406
<tt class="docutils literal"><span class="pre">Compiled</span></tt> will be acquired. This argument takes precedence over
1407
this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>‘s bound engine, if any.</li>
1408
<li><strong>column_keys</strong> – Used for INSERT and UPDATE statements, a list of
1409
column names which should be present in the VALUES clause of the
1410
compiled statement. If <tt class="docutils literal"><span class="pre">None</span></tt>, all columns from the target table
1411
object are rendered.</li>
1412
<li><strong>dialect</strong> – A <tt class="docutils literal"><span class="pre">Dialect</span></tt> instance from which a <tt class="docutils literal"><span class="pre">Compiled</span></tt>
1413
will be acquired. This argument takes precedence over the <cite>bind</cite>
1414
argument as well as this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>‘s bound engine, if
1416
<li><strong>inline</strong> – Used for INSERT statements, for a dialect which does
1417
not support inline retrieval of newly generated primary key
1418
columns, will force the expression used to create the new primary
1419
key value to be rendered inline within the INSERT statement’s
1420
VALUES clause. This typically refers to Sequence execution but may
1421
also refer to any server-side default generation function
1422
associated with a primary key <cite>Column</cite>.</li>
1431
<dt id="sqlalchemy.sql.expression.ClauseElement.get_children">
1432
<tt class="descname">get_children</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ClauseElement.get_children" title="Permalink to this definition">¶</a></dt>
1433
<dd><p>Return immediate child elements of this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>.</p>
1434
<p>This is used for visit traversal.</p>
1435
<p>**kwargs may contain flags that change the collection that is
1436
returned, for example to return a subset of items in order to
1437
cut down on larger traversals, or to return child items from a
1438
different context (such as schema-level collections instead of
1443
<dt id="sqlalchemy.sql.expression.ClauseElement.params">
1444
<tt class="descname">params</tt><big>(</big><em>*optionaldict</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ClauseElement.params" title="Permalink to this definition">¶</a></dt>
1445
<dd><p>Return a copy with <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a> elements replaced.</p>
1446
<p>Returns a copy of this ClauseElement with <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a>
1447
elements replaced with values taken from the given dictionary:</p>
1448
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">clause</span> <span class="o">=</span> <span class="n">column</span><span class="p">(</span><span class="s">'x'</span><span class="p">)</span> <span class="o">+</span> <span class="n">bindparam</span><span class="p">(</span><span class="s">'foo'</span><span class="p">)</span>
1449
<span class="gp">>>> </span><span class="k">print</span> <span class="n">clause</span><span class="o">.</span><span class="n">compile</span><span class="p">()</span><span class="o">.</span><span class="n">params</span>
1450
<span class="go">{'foo':None}</span>
1451
<span class="gp">>>> </span><span class="k">print</span> <span class="n">clause</span><span class="o">.</span><span class="n">params</span><span class="p">({</span><span class="s">'foo'</span><span class="p">:</span><span class="mi">7</span><span class="p">})</span><span class="o">.</span><span class="n">compile</span><span class="p">()</span><span class="o">.</span><span class="n">params</span>
1452
<span class="go">{'foo':7}</span></pre></div>
1457
<dt id="sqlalchemy.sql.expression.ClauseElement.self_group">
1458
<tt class="descname">self_group</tt><big>(</big><em>against=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ClauseElement.self_group" title="Permalink to this definition">¶</a></dt>
1459
<dd><p>Apply a ‘grouping’ to this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>.</p>
1460
<p>This method is overridden by subclasses to return a
1461
“grouping” construct, i.e. parenthesis. In particular
1462
it’s used by “binary” expressions to provide a grouping
1463
around themselves when placed into a larger expression,
1464
as well as by <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> constructs when placed into
1465
the FROM clause of another <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>. (Note that
1466
subqueries should be normally created using the
1467
<tt class="xref py py-func docutils literal"><span class="pre">Select.alias()</span></tt> method, as many platforms require
1468
nested SELECT statements to be named).</p>
1469
<p>As expressions are composed together, the application of
1470
<a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.self_group" title="sqlalchemy.sql.expression.ClauseElement.self_group"><tt class="xref py py-meth docutils literal"><span class="pre">self_group()</span></tt></a> is automatic - end-user code should never
1471
need to use this method directly. Note that SQLAlchemy’s
1472
clause constructs take operator precedence into account -
1473
so parenthesis might not be needed, for example, in
1474
an expression like <tt class="docutils literal"><span class="pre">x</span> <span class="pre">OR</span> <span class="pre">(y</span> <span class="pre">AND</span> <span class="pre">z)</span></tt> - AND takes precedence
1476
<p>The base <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.self_group" title="sqlalchemy.sql.expression.ClauseElement.self_group"><tt class="xref py py-meth docutils literal"><span class="pre">self_group()</span></tt></a> method of <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>
1477
just returns self.</p>
1481
<dt id="sqlalchemy.sql.expression.ClauseElement.unique_params">
1482
<tt class="descname">unique_params</tt><big>(</big><em>*optionaldict</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ClauseElement.unique_params" title="Permalink to this definition">¶</a></dt>
1483
<dd><p>Return a copy with <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a> elements replaced.</p>
1484
<p>Same functionality as <tt class="docutils literal"><span class="pre">params()</span></tt>, except adds <cite>unique=True</cite>
1485
to affected bind parameters so that multiple statements can be
1492
<dt id="sqlalchemy.sql.expression.ClauseList">
1493
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">ClauseList</tt><big>(</big><em>*clauses</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ClauseList" title="Permalink to this definition">¶</a></dt>
1494
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.expression.ClauseElement</span></tt></a></p>
1495
<p>Describe a list of clauses, separated by an operator.</p>
1496
<p>By default, is comma-separated, such as a column listing.</p>
1498
<dt id="sqlalchemy.sql.expression.ClauseList.compare">
1499
<tt class="descname">compare</tt><big>(</big><em>other</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ClauseList.compare" title="Permalink to this definition">¶</a></dt>
1500
<dd><p>Compare this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseList" title="sqlalchemy.sql.expression.ClauseList"><tt class="xref py py-class docutils literal"><span class="pre">ClauseList</span></tt></a> to the given <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseList" title="sqlalchemy.sql.expression.ClauseList"><tt class="xref py py-class docutils literal"><span class="pre">ClauseList</span></tt></a>,
1501
including a comparison of all the clause items.</p>
1507
<dt id="sqlalchemy.sql.expression.ColumnClause">
1508
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">ColumnClause</tt><big>(</big><em>text</em>, <em>selectable=None</em>, <em>type_=None</em>, <em>is_literal=False</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause" title="Permalink to this definition">¶</a></dt>
1509
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.expression.Immutable</span></tt>, <a class="reference internal" href="#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></p>
1510
<p>Represents a generic column expression from any textual string.</p>
1511
<p>This includes columns associated with tables, aliases and select
1512
statements, but also any arbitrary text. May or may not be bound
1513
to an underlying <a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.Selectable" title="sqlalchemy.sql.expression.Selectable"><tt class="xref py py-class docutils literal"><span class="pre">Selectable</span></tt></a>.</p>
1514
<p><a class="reference internal" href="#sqlalchemy.sql.expression.ColumnClause" title="sqlalchemy.sql.expression.ColumnClause"><tt class="xref py py-class docutils literal"><span class="pre">ColumnClause</span></tt></a> is constructed by itself typically via
1515
the <a class="reference internal" href="#sqlalchemy.sql.expression.column" title="sqlalchemy.sql.expression.column"><tt class="xref py py-func docutils literal"><span class="pre">column()</span></tt></a> function. It may be placed directly
1516
into constructs such as <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> constructs:</p>
1517
<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="p">,</span> <span class="n">select</span>
1519
<span class="n">c1</span><span class="p">,</span> <span class="n">c2</span> <span class="o">=</span> <span class="n">column</span><span class="p">(</span><span class="s">"c1"</span><span class="p">),</span> <span class="n">column</span><span class="p">(</span><span class="s">"c2"</span><span class="p">)</span>
1520
<span class="n">s</span> <span class="o">=</span> <span class="n">select</span><span class="p">([</span><span class="n">c1</span><span class="p">,</span> <span class="n">c2</span><span class="p">])</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">c1</span><span class="o">==</span><span class="mi">5</span><span class="p">)</span></pre></div>
1522
<p>There is also a variant on <a class="reference internal" href="#sqlalchemy.sql.expression.column" title="sqlalchemy.sql.expression.column"><tt class="xref py py-func docutils literal"><span class="pre">column()</span></tt></a> known
1523
as <a class="reference internal" href="#sqlalchemy.sql.expression.literal_column" title="sqlalchemy.sql.expression.literal_column"><tt class="xref py py-func docutils literal"><span class="pre">literal_column()</span></tt></a> - the difference is that
1524
in the latter case, the string value is assumed to be an exact
1525
expression, rather than a column name, so that no quoting rules
1526
or similar are applied:</p>
1527
<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">literal_column</span><span class="p">,</span> <span class="n">select</span>
1529
<span class="n">s</span> <span class="o">=</span> <span class="n">select</span><span class="p">([</span><span class="n">literal_column</span><span class="p">(</span><span class="s">"5 + 7"</span><span class="p">)])</span></pre></div>
1531
<p><a class="reference internal" href="#sqlalchemy.sql.expression.ColumnClause" title="sqlalchemy.sql.expression.ColumnClause"><tt class="xref py py-class docutils literal"><span class="pre">ColumnClause</span></tt></a> can also be used in a table-like
1532
fashion by combining the <a class="reference internal" href="#sqlalchemy.sql.expression.column" title="sqlalchemy.sql.expression.column"><tt class="xref py py-func docutils literal"><span class="pre">column()</span></tt></a> function
1533
with the <a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.table" title="sqlalchemy.sql.expression.table"><tt class="xref py py-func docutils literal"><span class="pre">table()</span></tt></a> function, to produce
1534
a “lightweight” form of table metadata:</p>
1535
<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">table</span><span class="p">,</span> <span class="n">column</span>
1537
<span class="n">user</span> <span class="o">=</span> <span class="n">table</span><span class="p">(</span><span class="s">"user"</span><span class="p">,</span>
1538
<span class="n">column</span><span class="p">(</span><span class="s">"id"</span><span class="p">),</span>
1539
<span class="n">column</span><span class="p">(</span><span class="s">"name"</span><span class="p">),</span>
1540
<span class="n">column</span><span class="p">(</span><span class="s">"description"</span><span class="p">),</span>
1541
<span class="p">)</span></pre></div>
1543
<p>The above construct can be created in an ad-hoc fashion and is
1544
not associated with any <a class="reference internal" href="metadata.html#sqlalchemy.schema.MetaData" title="sqlalchemy.schema.MetaData"><tt class="xref py py-class docutils literal"><span class="pre">schema.MetaData</span></tt></a>, unlike it’s
1545
more full fledged <a class="reference internal" href="metadata.html#sqlalchemy.schema.Table" title="sqlalchemy.schema.Table"><tt class="xref py py-class docutils literal"><span class="pre">schema.Table</span></tt></a> counterpart.</p>
1546
<table class="docutils field-list" frame="void" rules="none">
1547
<col class="field-name" />
1548
<col class="field-body" />
1549
<tbody valign="top">
1550
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
1551
<li><strong>text</strong> – the text of the element.</li>
1552
<li><strong>selectable</strong> – parent selectable.</li>
1553
<li><strong>type</strong> – <a class="reference internal" href="types.html#sqlalchemy.types.TypeEngine" title="sqlalchemy.types.TypeEngine"><tt class="xref py py-class docutils literal"><span class="pre">types.TypeEngine</span></tt></a> object which can associate
1554
this <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnClause" title="sqlalchemy.sql.expression.ColumnClause"><tt class="xref py py-class docutils literal"><span class="pre">ColumnClause</span></tt></a> with a type.</li>
1555
<li><strong>is_literal</strong> – if True, the <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnClause" title="sqlalchemy.sql.expression.ColumnClause"><tt class="xref py py-class docutils literal"><span class="pre">ColumnClause</span></tt></a> is assumed to
1556
be an exact expression that will be delivered to the output with no
1557
quoting rules applied regardless of case sensitive settings. the
1558
<a class="reference internal" href="#sqlalchemy.sql.expression.literal_column" title="sqlalchemy.sql.expression.literal_column"><tt class="xref py py-func docutils literal"><span class="pre">literal_column()</span></tt></a> function is usually used to create such a
1559
<a class="reference internal" href="#sqlalchemy.sql.expression.ColumnClause" title="sqlalchemy.sql.expression.ColumnClause"><tt class="xref py py-class docutils literal"><span class="pre">ColumnClause</span></tt></a>.</li>
1566
<dt id="sqlalchemy.sql.expression.ColumnClause.__eq__">
1567
<tt class="descname">__eq__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.__eq__" title="Permalink to this definition">¶</a></dt>
1568
<dd><div class="inherited-member container">
1569
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__eq__" title="sqlalchemy.sql.operators.ColumnOperators.__eq__"><tt class="xref py py-meth docutils literal"><span class="pre">__eq__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1570
<p>Implement the <tt class="docutils literal"><span class="pre">==</span></tt> operator.</p>
1571
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">=</span> <span class="pre">b</span></tt>.
1572
If the target is <tt class="docutils literal"><span class="pre">None</span></tt>, produces <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IS</span> <span class="pre">NULL</span></tt>.</p>
1576
<dt id="sqlalchemy.sql.expression.ColumnClause.__le__">
1577
<tt class="descname">__le__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.__le__" title="Permalink to this definition">¶</a></dt>
1578
<dd><div class="inherited-member container">
1579
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__le__" title="sqlalchemy.sql.operators.ColumnOperators.__le__"><tt class="xref py py-meth docutils literal"><span class="pre">__le__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1580
<p>Implement the <tt class="docutils literal"><span class="pre"><=</span></tt> operator.</p>
1581
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre"><=</span> <span class="pre">b</span></tt>.</p>
1585
<dt id="sqlalchemy.sql.expression.ColumnClause.__lt__">
1586
<tt class="descname">__lt__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.__lt__" title="Permalink to this definition">¶</a></dt>
1587
<dd><div class="inherited-member container">
1588
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__lt__" title="sqlalchemy.sql.operators.ColumnOperators.__lt__"><tt class="xref py py-meth docutils literal"><span class="pre">__lt__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1589
<p>Implement the <tt class="docutils literal"><span class="pre"><</span></tt> operator.</p>
1590
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre"><</span> <span class="pre">b</span></tt>.</p>
1594
<dt id="sqlalchemy.sql.expression.ColumnClause.__ne__">
1595
<tt class="descname">__ne__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.__ne__" title="Permalink to this definition">¶</a></dt>
1596
<dd><div class="inherited-member container">
1597
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__ne__" title="sqlalchemy.sql.operators.ColumnOperators.__ne__"><tt class="xref py py-meth docutils literal"><span class="pre">__ne__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1598
<p>Implement the <tt class="docutils literal"><span class="pre">!=</span></tt> operator.</p>
1599
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">!=</span> <span class="pre">b</span></tt>.
1600
If the target is <tt class="docutils literal"><span class="pre">None</span></tt>, produces <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IS</span> <span class="pre">NOT</span> <span class="pre">NULL</span></tt>.</p>
1603
<dl class="attribute">
1604
<dt id="sqlalchemy.sql.expression.ColumnClause.anon_label">
1605
<tt class="descname">anon_label</tt><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.anon_label" title="Permalink to this definition">¶</a></dt>
1606
<dd><div class="inherited-member container">
1607
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement.anon_label" title="sqlalchemy.sql.expression.ColumnElement.anon_label"><tt class="xref py py-attr docutils literal"><span class="pre">anon_label</span></tt></a> <em>attribute of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a></div>
1608
<p>provides a constant ‘anonymous label’ for this ColumnElement.</p>
1609
<p>This is a label() expression which will be named at compile time.
1610
The same label() is returned each time anon_label is called so
1611
that expressions can reference anon_label multiple times, producing
1612
the same label name at compile time.</p>
1613
<p>the compiler uses this function automatically at compile time
1614
for expressions that are known to be ‘unnamed’ like binary
1615
expressions and function calls.</p>
1619
<dt id="sqlalchemy.sql.expression.ColumnClause.asc">
1620
<tt class="descname">asc</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.asc" title="Permalink to this definition">¶</a></dt>
1621
<dd><div class="inherited-member container">
1622
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.asc" title="sqlalchemy.sql.operators.ColumnOperators.asc"><tt class="xref py py-meth docutils literal"><span class="pre">asc()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1623
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.asc" title="sqlalchemy.sql.expression.asc"><tt class="xref py py-func docutils literal"><span class="pre">asc()</span></tt></a> clause against the
1628
<dt id="sqlalchemy.sql.expression.ColumnClause.between">
1629
<tt class="descname">between</tt><big>(</big><em>cleft</em>, <em>cright</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.between" title="Permalink to this definition">¶</a></dt>
1630
<dd><div class="inherited-member container">
1631
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.between" title="sqlalchemy.sql.operators.ColumnOperators.between"><tt class="xref py py-meth docutils literal"><span class="pre">between()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1632
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.between" title="sqlalchemy.sql.expression.between"><tt class="xref py py-func docutils literal"><span class="pre">between()</span></tt></a> clause against
1633
the parent object, given the lower and upper range.</p>
1637
<dt id="sqlalchemy.sql.expression.ColumnClause.collate">
1638
<tt class="descname">collate</tt><big>(</big><em>collation</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.collate" title="Permalink to this definition">¶</a></dt>
1639
<dd><div class="inherited-member container">
1640
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.collate" title="sqlalchemy.sql.operators.ColumnOperators.collate"><tt class="xref py py-meth docutils literal"><span class="pre">collate()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1641
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.collate" title="sqlalchemy.sql.expression.collate"><tt class="xref py py-func docutils literal"><span class="pre">collate()</span></tt></a> clause against
1642
the parent object, given the collation string.</p>
1646
<dt id="sqlalchemy.sql.expression.ColumnClause.compare">
1647
<tt class="descname">compare</tt><big>(</big><em>other</em>, <em>use_proxies=False</em>, <em>equivalents=None</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.compare" title="Permalink to this definition">¶</a></dt>
1648
<dd><div class="inherited-member container">
1649
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement.compare" title="sqlalchemy.sql.expression.ColumnElement.compare"><tt class="xref py py-meth docutils literal"><span class="pre">compare()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a></div>
1650
<p>Compare this ColumnElement to another.</p>
1651
<p>Special arguments understood:</p>
1652
<table class="docutils field-list" frame="void" rules="none">
1653
<col class="field-name" />
1654
<col class="field-body" />
1655
<tbody valign="top">
1656
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
1657
<li><strong>use_proxies</strong> – when True, consider two columns that
1658
share a common base column as equivalent (i.e. shares_lineage())</li>
1659
<li><strong>equivalents</strong> – a dictionary of columns as keys mapped to sets
1660
of columns. If the given “other” column is present in this
1661
dictionary, if any of the columns in the corresponding set() pass the
1662
comparison test, the result is True. This is used to expand the
1663
comparison to other columns that may be known to be equivalent to
1664
this one via foreign key or other criterion.</li>
1673
<dt id="sqlalchemy.sql.expression.ColumnClause.compile">
1674
<tt class="descname">compile</tt><big>(</big><em>bind=None</em>, <em>dialect=None</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.compile" title="Permalink to this definition">¶</a></dt>
1675
<dd><div class="inherited-member container">
1676
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.compile" title="sqlalchemy.sql.expression.ClauseElement.compile"><tt class="xref py py-meth docutils literal"><span class="pre">compile()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
1677
<p>Compile this SQL expression.</p>
1678
<p>The return value is a <a class="reference internal" href="internals.html#sqlalchemy.engine.interfaces.Compiled" title="sqlalchemy.engine.interfaces.Compiled"><tt class="xref py py-class docutils literal"><span class="pre">Compiled</span></tt></a> object.
1679
Calling <tt class="docutils literal"><span class="pre">str()</span></tt> or <tt class="docutils literal"><span class="pre">unicode()</span></tt> on the returned value will yield a
1680
string representation of the result. The
1681
<a class="reference internal" href="internals.html#sqlalchemy.engine.interfaces.Compiled" title="sqlalchemy.engine.interfaces.Compiled"><tt class="xref py py-class docutils literal"><span class="pre">Compiled</span></tt></a> object also can return a
1682
dictionary of bind parameter names and values
1683
using the <tt class="docutils literal"><span class="pre">params</span></tt> accessor.</p>
1684
<table class="docutils field-list" frame="void" rules="none">
1685
<col class="field-name" />
1686
<col class="field-body" />
1687
<tbody valign="top">
1688
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
1689
<li><strong>bind</strong> – An <tt class="docutils literal"><span class="pre">Engine</span></tt> or <tt class="docutils literal"><span class="pre">Connection</span></tt> from which a
1690
<tt class="docutils literal"><span class="pre">Compiled</span></tt> will be acquired. This argument takes precedence over
1691
this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>‘s bound engine, if any.</li>
1692
<li><strong>column_keys</strong> – Used for INSERT and UPDATE statements, a list of
1693
column names which should be present in the VALUES clause of the
1694
compiled statement. If <tt class="docutils literal"><span class="pre">None</span></tt>, all columns from the target table
1695
object are rendered.</li>
1696
<li><strong>dialect</strong> – A <tt class="docutils literal"><span class="pre">Dialect</span></tt> instance from which a <tt class="docutils literal"><span class="pre">Compiled</span></tt>
1697
will be acquired. This argument takes precedence over the <cite>bind</cite>
1698
argument as well as this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>‘s bound engine, if
1700
<li><strong>inline</strong> – Used for INSERT statements, for a dialect which does
1701
not support inline retrieval of newly generated primary key
1702
columns, will force the expression used to create the new primary
1703
key value to be rendered inline within the INSERT statement’s
1704
VALUES clause. This typically refers to Sequence execution but may
1705
also refer to any server-side default generation function
1706
associated with a primary key <cite>Column</cite>.</li>
1715
<dt id="sqlalchemy.sql.expression.ColumnClause.concat">
1716
<tt class="descname">concat</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.concat" title="Permalink to this definition">¶</a></dt>
1717
<dd><div class="inherited-member container">
1718
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.concat" title="sqlalchemy.sql.operators.ColumnOperators.concat"><tt class="xref py py-meth docutils literal"><span class="pre">concat()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1719
<p>Implement the ‘concat’ operator.</p>
1720
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">||</span> <span class="pre">b</span></tt>,
1721
or uses the <tt class="docutils literal"><span class="pre">concat()</span></tt> operator on MySQL.</p>
1725
<dt id="sqlalchemy.sql.expression.ColumnClause.contains">
1726
<tt class="descname">contains</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.contains" title="Permalink to this definition">¶</a></dt>
1727
<dd><div class="inherited-member container">
1728
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.contains" title="sqlalchemy.sql.operators.ColumnOperators.contains"><tt class="xref py py-meth docutils literal"><span class="pre">contains()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1729
<p>Implement the ‘contains’ operator.</p>
1730
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%<other>%'</span></tt></p>
1734
<dt id="sqlalchemy.sql.expression.ColumnClause.desc">
1735
<tt class="descname">desc</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.desc" title="Permalink to this definition">¶</a></dt>
1736
<dd><div class="inherited-member container">
1737
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.desc" title="sqlalchemy.sql.operators.ColumnOperators.desc"><tt class="xref py py-meth docutils literal"><span class="pre">desc()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1738
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.desc" title="sqlalchemy.sql.expression.desc"><tt class="xref py py-func docutils literal"><span class="pre">desc()</span></tt></a> clause against the
1743
<dt id="sqlalchemy.sql.expression.ColumnClause.distinct">
1744
<tt class="descname">distinct</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.distinct" title="Permalink to this definition">¶</a></dt>
1745
<dd><div class="inherited-member container">
1746
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.distinct" title="sqlalchemy.sql.operators.ColumnOperators.distinct"><tt class="xref py py-meth docutils literal"><span class="pre">distinct()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1747
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.distinct" title="sqlalchemy.sql.expression.distinct"><tt class="xref py py-func docutils literal"><span class="pre">distinct()</span></tt></a> clause against the
1752
<dt id="sqlalchemy.sql.expression.ColumnClause.endswith">
1753
<tt class="descname">endswith</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.endswith" title="Permalink to this definition">¶</a></dt>
1754
<dd><div class="inherited-member container">
1755
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.endswith" title="sqlalchemy.sql.operators.ColumnOperators.endswith"><tt class="xref py py-meth docutils literal"><span class="pre">endswith()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1756
<p>Implement the ‘endswith’ operator.</p>
1757
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%<other>'</span></tt></p>
1760
<dl class="attribute">
1761
<dt id="sqlalchemy.sql.expression.ColumnClause.expression">
1762
<tt class="descname">expression</tt><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.expression" title="Permalink to this definition">¶</a></dt>
1763
<dd><div class="inherited-member container">
1764
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement.expression" title="sqlalchemy.sql.expression.ColumnElement.expression"><tt class="xref py py-attr docutils literal"><span class="pre">expression</span></tt></a> <em>attribute of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a></div>
1765
<p>Return a column expression.</p>
1766
<p>Part of the inspection interface; returns self.</p>
1770
<dt id="sqlalchemy.sql.expression.ColumnClause.get_children">
1771
<tt class="descname">get_children</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.get_children" title="Permalink to this definition">¶</a></dt>
1772
<dd><div class="inherited-member container">
1773
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.get_children" title="sqlalchemy.sql.expression.ClauseElement.get_children"><tt class="xref py py-meth docutils literal"><span class="pre">get_children()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
1774
<p>Return immediate child elements of this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>.</p>
1775
<p>This is used for visit traversal.</p>
1776
<p>**kwargs may contain flags that change the collection that is
1777
returned, for example to return a subset of items in order to
1778
cut down on larger traversals, or to return child items from a
1779
different context (such as schema-level collections instead of
1784
<dt id="sqlalchemy.sql.expression.ColumnClause.ilike">
1785
<tt class="descname">ilike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.ilike" title="Permalink to this definition">¶</a></dt>
1786
<dd><div class="inherited-member container">
1787
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ilike()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1788
<p>Implement the <tt class="docutils literal"><span class="pre">ilike</span></tt> operator.</p>
1789
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">ILIKE</span> <span class="pre">other</span></tt>.</p>
1791
<div class="highlight-python"><div class="highlight"><pre><span class="n">select</span><span class="p">([</span><span class="n">sometable</span><span class="p">])</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">sometable</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">column</span><span class="o">.</span><span class="n">ilike</span><span class="p">(</span><span class="s">"</span><span class="si">%f</span><span class="s">oobar%"</span><span class="p">))</span></pre></div>
1793
<table class="docutils field-list" frame="void" rules="none">
1794
<col class="field-name" />
1795
<col class="field-body" />
1796
<tbody valign="top">
1797
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
1798
<li><strong>other</strong> – expression to be compared</li>
1799
<li><strong>escape</strong> – <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
1801
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">ilike</span><span class="p">(</span><span class="s">"foo/%bar"</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">"/"</span><span class="p">)</span></pre></div>
1809
<div class="admonition seealso">
1810
<p class="first admonition-title">See also</p>
1811
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a></p>
1816
<dt id="sqlalchemy.sql.expression.ColumnClause.in_">
1817
<tt class="descname">in_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.in_" title="Permalink to this definition">¶</a></dt>
1818
<dd><div class="inherited-member container">
1819
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="sqlalchemy.sql.operators.ColumnOperators.in_"><tt class="xref py py-meth docutils literal"><span class="pre">in_()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1820
<p>Implement the <tt class="docutils literal"><span class="pre">in</span></tt> operator.</p>
1821
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IN</span> <span class="pre">other</span></tt>.
1822
“other” may be a tuple/list of column expressions,
1823
or 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.</p>
1827
<dt id="sqlalchemy.sql.expression.ColumnClause.is_">
1828
<tt class="descname">is_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.is_" title="Permalink to this definition">¶</a></dt>
1829
<dd><div class="inherited-member container">
1830
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.is_" title="sqlalchemy.sql.operators.ColumnOperators.is_"><tt class="xref py py-meth docutils literal"><span class="pre">is_()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1831
<p>Implement the <tt class="docutils literal"><span class="pre">IS</span></tt> operator.</p>
1832
<p>Normally, <tt class="docutils literal"><span class="pre">IS</span></tt> is generated automatically when comparing to a
1833
value of <tt class="docutils literal"><span class="pre">None</span></tt>, which resolves to <tt class="docutils literal"><span class="pre">NULL</span></tt>. However, explicit
1834
usage of <tt class="docutils literal"><span class="pre">IS</span></tt> may be desirable if comparing to boolean values
1835
on certain platforms.</p>
1836
<div class="versionadded">
1837
<p><span>New in version 0.7.9.</span></p>
1839
<div class="admonition seealso">
1840
<p class="first admonition-title">See also</p>
1841
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.isnot" title="sqlalchemy.sql.operators.ColumnOperators.isnot"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.isnot()</span></tt></a></p>
1846
<dt id="sqlalchemy.sql.expression.ColumnClause.isnot">
1847
<tt class="descname">isnot</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.isnot" title="Permalink to this definition">¶</a></dt>
1848
<dd><div class="inherited-member container">
1849
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.isnot" title="sqlalchemy.sql.operators.ColumnOperators.isnot"><tt class="xref py py-meth docutils literal"><span class="pre">isnot()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1850
<p>Implement the <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> operator.</p>
1851
<p>Normally, <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> is generated automatically when comparing to a
1852
value of <tt class="docutils literal"><span class="pre">None</span></tt>, which resolves to <tt class="docutils literal"><span class="pre">NULL</span></tt>. However, explicit
1853
usage of <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> may be desirable if comparing to boolean values
1854
on certain platforms.</p>
1855
<div class="versionadded">
1856
<p><span>New in version 0.7.9.</span></p>
1858
<div class="admonition seealso">
1859
<p class="first admonition-title">See also</p>
1860
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.is_" title="sqlalchemy.sql.operators.ColumnOperators.is_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.is_()</span></tt></a></p>
1865
<dt id="sqlalchemy.sql.expression.ColumnClause.label">
1866
<tt class="descname">label</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.label" title="Permalink to this definition">¶</a></dt>
1867
<dd><div class="inherited-member container">
1868
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement.label" title="sqlalchemy.sql.expression.ColumnElement.label"><tt class="xref py py-meth docutils literal"><span class="pre">label()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a></div>
1869
<p>Produce a column label, i.e. <tt class="docutils literal"><span class="pre"><columnname></span> <span class="pre">AS</span> <span class="pre"><name></span></tt>.</p>
1870
<p>This is a shortcut to the <a class="reference internal" href="#sqlalchemy.sql.expression.label" title="sqlalchemy.sql.expression.label"><tt class="xref py py-func docutils literal"><span class="pre">label()</span></tt></a> function.</p>
1871
<p>if ‘name’ is None, an anonymous label name will be generated.</p>
1875
<dt id="sqlalchemy.sql.expression.ColumnClause.like">
1876
<tt class="descname">like</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.like" title="Permalink to this definition">¶</a></dt>
1877
<dd><div class="inherited-member container">
1878
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">like()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1879
<p>Implement the <tt class="docutils literal"><span class="pre">like</span></tt> operator.</p>
1880
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">LIKE</span> <span class="pre">other</span></tt>.</p>
1882
<div class="highlight-python"><div class="highlight"><pre><span class="n">select</span><span class="p">([</span><span class="n">sometable</span><span class="p">])</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">sometable</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">column</span><span class="o">.</span><span class="n">like</span><span class="p">(</span><span class="s">"</span><span class="si">%f</span><span class="s">oobar%"</span><span class="p">))</span></pre></div>
1884
<table class="docutils field-list" frame="void" rules="none">
1885
<col class="field-name" />
1886
<col class="field-body" />
1887
<tbody valign="top">
1888
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
1889
<li><strong>other</strong> – expression to be compared</li>
1890
<li><strong>escape</strong> – <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
1892
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">like</span><span class="p">(</span><span class="s">"foo/%bar"</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">"/"</span><span class="p">)</span></pre></div>
1900
<div class="admonition seealso">
1901
<p class="first admonition-title">See also</p>
1902
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a></p>
1907
<dt id="sqlalchemy.sql.expression.ColumnClause.match">
1908
<tt class="descname">match</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.match" title="Permalink to this definition">¶</a></dt>
1909
<dd><div class="inherited-member container">
1910
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.match" title="sqlalchemy.sql.operators.ColumnOperators.match"><tt class="xref py py-meth docutils literal"><span class="pre">match()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1911
<p>Implements the ‘match’ operator.</p>
1912
<p>In a column context, this produces a MATCH clause, i.e.
1913
<tt class="docutils literal"><span class="pre">MATCH</span> <span class="pre">'<other>'</span></tt>. The allowed contents of <tt class="docutils literal"><span class="pre">other</span></tt>
1914
are database backend specific.</p>
1918
<dt id="sqlalchemy.sql.expression.ColumnClause.notilike">
1919
<tt class="descname">notilike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.notilike" title="Permalink to this definition">¶</a></dt>
1920
<dd><div class="inherited-member container">
1921
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.notilike" title="sqlalchemy.sql.operators.ColumnOperators.notilike"><tt class="xref py py-meth docutils literal"><span class="pre">notilike()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1922
<p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">ILIKE</span></tt> operator.</p>
1923
<p>This is equivalent to using negation with
1924
<a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a>, i.e. <tt class="docutils literal"><span class="pre">~x.ilike(y)</span></tt>.</p>
1925
<div class="versionadded">
1926
<p><span>New in version 0.8.</span></p>
1928
<div class="admonition seealso">
1929
<p class="first admonition-title">See also</p>
1930
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a></p>
1935
<dt id="sqlalchemy.sql.expression.ColumnClause.notin_">
1936
<tt class="descname">notin_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.notin_" title="Permalink to this definition">¶</a></dt>
1937
<dd><div class="inherited-member container">
1938
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.notin_" title="sqlalchemy.sql.operators.ColumnOperators.notin_"><tt class="xref py py-meth docutils literal"><span class="pre">notin_()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1939
<p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">IN</span></tt> operator.</p>
1940
<p>This is equivalent to using negation with <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="sqlalchemy.sql.operators.ColumnOperators.in_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.in_()</span></tt></a>,
1941
i.e. <tt class="docutils literal"><span class="pre">~x.in_(y)</span></tt>.</p>
1942
<div class="versionadded">
1943
<p><span>New in version 0.8.</span></p>
1945
<div class="admonition seealso">
1946
<p class="first admonition-title">See also</p>
1947
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="sqlalchemy.sql.operators.ColumnOperators.in_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.in_()</span></tt></a></p>
1952
<dt id="sqlalchemy.sql.expression.ColumnClause.notlike">
1953
<tt class="descname">notlike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.notlike" title="Permalink to this definition">¶</a></dt>
1954
<dd><div class="inherited-member container">
1955
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.notlike" title="sqlalchemy.sql.operators.ColumnOperators.notlike"><tt class="xref py py-meth docutils literal"><span class="pre">notlike()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1956
<p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">LIKE</span></tt> operator.</p>
1957
<p>This is equivalent to using negation with
1958
<a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a>, i.e. <tt class="docutils literal"><span class="pre">~x.like(y)</span></tt>.</p>
1959
<div class="versionadded">
1960
<p><span>New in version 0.8.</span></p>
1962
<div class="admonition seealso">
1963
<p class="first admonition-title">See also</p>
1964
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a></p>
1969
<dt id="sqlalchemy.sql.expression.ColumnClause.nullsfirst">
1970
<tt class="descname">nullsfirst</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.nullsfirst" title="Permalink to this definition">¶</a></dt>
1971
<dd><div class="inherited-member container">
1972
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.nullsfirst" title="sqlalchemy.sql.operators.ColumnOperators.nullsfirst"><tt class="xref py py-meth docutils literal"><span class="pre">nullsfirst()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1973
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.nullsfirst" title="sqlalchemy.sql.expression.nullsfirst"><tt class="xref py py-func docutils literal"><span class="pre">nullsfirst()</span></tt></a> clause against the
1978
<dt id="sqlalchemy.sql.expression.ColumnClause.nullslast">
1979
<tt class="descname">nullslast</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.nullslast" title="Permalink to this definition">¶</a></dt>
1980
<dd><div class="inherited-member container">
1981
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.nullslast" title="sqlalchemy.sql.operators.ColumnOperators.nullslast"><tt class="xref py py-meth docutils literal"><span class="pre">nullslast()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
1982
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.nullslast" title="sqlalchemy.sql.expression.nullslast"><tt class="xref py py-func docutils literal"><span class="pre">nullslast()</span></tt></a> clause against the
1987
<dt id="sqlalchemy.sql.expression.ColumnClause.op">
1988
<tt class="descname">op</tt><big>(</big><em>opstring</em>, <em>precedence=0</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.op" title="Permalink to this definition">¶</a></dt>
1989
<dd><div class="inherited-member container">
1990
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators.op" title="sqlalchemy.sql.operators.Operators.op"><tt class="xref py py-meth docutils literal"><span class="pre">op()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators" title="sqlalchemy.sql.operators.Operators"><tt class="xref py py-class docutils literal"><span class="pre">Operators</span></tt></a></div>
1991
<p>produce a generic operator function.</p>
1993
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">op</span><span class="p">(</span><span class="s">"*"</span><span class="p">)(</span><span class="mi">5</span><span class="p">)</span></pre></div>
1996
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span> <span class="o">*</span> <span class="mi">5</span></pre></div>
1998
<p>This function can also be used to make bitwise operators explicit. For
2000
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">op</span><span class="p">(</span><span class="s">'&'</span><span class="p">)(</span><span class="mh">0xff</span><span class="p">)</span></pre></div>
2002
<p>is a bitwise AND of the value in <tt class="docutils literal"><span class="pre">somecolumn</span></tt>.</p>
2003
<table class="docutils field-list" frame="void" rules="none">
2004
<col class="field-name" />
2005
<col class="field-body" />
2006
<tbody valign="top">
2007
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
2008
<li><strong>operator</strong> – a string which will be output as the infix operator
2009
between this element and the expression passed to the
2010
generated function.</li>
2011
<li><strong>precedence</strong> – <p>precedence to apply to the operator, when
2012
parenthesizing expressions. A lower number will cause the expression
2013
to be parenthesized when applied against another operator with
2014
higher precedence. The default value of <tt class="docutils literal"><span class="pre">0</span></tt> is lower than all
2015
operators except for the comma (<tt class="docutils literal"><span class="pre">,</span></tt>) and <tt class="docutils literal"><span class="pre">AS</span></tt> operators.
2016
A value of 100 will be higher or equal to all operators, and -100
2017
will be lower than or equal to all operators.</p>
2018
<div class="versionadded">
2019
<p><span>New in version 0.8: </span>- added the ‘precedence’ argument.</p>
2027
<div class="admonition seealso">
2028
<p class="first admonition-title">See also</p>
2029
<p class="last"><a class="reference internal" href="types.html#types-operators"><em>Redefining and Creating New Operators</em></a></p>
2034
<dt id="sqlalchemy.sql.expression.ColumnClause.self_group">
2035
<tt class="descname">self_group</tt><big>(</big><em>against=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.self_group" title="Permalink to this definition">¶</a></dt>
2036
<dd><div class="inherited-member container">
2037
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.self_group" title="sqlalchemy.sql.expression.ClauseElement.self_group"><tt class="xref py py-meth docutils literal"><span class="pre">self_group()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
2038
<p>Apply a ‘grouping’ to this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>.</p>
2039
<p>This method is overridden by subclasses to return a
2040
“grouping” construct, i.e. parenthesis. In particular
2041
it’s used by “binary” expressions to provide a grouping
2042
around themselves when placed into a larger expression,
2043
as well as by <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> constructs when placed into
2044
the FROM clause of another <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>. (Note that
2045
subqueries should be normally created using the
2046
<tt class="xref py py-func docutils literal"><span class="pre">Select.alias()</span></tt> method, as many platforms require
2047
nested SELECT statements to be named).</p>
2048
<p>As expressions are composed together, the application of
2049
<a class="reference internal" href="#sqlalchemy.sql.expression.ColumnClause.self_group" title="sqlalchemy.sql.expression.ColumnClause.self_group"><tt class="xref py py-meth docutils literal"><span class="pre">self_group()</span></tt></a> is automatic - end-user code should never
2050
need to use this method directly. Note that SQLAlchemy’s
2051
clause constructs take operator precedence into account -
2052
so parenthesis might not be needed, for example, in
2053
an expression like <tt class="docutils literal"><span class="pre">x</span> <span class="pre">OR</span> <span class="pre">(y</span> <span class="pre">AND</span> <span class="pre">z)</span></tt> - AND takes precedence
2055
<p>The base <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnClause.self_group" title="sqlalchemy.sql.expression.ColumnClause.self_group"><tt class="xref py py-meth docutils literal"><span class="pre">self_group()</span></tt></a> method of <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>
2056
just returns self.</p>
2060
<dt id="sqlalchemy.sql.expression.ColumnClause.shares_lineage">
2061
<tt class="descname">shares_lineage</tt><big>(</big><em>othercolumn</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.shares_lineage" title="Permalink to this definition">¶</a></dt>
2062
<dd><div class="inherited-member container">
2063
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement.shares_lineage" title="sqlalchemy.sql.expression.ColumnElement.shares_lineage"><tt class="xref py py-meth docutils literal"><span class="pre">shares_lineage()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a></div>
2064
<p>Return True if the given <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>
2065
has a common ancestor to this <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>.</p>
2069
<dt id="sqlalchemy.sql.expression.ColumnClause.startswith">
2070
<tt class="descname">startswith</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnClause.startswith" title="Permalink to this definition">¶</a></dt>
2071
<dd><div class="inherited-member container">
2072
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.startswith" title="sqlalchemy.sql.operators.ColumnOperators.startswith"><tt class="xref py py-meth docutils literal"><span class="pre">startswith()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2073
<p>Implement the <tt class="docutils literal"><span class="pre">startwith</span></tt> operator.</p>
2074
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'<other>%'</span></tt></p>
2080
<dt id="sqlalchemy.sql.expression.ColumnCollection">
2081
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">ColumnCollection</tt><big>(</big><em>*cols</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnCollection" title="Permalink to this definition">¶</a></dt>
2082
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.util._collections.OrderedProperties</span></tt></p>
2083
<p>An ordered dictionary that stores a list of ColumnElement
2085
<p>Overrides the <tt class="docutils literal"><span class="pre">__eq__()</span></tt> method to produce SQL clauses between
2086
sets of correlated columns.</p>
2088
<dt id="sqlalchemy.sql.expression.ColumnCollection.add">
2089
<tt class="descname">add</tt><big>(</big><em>column</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnCollection.add" title="Permalink to this definition">¶</a></dt>
2090
<dd><p>Add a column to this collection.</p>
2091
<p>The key attribute of the column will be used as the hash key
2092
for this dictionary.</p>
2096
<dt id="sqlalchemy.sql.expression.ColumnCollection.replace">
2097
<tt class="descname">replace</tt><big>(</big><em>column</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnCollection.replace" title="Permalink to this definition">¶</a></dt>
2098
<dd><p>add the given column to this collection, removing unaliased
2099
versions of this column as well as existing columns with the
2103
<div class="highlight-python"><div class="highlight"><pre><span class="n">t</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s">'sometable'</span><span class="p">,</span> <span class="n">metadata</span><span class="p">,</span> <span class="n">Column</span><span class="p">(</span><span class="s">'col1'</span><span class="p">,</span> <span class="n">Integer</span><span class="p">))</span>
2104
<span class="n">t</span><span class="o">.</span><span class="n">columns</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">Column</span><span class="p">(</span><span class="s">'col1'</span><span class="p">,</span> <span class="n">Integer</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s">'columnone'</span><span class="p">))</span></pre></div>
2106
<p>will remove the original ‘col1’ from the collection, and add
2107
the new column under the name ‘columnname’.</p>
2109
<p>Used by schema.Column to override columns during table reflection.</p>
2115
<dt id="sqlalchemy.sql.expression.ColumnElement">
2116
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">ColumnElement</tt><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement" title="Permalink to this definition">¶</a></dt>
2117
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.expression.ClauseElement</span></tt></a>, <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.operators.ColumnOperators</span></tt></a></p>
2118
<p>Represent a column-oriented SQL expression suitable for usage in the
2119
“columns” clause, WHERE clause etc. of a statement.</p>
2120
<p>While the most familiar kind of <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> is the
2121
<a class="reference internal" href="metadata.html#sqlalchemy.schema.Column" title="sqlalchemy.schema.Column"><tt class="xref py py-class docutils literal"><span class="pre">Column</span></tt></a> object, <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> serves as the basis
2122
for any unit that may be present in a SQL expression, including
2123
the expressions themselves, SQL functions, bound parameters,
2124
literal expressions, keywords such as <tt class="docutils literal"><span class="pre">NULL</span></tt>, etc.
2125
<a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> is the ultimate base class for all such elements.</p>
2126
<p>A <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> provides the ability to generate new
2127
<a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>
2128
objects using Python expressions. This means that Python operators
2129
such as <tt class="docutils literal"><span class="pre">==</span></tt>, <tt class="docutils literal"><span class="pre">!=</span></tt> and <tt class="docutils literal"><span class="pre"><</span></tt> are overloaded to mimic SQL operations,
2130
and allow the instantiation of further <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> instances
2131
which are composed from other, more fundamental <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>
2132
objects. For example, two <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnClause" title="sqlalchemy.sql.expression.ColumnClause"><tt class="xref py py-class docutils literal"><span class="pre">ColumnClause</span></tt></a> objects can be added
2133
together with the addition operator <tt class="docutils literal"><span class="pre">+</span></tt> to produce
2134
a <a class="reference internal" href="#sqlalchemy.sql.expression.BinaryExpression" title="sqlalchemy.sql.expression.BinaryExpression"><tt class="xref py py-class docutils literal"><span class="pre">BinaryExpression</span></tt></a>.
2135
Both <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnClause" title="sqlalchemy.sql.expression.ColumnClause"><tt class="xref py py-class docutils literal"><span class="pre">ColumnClause</span></tt></a> and <a class="reference internal" href="#sqlalchemy.sql.expression.BinaryExpression" title="sqlalchemy.sql.expression.BinaryExpression"><tt class="xref py py-class docutils literal"><span class="pre">BinaryExpression</span></tt></a> are subclasses
2136
of <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>:</p>
2137
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlalchemy.sql</span> <span class="kn">import</span> <span class="n">column</span>
2138
<span class="gp">>>> </span><span class="n">column</span><span class="p">(</span><span class="s">'a'</span><span class="p">)</span> <span class="o">+</span> <span class="n">column</span><span class="p">(</span><span class="s">'b'</span><span class="p">)</span>
2139
<span class="go"><sqlalchemy.sql.expression.BinaryExpression object at 0x101029dd0></span>
2140
<span class="gp">>>> </span><span class="k">print</span> <span class="n">column</span><span class="p">(</span><span class="s">'a'</span><span class="p">)</span> <span class="o">+</span> <span class="n">column</span><span class="p">(</span><span class="s">'b'</span><span class="p">)</span>
2141
<span class="go">a + b</span></pre></div>
2143
<p><a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> supports the ability to be a <em>proxy</em> element,
2144
which indicates that the <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> may be associated with
2145
a <a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.Selectable" title="sqlalchemy.sql.expression.Selectable"><tt class="xref py py-class docutils literal"><span class="pre">Selectable</span></tt></a> which was derived from another <a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.Selectable" title="sqlalchemy.sql.expression.Selectable"><tt class="xref py py-class docutils literal"><span class="pre">Selectable</span></tt></a>.
2146
An example of a “derived” <a class="reference internal" href="selectable.html#sqlalchemy.sql.expression.Selectable" title="sqlalchemy.sql.expression.Selectable"><tt class="xref py py-class docutils literal"><span class="pre">Selectable</span></tt></a> is an <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> of a
2147
<a class="reference internal" href="metadata.html#sqlalchemy.schema.Table" title="sqlalchemy.schema.Table"><tt class="xref py py-class docutils literal"><span class="pre">Table</span></tt></a>. For the ambitious, an in-depth
2148
discussion of this concept can be found at
2149
<a class="reference external" href="http://techspot.zzzeek.org/2008/01/23/expression-transformations/">Expression Transformations</a>.</p>
2151
<dt id="sqlalchemy.sql.expression.ColumnElement.__eq__">
2152
<tt class="descname">__eq__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.__eq__" title="Permalink to this definition">¶</a></dt>
2153
<dd><div class="inherited-member container">
2154
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__eq__" title="sqlalchemy.sql.operators.ColumnOperators.__eq__"><tt class="xref py py-meth docutils literal"><span class="pre">__eq__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2155
<p>Implement the <tt class="docutils literal"><span class="pre">==</span></tt> operator.</p>
2156
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">=</span> <span class="pre">b</span></tt>.
2157
If the target is <tt class="docutils literal"><span class="pre">None</span></tt>, produces <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IS</span> <span class="pre">NULL</span></tt>.</p>
2160
<dl class="attribute">
2161
<dt id="sqlalchemy.sql.expression.ColumnElement.__init__">
2162
<tt class="descname">__init__</tt><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.__init__" title="Permalink to this definition">¶</a></dt>
2163
<dd><div class="inherited-member container">
2164
<em>inherited from the</em> <tt class="xref py py-attr docutils literal"><span class="pre">__init__</span></tt> <em>attribute of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
2165
<p>x.__init__(...) initializes x; see help(type(x)) for signature</p>
2169
<dt id="sqlalchemy.sql.expression.ColumnElement.__le__">
2170
<tt class="descname">__le__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.__le__" title="Permalink to this definition">¶</a></dt>
2171
<dd><div class="inherited-member container">
2172
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__le__" title="sqlalchemy.sql.operators.ColumnOperators.__le__"><tt class="xref py py-meth docutils literal"><span class="pre">__le__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2173
<p>Implement the <tt class="docutils literal"><span class="pre"><=</span></tt> operator.</p>
2174
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre"><=</span> <span class="pre">b</span></tt>.</p>
2178
<dt id="sqlalchemy.sql.expression.ColumnElement.__lt__">
2179
<tt class="descname">__lt__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.__lt__" title="Permalink to this definition">¶</a></dt>
2180
<dd><div class="inherited-member container">
2181
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__lt__" title="sqlalchemy.sql.operators.ColumnOperators.__lt__"><tt class="xref py py-meth docutils literal"><span class="pre">__lt__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2182
<p>Implement the <tt class="docutils literal"><span class="pre"><</span></tt> operator.</p>
2183
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre"><</span> <span class="pre">b</span></tt>.</p>
2187
<dt id="sqlalchemy.sql.expression.ColumnElement.__ne__">
2188
<tt class="descname">__ne__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.__ne__" title="Permalink to this definition">¶</a></dt>
2189
<dd><div class="inherited-member container">
2190
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__ne__" title="sqlalchemy.sql.operators.ColumnOperators.__ne__"><tt class="xref py py-meth docutils literal"><span class="pre">__ne__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2191
<p>Implement the <tt class="docutils literal"><span class="pre">!=</span></tt> operator.</p>
2192
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">!=</span> <span class="pre">b</span></tt>.
2193
If the target is <tt class="docutils literal"><span class="pre">None</span></tt>, produces <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IS</span> <span class="pre">NOT</span> <span class="pre">NULL</span></tt>.</p>
2196
<dl class="attribute">
2197
<dt id="sqlalchemy.sql.expression.ColumnElement.anon_label">
2198
<tt class="descname">anon_label</tt><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.anon_label" title="Permalink to this definition">¶</a></dt>
2199
<dd><p>provides a constant ‘anonymous label’ for this ColumnElement.</p>
2200
<p>This is a label() expression which will be named at compile time.
2201
The same label() is returned each time anon_label is called so
2202
that expressions can reference anon_label multiple times, producing
2203
the same label name at compile time.</p>
2204
<p>the compiler uses this function automatically at compile time
2205
for expressions that are known to be ‘unnamed’ like binary
2206
expressions and function calls.</p>
2210
<dt id="sqlalchemy.sql.expression.ColumnElement.asc">
2211
<tt class="descname">asc</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.asc" title="Permalink to this definition">¶</a></dt>
2212
<dd><div class="inherited-member container">
2213
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.asc" title="sqlalchemy.sql.operators.ColumnOperators.asc"><tt class="xref py py-meth docutils literal"><span class="pre">asc()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2214
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.asc" title="sqlalchemy.sql.expression.asc"><tt class="xref py py-func docutils literal"><span class="pre">asc()</span></tt></a> clause against the
2219
<dt id="sqlalchemy.sql.expression.ColumnElement.between">
2220
<tt class="descname">between</tt><big>(</big><em>cleft</em>, <em>cright</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.between" title="Permalink to this definition">¶</a></dt>
2221
<dd><div class="inherited-member container">
2222
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.between" title="sqlalchemy.sql.operators.ColumnOperators.between"><tt class="xref py py-meth docutils literal"><span class="pre">between()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2223
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.between" title="sqlalchemy.sql.expression.between"><tt class="xref py py-func docutils literal"><span class="pre">between()</span></tt></a> clause against
2224
the parent object, given the lower and upper range.</p>
2228
<dt id="sqlalchemy.sql.expression.ColumnElement.collate">
2229
<tt class="descname">collate</tt><big>(</big><em>collation</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.collate" title="Permalink to this definition">¶</a></dt>
2230
<dd><div class="inherited-member container">
2231
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.collate" title="sqlalchemy.sql.operators.ColumnOperators.collate"><tt class="xref py py-meth docutils literal"><span class="pre">collate()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2232
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.collate" title="sqlalchemy.sql.expression.collate"><tt class="xref py py-func docutils literal"><span class="pre">collate()</span></tt></a> clause against
2233
the parent object, given the collation string.</p>
2237
<dt id="sqlalchemy.sql.expression.ColumnElement.compare">
2238
<tt class="descname">compare</tt><big>(</big><em>other</em>, <em>use_proxies=False</em>, <em>equivalents=None</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.compare" title="Permalink to this definition">¶</a></dt>
2239
<dd><p>Compare this ColumnElement to another.</p>
2240
<p>Special arguments understood:</p>
2241
<table class="docutils field-list" frame="void" rules="none">
2242
<col class="field-name" />
2243
<col class="field-body" />
2244
<tbody valign="top">
2245
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
2246
<li><strong>use_proxies</strong> – when True, consider two columns that
2247
share a common base column as equivalent (i.e. shares_lineage())</li>
2248
<li><strong>equivalents</strong> – a dictionary of columns as keys mapped to sets
2249
of columns. If the given “other” column is present in this
2250
dictionary, if any of the columns in the corresponding set() pass the
2251
comparison test, the result is True. This is used to expand the
2252
comparison to other columns that may be known to be equivalent to
2253
this one via foreign key or other criterion.</li>
2262
<dt id="sqlalchemy.sql.expression.ColumnElement.compile">
2263
<tt class="descname">compile</tt><big>(</big><em>bind=None</em>, <em>dialect=None</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.compile" title="Permalink to this definition">¶</a></dt>
2264
<dd><div class="inherited-member container">
2265
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.compile" title="sqlalchemy.sql.expression.ClauseElement.compile"><tt class="xref py py-meth docutils literal"><span class="pre">compile()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
2266
<p>Compile this SQL expression.</p>
2267
<p>The return value is a <a class="reference internal" href="internals.html#sqlalchemy.engine.interfaces.Compiled" title="sqlalchemy.engine.interfaces.Compiled"><tt class="xref py py-class docutils literal"><span class="pre">Compiled</span></tt></a> object.
2268
Calling <tt class="docutils literal"><span class="pre">str()</span></tt> or <tt class="docutils literal"><span class="pre">unicode()</span></tt> on the returned value will yield a
2269
string representation of the result. The
2270
<a class="reference internal" href="internals.html#sqlalchemy.engine.interfaces.Compiled" title="sqlalchemy.engine.interfaces.Compiled"><tt class="xref py py-class docutils literal"><span class="pre">Compiled</span></tt></a> object also can return a
2271
dictionary of bind parameter names and values
2272
using the <tt class="docutils literal"><span class="pre">params</span></tt> accessor.</p>
2273
<table class="docutils field-list" frame="void" rules="none">
2274
<col class="field-name" />
2275
<col class="field-body" />
2276
<tbody valign="top">
2277
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
2278
<li><strong>bind</strong> – An <tt class="docutils literal"><span class="pre">Engine</span></tt> or <tt class="docutils literal"><span class="pre">Connection</span></tt> from which a
2279
<tt class="docutils literal"><span class="pre">Compiled</span></tt> will be acquired. This argument takes precedence over
2280
this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>‘s bound engine, if any.</li>
2281
<li><strong>column_keys</strong> – Used for INSERT and UPDATE statements, a list of
2282
column names which should be present in the VALUES clause of the
2283
compiled statement. If <tt class="docutils literal"><span class="pre">None</span></tt>, all columns from the target table
2284
object are rendered.</li>
2285
<li><strong>dialect</strong> – A <tt class="docutils literal"><span class="pre">Dialect</span></tt> instance from which a <tt class="docutils literal"><span class="pre">Compiled</span></tt>
2286
will be acquired. This argument takes precedence over the <cite>bind</cite>
2287
argument as well as this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>‘s bound engine, if
2289
<li><strong>inline</strong> – Used for INSERT statements, for a dialect which does
2290
not support inline retrieval of newly generated primary key
2291
columns, will force the expression used to create the new primary
2292
key value to be rendered inline within the INSERT statement’s
2293
VALUES clause. This typically refers to Sequence execution but may
2294
also refer to any server-side default generation function
2295
associated with a primary key <cite>Column</cite>.</li>
2304
<dt id="sqlalchemy.sql.expression.ColumnElement.concat">
2305
<tt class="descname">concat</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.concat" title="Permalink to this definition">¶</a></dt>
2306
<dd><div class="inherited-member container">
2307
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.concat" title="sqlalchemy.sql.operators.ColumnOperators.concat"><tt class="xref py py-meth docutils literal"><span class="pre">concat()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2308
<p>Implement the ‘concat’ operator.</p>
2309
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">||</span> <span class="pre">b</span></tt>,
2310
or uses the <tt class="docutils literal"><span class="pre">concat()</span></tt> operator on MySQL.</p>
2314
<dt id="sqlalchemy.sql.expression.ColumnElement.contains">
2315
<tt class="descname">contains</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.contains" title="Permalink to this definition">¶</a></dt>
2316
<dd><div class="inherited-member container">
2317
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.contains" title="sqlalchemy.sql.operators.ColumnOperators.contains"><tt class="xref py py-meth docutils literal"><span class="pre">contains()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2318
<p>Implement the ‘contains’ operator.</p>
2319
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%<other>%'</span></tt></p>
2323
<dt id="sqlalchemy.sql.expression.ColumnElement.desc">
2324
<tt class="descname">desc</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.desc" title="Permalink to this definition">¶</a></dt>
2325
<dd><div class="inherited-member container">
2326
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.desc" title="sqlalchemy.sql.operators.ColumnOperators.desc"><tt class="xref py py-meth docutils literal"><span class="pre">desc()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2327
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.desc" title="sqlalchemy.sql.expression.desc"><tt class="xref py py-func docutils literal"><span class="pre">desc()</span></tt></a> clause against the
2332
<dt id="sqlalchemy.sql.expression.ColumnElement.distinct">
2333
<tt class="descname">distinct</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.distinct" title="Permalink to this definition">¶</a></dt>
2334
<dd><div class="inherited-member container">
2335
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.distinct" title="sqlalchemy.sql.operators.ColumnOperators.distinct"><tt class="xref py py-meth docutils literal"><span class="pre">distinct()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2336
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.distinct" title="sqlalchemy.sql.expression.distinct"><tt class="xref py py-func docutils literal"><span class="pre">distinct()</span></tt></a> clause against the
2341
<dt id="sqlalchemy.sql.expression.ColumnElement.endswith">
2342
<tt class="descname">endswith</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.endswith" title="Permalink to this definition">¶</a></dt>
2343
<dd><div class="inherited-member container">
2344
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.endswith" title="sqlalchemy.sql.operators.ColumnOperators.endswith"><tt class="xref py py-meth docutils literal"><span class="pre">endswith()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2345
<p>Implement the ‘endswith’ operator.</p>
2346
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%<other>'</span></tt></p>
2349
<dl class="attribute">
2350
<dt id="sqlalchemy.sql.expression.ColumnElement.expression">
2351
<tt class="descname">expression</tt><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.expression" title="Permalink to this definition">¶</a></dt>
2352
<dd><p>Return a column expression.</p>
2353
<p>Part of the inspection interface; returns self.</p>
2357
<dt id="sqlalchemy.sql.expression.ColumnElement.get_children">
2358
<tt class="descname">get_children</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.get_children" title="Permalink to this definition">¶</a></dt>
2359
<dd><div class="inherited-member container">
2360
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.get_children" title="sqlalchemy.sql.expression.ClauseElement.get_children"><tt class="xref py py-meth docutils literal"><span class="pre">get_children()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
2361
<p>Return immediate child elements of this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>.</p>
2362
<p>This is used for visit traversal.</p>
2363
<p>**kwargs may contain flags that change the collection that is
2364
returned, for example to return a subset of items in order to
2365
cut down on larger traversals, or to return child items from a
2366
different context (such as schema-level collections instead of
2371
<dt id="sqlalchemy.sql.expression.ColumnElement.ilike">
2372
<tt class="descname">ilike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.ilike" title="Permalink to this definition">¶</a></dt>
2373
<dd><div class="inherited-member container">
2374
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ilike()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2375
<p>Implement the <tt class="docutils literal"><span class="pre">ilike</span></tt> operator.</p>
2376
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">ILIKE</span> <span class="pre">other</span></tt>.</p>
2378
<div class="highlight-python"><div class="highlight"><pre><span class="n">select</span><span class="p">([</span><span class="n">sometable</span><span class="p">])</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">sometable</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">column</span><span class="o">.</span><span class="n">ilike</span><span class="p">(</span><span class="s">"</span><span class="si">%f</span><span class="s">oobar%"</span><span class="p">))</span></pre></div>
2380
<table class="docutils field-list" frame="void" rules="none">
2381
<col class="field-name" />
2382
<col class="field-body" />
2383
<tbody valign="top">
2384
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
2385
<li><strong>other</strong> – expression to be compared</li>
2386
<li><strong>escape</strong> – <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
2388
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">ilike</span><span class="p">(</span><span class="s">"foo/%bar"</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">"/"</span><span class="p">)</span></pre></div>
2396
<div class="admonition seealso">
2397
<p class="first admonition-title">See also</p>
2398
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a></p>
2403
<dt id="sqlalchemy.sql.expression.ColumnElement.in_">
2404
<tt class="descname">in_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.in_" title="Permalink to this definition">¶</a></dt>
2405
<dd><div class="inherited-member container">
2406
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="sqlalchemy.sql.operators.ColumnOperators.in_"><tt class="xref py py-meth docutils literal"><span class="pre">in_()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2407
<p>Implement the <tt class="docutils literal"><span class="pre">in</span></tt> operator.</p>
2408
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IN</span> <span class="pre">other</span></tt>.
2409
“other” may be a tuple/list of column expressions,
2410
or 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.</p>
2414
<dt id="sqlalchemy.sql.expression.ColumnElement.is_">
2415
<tt class="descname">is_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.is_" title="Permalink to this definition">¶</a></dt>
2416
<dd><div class="inherited-member container">
2417
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.is_" title="sqlalchemy.sql.operators.ColumnOperators.is_"><tt class="xref py py-meth docutils literal"><span class="pre">is_()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2418
<p>Implement the <tt class="docutils literal"><span class="pre">IS</span></tt> operator.</p>
2419
<p>Normally, <tt class="docutils literal"><span class="pre">IS</span></tt> is generated automatically when comparing to a
2420
value of <tt class="docutils literal"><span class="pre">None</span></tt>, which resolves to <tt class="docutils literal"><span class="pre">NULL</span></tt>. However, explicit
2421
usage of <tt class="docutils literal"><span class="pre">IS</span></tt> may be desirable if comparing to boolean values
2422
on certain platforms.</p>
2423
<div class="versionadded">
2424
<p><span>New in version 0.7.9.</span></p>
2426
<div class="admonition seealso">
2427
<p class="first admonition-title">See also</p>
2428
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.isnot" title="sqlalchemy.sql.operators.ColumnOperators.isnot"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.isnot()</span></tt></a></p>
2433
<dt id="sqlalchemy.sql.expression.ColumnElement.isnot">
2434
<tt class="descname">isnot</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.isnot" title="Permalink to this definition">¶</a></dt>
2435
<dd><div class="inherited-member container">
2436
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.isnot" title="sqlalchemy.sql.operators.ColumnOperators.isnot"><tt class="xref py py-meth docutils literal"><span class="pre">isnot()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2437
<p>Implement the <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> operator.</p>
2438
<p>Normally, <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> is generated automatically when comparing to a
2439
value of <tt class="docutils literal"><span class="pre">None</span></tt>, which resolves to <tt class="docutils literal"><span class="pre">NULL</span></tt>. However, explicit
2440
usage of <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> may be desirable if comparing to boolean values
2441
on certain platforms.</p>
2442
<div class="versionadded">
2443
<p><span>New in version 0.7.9.</span></p>
2445
<div class="admonition seealso">
2446
<p class="first admonition-title">See also</p>
2447
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.is_" title="sqlalchemy.sql.operators.ColumnOperators.is_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.is_()</span></tt></a></p>
2452
<dt id="sqlalchemy.sql.expression.ColumnElement.label">
2453
<tt class="descname">label</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.label" title="Permalink to this definition">¶</a></dt>
2454
<dd><p>Produce a column label, i.e. <tt class="docutils literal"><span class="pre"><columnname></span> <span class="pre">AS</span> <span class="pre"><name></span></tt>.</p>
2455
<p>This is a shortcut to the <a class="reference internal" href="#sqlalchemy.sql.expression.label" title="sqlalchemy.sql.expression.label"><tt class="xref py py-func docutils literal"><span class="pre">label()</span></tt></a> function.</p>
2456
<p>if ‘name’ is None, an anonymous label name will be generated.</p>
2460
<dt id="sqlalchemy.sql.expression.ColumnElement.like">
2461
<tt class="descname">like</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.like" title="Permalink to this definition">¶</a></dt>
2462
<dd><div class="inherited-member container">
2463
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">like()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2464
<p>Implement the <tt class="docutils literal"><span class="pre">like</span></tt> operator.</p>
2465
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">LIKE</span> <span class="pre">other</span></tt>.</p>
2467
<div class="highlight-python"><div class="highlight"><pre><span class="n">select</span><span class="p">([</span><span class="n">sometable</span><span class="p">])</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">sometable</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">column</span><span class="o">.</span><span class="n">like</span><span class="p">(</span><span class="s">"</span><span class="si">%f</span><span class="s">oobar%"</span><span class="p">))</span></pre></div>
2469
<table class="docutils field-list" frame="void" rules="none">
2470
<col class="field-name" />
2471
<col class="field-body" />
2472
<tbody valign="top">
2473
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
2474
<li><strong>other</strong> – expression to be compared</li>
2475
<li><strong>escape</strong> – <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
2477
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">like</span><span class="p">(</span><span class="s">"foo/%bar"</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">"/"</span><span class="p">)</span></pre></div>
2485
<div class="admonition seealso">
2486
<p class="first admonition-title">See also</p>
2487
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a></p>
2492
<dt id="sqlalchemy.sql.expression.ColumnElement.match">
2493
<tt class="descname">match</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.match" title="Permalink to this definition">¶</a></dt>
2494
<dd><div class="inherited-member container">
2495
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.match" title="sqlalchemy.sql.operators.ColumnOperators.match"><tt class="xref py py-meth docutils literal"><span class="pre">match()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2496
<p>Implements the ‘match’ operator.</p>
2497
<p>In a column context, this produces a MATCH clause, i.e.
2498
<tt class="docutils literal"><span class="pre">MATCH</span> <span class="pre">'<other>'</span></tt>. The allowed contents of <tt class="docutils literal"><span class="pre">other</span></tt>
2499
are database backend specific.</p>
2503
<dt id="sqlalchemy.sql.expression.ColumnElement.notilike">
2504
<tt class="descname">notilike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.notilike" title="Permalink to this definition">¶</a></dt>
2505
<dd><div class="inherited-member container">
2506
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.notilike" title="sqlalchemy.sql.operators.ColumnOperators.notilike"><tt class="xref py py-meth docutils literal"><span class="pre">notilike()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2507
<p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">ILIKE</span></tt> operator.</p>
2508
<p>This is equivalent to using negation with
2509
<a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a>, i.e. <tt class="docutils literal"><span class="pre">~x.ilike(y)</span></tt>.</p>
2510
<div class="versionadded">
2511
<p><span>New in version 0.8.</span></p>
2513
<div class="admonition seealso">
2514
<p class="first admonition-title">See also</p>
2515
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a></p>
2520
<dt id="sqlalchemy.sql.expression.ColumnElement.notin_">
2521
<tt class="descname">notin_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.notin_" title="Permalink to this definition">¶</a></dt>
2522
<dd><div class="inherited-member container">
2523
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.notin_" title="sqlalchemy.sql.operators.ColumnOperators.notin_"><tt class="xref py py-meth docutils literal"><span class="pre">notin_()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2524
<p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">IN</span></tt> operator.</p>
2525
<p>This is equivalent to using negation with <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="sqlalchemy.sql.operators.ColumnOperators.in_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.in_()</span></tt></a>,
2526
i.e. <tt class="docutils literal"><span class="pre">~x.in_(y)</span></tt>.</p>
2527
<div class="versionadded">
2528
<p><span>New in version 0.8.</span></p>
2530
<div class="admonition seealso">
2531
<p class="first admonition-title">See also</p>
2532
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="sqlalchemy.sql.operators.ColumnOperators.in_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.in_()</span></tt></a></p>
2537
<dt id="sqlalchemy.sql.expression.ColumnElement.notlike">
2538
<tt class="descname">notlike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.notlike" title="Permalink to this definition">¶</a></dt>
2539
<dd><div class="inherited-member container">
2540
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.notlike" title="sqlalchemy.sql.operators.ColumnOperators.notlike"><tt class="xref py py-meth docutils literal"><span class="pre">notlike()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2541
<p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">LIKE</span></tt> operator.</p>
2542
<p>This is equivalent to using negation with
2543
<a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a>, i.e. <tt class="docutils literal"><span class="pre">~x.like(y)</span></tt>.</p>
2544
<div class="versionadded">
2545
<p><span>New in version 0.8.</span></p>
2547
<div class="admonition seealso">
2548
<p class="first admonition-title">See also</p>
2549
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a></p>
2554
<dt id="sqlalchemy.sql.expression.ColumnElement.nullsfirst">
2555
<tt class="descname">nullsfirst</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.nullsfirst" title="Permalink to this definition">¶</a></dt>
2556
<dd><div class="inherited-member container">
2557
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.nullsfirst" title="sqlalchemy.sql.operators.ColumnOperators.nullsfirst"><tt class="xref py py-meth docutils literal"><span class="pre">nullsfirst()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2558
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.nullsfirst" title="sqlalchemy.sql.expression.nullsfirst"><tt class="xref py py-func docutils literal"><span class="pre">nullsfirst()</span></tt></a> clause against the
2563
<dt id="sqlalchemy.sql.expression.ColumnElement.nullslast">
2564
<tt class="descname">nullslast</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.nullslast" title="Permalink to this definition">¶</a></dt>
2565
<dd><div class="inherited-member container">
2566
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.nullslast" title="sqlalchemy.sql.operators.ColumnOperators.nullslast"><tt class="xref py py-meth docutils literal"><span class="pre">nullslast()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2567
<p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.nullslast" title="sqlalchemy.sql.expression.nullslast"><tt class="xref py py-func docutils literal"><span class="pre">nullslast()</span></tt></a> clause against the
2572
<dt id="sqlalchemy.sql.expression.ColumnElement.op">
2573
<tt class="descname">op</tt><big>(</big><em>opstring</em>, <em>precedence=0</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.op" title="Permalink to this definition">¶</a></dt>
2574
<dd><div class="inherited-member container">
2575
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators.op" title="sqlalchemy.sql.operators.Operators.op"><tt class="xref py py-meth docutils literal"><span class="pre">op()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators" title="sqlalchemy.sql.operators.Operators"><tt class="xref py py-class docutils literal"><span class="pre">Operators</span></tt></a></div>
2576
<p>produce a generic operator function.</p>
2578
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">op</span><span class="p">(</span><span class="s">"*"</span><span class="p">)(</span><span class="mi">5</span><span class="p">)</span></pre></div>
2581
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span> <span class="o">*</span> <span class="mi">5</span></pre></div>
2583
<p>This function can also be used to make bitwise operators explicit. For
2585
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">op</span><span class="p">(</span><span class="s">'&'</span><span class="p">)(</span><span class="mh">0xff</span><span class="p">)</span></pre></div>
2587
<p>is a bitwise AND of the value in <tt class="docutils literal"><span class="pre">somecolumn</span></tt>.</p>
2588
<table class="docutils field-list" frame="void" rules="none">
2589
<col class="field-name" />
2590
<col class="field-body" />
2591
<tbody valign="top">
2592
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
2593
<li><strong>operator</strong> – a string which will be output as the infix operator
2594
between this element and the expression passed to the
2595
generated function.</li>
2596
<li><strong>precedence</strong> – <p>precedence to apply to the operator, when
2597
parenthesizing expressions. A lower number will cause the expression
2598
to be parenthesized when applied against another operator with
2599
higher precedence. The default value of <tt class="docutils literal"><span class="pre">0</span></tt> is lower than all
2600
operators except for the comma (<tt class="docutils literal"><span class="pre">,</span></tt>) and <tt class="docutils literal"><span class="pre">AS</span></tt> operators.
2601
A value of 100 will be higher or equal to all operators, and -100
2602
will be lower than or equal to all operators.</p>
2603
<div class="versionadded">
2604
<p><span>New in version 0.8: </span>- added the ‘precedence’ argument.</p>
2612
<div class="admonition seealso">
2613
<p class="first admonition-title">See also</p>
2614
<p class="last"><a class="reference internal" href="types.html#types-operators"><em>Redefining and Creating New Operators</em></a></p>
2619
<dt id="sqlalchemy.sql.expression.ColumnElement.params">
2620
<tt class="descname">params</tt><big>(</big><em>*optionaldict</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.params" title="Permalink to this definition">¶</a></dt>
2621
<dd><div class="inherited-member container">
2622
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.params" title="sqlalchemy.sql.expression.ClauseElement.params"><tt class="xref py py-meth docutils literal"><span class="pre">params()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
2623
<p>Return a copy with <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a> elements replaced.</p>
2624
<p>Returns a copy of this ClauseElement with <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a>
2625
elements replaced with values taken from the given dictionary:</p>
2626
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">clause</span> <span class="o">=</span> <span class="n">column</span><span class="p">(</span><span class="s">'x'</span><span class="p">)</span> <span class="o">+</span> <span class="n">bindparam</span><span class="p">(</span><span class="s">'foo'</span><span class="p">)</span>
2627
<span class="gp">>>> </span><span class="k">print</span> <span class="n">clause</span><span class="o">.</span><span class="n">compile</span><span class="p">()</span><span class="o">.</span><span class="n">params</span>
2628
<span class="go">{'foo':None}</span>
2629
<span class="gp">>>> </span><span class="k">print</span> <span class="n">clause</span><span class="o">.</span><span class="n">params</span><span class="p">({</span><span class="s">'foo'</span><span class="p">:</span><span class="mi">7</span><span class="p">})</span><span class="o">.</span><span class="n">compile</span><span class="p">()</span><span class="o">.</span><span class="n">params</span>
2630
<span class="go">{'foo':7}</span></pre></div>
2635
<dt id="sqlalchemy.sql.expression.ColumnElement.self_group">
2636
<tt class="descname">self_group</tt><big>(</big><em>against=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.self_group" title="Permalink to this definition">¶</a></dt>
2637
<dd><div class="inherited-member container">
2638
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.self_group" title="sqlalchemy.sql.expression.ClauseElement.self_group"><tt class="xref py py-meth docutils literal"><span class="pre">self_group()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
2639
<p>Apply a ‘grouping’ to this <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>.</p>
2640
<p>This method is overridden by subclasses to return a
2641
“grouping” construct, i.e. parenthesis. In particular
2642
it’s used by “binary” expressions to provide a grouping
2643
around themselves when placed into a larger expression,
2644
as well as by <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> constructs when placed into
2645
the FROM clause of another <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>. (Note that
2646
subqueries should be normally created using the
2647
<tt class="xref py py-func docutils literal"><span class="pre">Select.alias()</span></tt> method, as many platforms require
2648
nested SELECT statements to be named).</p>
2649
<p>As expressions are composed together, the application of
2650
<a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement.self_group" title="sqlalchemy.sql.expression.ColumnElement.self_group"><tt class="xref py py-meth docutils literal"><span class="pre">self_group()</span></tt></a> is automatic - end-user code should never
2651
need to use this method directly. Note that SQLAlchemy’s
2652
clause constructs take operator precedence into account -
2653
so parenthesis might not be needed, for example, in
2654
an expression like <tt class="docutils literal"><span class="pre">x</span> <span class="pre">OR</span> <span class="pre">(y</span> <span class="pre">AND</span> <span class="pre">z)</span></tt> - AND takes precedence
2656
<p>The base <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement.self_group" title="sqlalchemy.sql.expression.ColumnElement.self_group"><tt class="xref py py-meth docutils literal"><span class="pre">self_group()</span></tt></a> method of <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>
2657
just returns self.</p>
2661
<dt id="sqlalchemy.sql.expression.ColumnElement.shares_lineage">
2662
<tt class="descname">shares_lineage</tt><big>(</big><em>othercolumn</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.shares_lineage" title="Permalink to this definition">¶</a></dt>
2663
<dd><p>Return True if the given <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>
2664
has a common ancestor to this <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>.</p>
2668
<dt id="sqlalchemy.sql.expression.ColumnElement.startswith">
2669
<tt class="descname">startswith</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.startswith" title="Permalink to this definition">¶</a></dt>
2670
<dd><div class="inherited-member container">
2671
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.startswith" title="sqlalchemy.sql.operators.ColumnOperators.startswith"><tt class="xref py py-meth docutils literal"><span class="pre">startswith()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></div>
2672
<p>Implement the <tt class="docutils literal"><span class="pre">startwith</span></tt> operator.</p>
2673
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'<other>%'</span></tt></p>
2677
<dt id="sqlalchemy.sql.expression.ColumnElement.unique_params">
2678
<tt class="descname">unique_params</tt><big>(</big><em>*optionaldict</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.ColumnElement.unique_params" title="Permalink to this definition">¶</a></dt>
2679
<dd><div class="inherited-member container">
2680
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement.unique_params" title="sqlalchemy.sql.expression.ClauseElement.unique_params"><tt class="xref py py-meth docutils literal"><span class="pre">unique_params()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a></div>
2681
<p>Return a copy with <a class="reference internal" href="#sqlalchemy.sql.expression.bindparam" title="sqlalchemy.sql.expression.bindparam"><tt class="xref py py-func docutils literal"><span class="pre">bindparam()</span></tt></a> elements replaced.</p>
2682
<p>Same functionality as <tt class="docutils literal"><span class="pre">params()</span></tt>, except adds <cite>unique=True</cite>
2683
to affected bind parameters so that multiple statements can be
2690
<dt id="sqlalchemy.sql.operators.ColumnOperators">
2691
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.operators.</tt><tt class="descname">ColumnOperators</tt><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators" title="Permalink to this definition">¶</a></dt>
2692
<dd><p>Bases: <a class="reference internal" href="#sqlalchemy.sql.operators.Operators" title="sqlalchemy.sql.operators.Operators"><tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.sql.operators.Operators</span></tt></a></p>
2693
<p>Defines boolean, comparison, and other operators for
2694
<a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> expressions.</p>
2695
<p>By default, all methods call down to
2696
<a class="reference internal" href="#sqlalchemy.sql.operators.Operators.operate" title="sqlalchemy.sql.operators.Operators.operate"><tt class="xref py py-meth docutils literal"><span class="pre">operate()</span></tt></a> or <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.reverse_operate" title="sqlalchemy.sql.operators.ColumnOperators.reverse_operate"><tt class="xref py py-meth docutils literal"><span class="pre">reverse_operate()</span></tt></a>,
2697
passing in the appropriate operator function from the
2698
Python builtin <tt class="docutils literal"><span class="pre">operator</span></tt> module or
2699
a SQLAlchemy-specific operator function from
2700
<tt class="xref py py-mod docutils literal"><span class="pre">sqlalchemy.expression.operators</span></tt>. For example
2701
the <tt class="docutils literal"><span class="pre">__eq__</span></tt> function:</p>
2702
<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
2703
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">operate</span><span class="p">(</span><span class="n">operators</span><span class="o">.</span><span class="n">eq</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span></pre></div>
2705
<p>Where <tt class="docutils literal"><span class="pre">operators.eq</span></tt> is essentially:</p>
2706
<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">eq</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
2707
<span class="k">return</span> <span class="n">a</span> <span class="o">==</span> <span class="n">b</span></pre></div>
2709
<p>The core column expression unit <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a>
2710
overrides <a class="reference internal" href="#sqlalchemy.sql.operators.Operators.operate" title="sqlalchemy.sql.operators.Operators.operate"><tt class="xref py py-meth docutils literal"><span class="pre">Operators.operate()</span></tt></a> and others
2711
to return further <a class="reference internal" href="#sqlalchemy.sql.expression.ColumnElement" title="sqlalchemy.sql.expression.ColumnElement"><tt class="xref py py-class docutils literal"><span class="pre">ColumnElement</span></tt></a> constructs,
2712
so that the <tt class="docutils literal"><span class="pre">==</span></tt> operation above is replaced by a clause
2715
<p><a class="reference internal" href="types.html#types-operators"><em>Redefining and Creating New Operators</em></a></p>
2716
<p><a class="reference internal" href="types.html#sqlalchemy.types.TypeEngine.comparator_factory" title="sqlalchemy.types.TypeEngine.comparator_factory"><tt class="xref py py-attr docutils literal"><span class="pre">TypeEngine.comparator_factory</span></tt></a></p>
2717
<p><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a></p>
2718
<p><a class="reference internal" href="../orm/internals.html#sqlalchemy.orm.interfaces.PropComparator" title="sqlalchemy.orm.interfaces.PropComparator"><tt class="xref py py-class docutils literal"><span class="pre">PropComparator</span></tt></a></p>
2720
<dt id="sqlalchemy.sql.operators.ColumnOperators.__add__">
2721
<tt class="descname">__add__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__add__" title="Permalink to this definition">¶</a></dt>
2722
<dd><p>Implement the <tt class="docutils literal"><span class="pre">+</span></tt> operator.</p>
2723
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">+</span> <span class="pre">b</span></tt>
2724
if the parent object has non-string affinity.
2725
If the parent object has a string affinity,
2726
produces the concatenation operator, <tt class="docutils literal"><span class="pre">a</span> <span class="pre">||</span> <span class="pre">b</span></tt> -
2727
see <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.concat" title="sqlalchemy.sql.operators.ColumnOperators.concat"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.concat()</span></tt></a>.</p>
2731
<dt id="sqlalchemy.sql.operators.ColumnOperators.__and__">
2732
<tt class="descname">__and__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__and__" title="Permalink to this definition">¶</a></dt>
2733
<dd><div class="inherited-member container">
2734
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators.__and__" title="sqlalchemy.sql.operators.Operators.__and__"><tt class="xref py py-meth docutils literal"><span class="pre">__and__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators" title="sqlalchemy.sql.operators.Operators"><tt class="xref py py-class docutils literal"><span class="pre">Operators</span></tt></a></div>
2735
<p>Implement the <tt class="docutils literal"><span class="pre">&</span></tt> operator.</p>
2736
<p>When used with SQL expressions, results in an
2737
AND operation, equivalent to
2738
<a class="reference internal" href="#sqlalchemy.sql.expression.and_" title="sqlalchemy.sql.expression.and_"><tt class="xref py py-func docutils literal"><span class="pre">and_()</span></tt></a>, that is:</p>
2739
<div class="highlight-python"><div class="highlight"><pre><span class="n">a</span> <span class="o">&</span> <span class="n">b</span></pre></div>
2741
<p>is equivalent to:</p>
2742
<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">and_</span>
2743
<span class="n">and_</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span></pre></div>
2745
<p>Care should be taken when using <tt class="docutils literal"><span class="pre">&</span></tt> regarding
2746
operator precedence; the <tt class="docutils literal"><span class="pre">&</span></tt> operator has the highest precedence.
2747
The operands should be enclosed in parenthesis if they contain
2748
further sub expressions:</p>
2749
<div class="highlight-python"><div class="highlight"><pre><span class="p">(</span><span class="n">a</span> <span class="o">==</span> <span class="mi">2</span><span class="p">)</span> <span class="o">&</span> <span class="p">(</span><span class="n">b</span> <span class="o">==</span> <span class="mi">4</span><span class="p">)</span></pre></div>
2753
<dl class="attribute">
2754
<dt id="sqlalchemy.sql.operators.ColumnOperators.__delattr__">
2755
<tt class="descname">__delattr__</tt><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__delattr__" title="Permalink to this definition">¶</a></dt>
2756
<dd><div class="inherited-member container">
2757
<em>inherited from the</em> <tt class="xref py py-attr docutils literal"><span class="pre">__delattr__</span></tt> <em>attribute of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
2758
<p>x.__delattr__(‘name’) <==> del x.name</p>
2762
<dt id="sqlalchemy.sql.operators.ColumnOperators.__div__">
2763
<tt class="descname">__div__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__div__" title="Permalink to this definition">¶</a></dt>
2764
<dd><p>Implement the <tt class="docutils literal"><span class="pre">/</span></tt> operator.</p>
2765
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">/</span> <span class="pre">b</span></tt>.</p>
2769
<dt id="sqlalchemy.sql.operators.ColumnOperators.__eq__">
2770
<tt class="descname">__eq__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__eq__" title="Permalink to this definition">¶</a></dt>
2771
<dd><p>Implement the <tt class="docutils literal"><span class="pre">==</span></tt> operator.</p>
2772
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">=</span> <span class="pre">b</span></tt>.
2773
If the target is <tt class="docutils literal"><span class="pre">None</span></tt>, produces <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IS</span> <span class="pre">NULL</span></tt>.</p>
2777
<dt id="sqlalchemy.sql.operators.ColumnOperators.__format__">
2778
<tt class="descname">__format__</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__format__" title="Permalink to this definition">¶</a></dt>
2779
<dd><div class="inherited-member container">
2780
<em>inherited from the</em> <tt class="xref py py-meth docutils literal"><span class="pre">__format__()</span></tt> <em>method of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
2781
<p>default object formatter</p>
2785
<dt id="sqlalchemy.sql.operators.ColumnOperators.__ge__">
2786
<tt class="descname">__ge__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__ge__" title="Permalink to this definition">¶</a></dt>
2787
<dd><p>Implement the <tt class="docutils literal"><span class="pre">>=</span></tt> operator.</p>
2788
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">>=</span> <span class="pre">b</span></tt>.</p>
2791
<dl class="attribute">
2792
<dt id="sqlalchemy.sql.operators.ColumnOperators.__getattribute__">
2793
<tt class="descname">__getattribute__</tt><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__getattribute__" title="Permalink to this definition">¶</a></dt>
2794
<dd><div class="inherited-member container">
2795
<em>inherited from the</em> <tt class="xref py py-attr docutils literal"><span class="pre">__getattribute__</span></tt> <em>attribute of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
2796
<p>x.__getattribute__(‘name’) <==> x.name</p>
2800
<dt id="sqlalchemy.sql.operators.ColumnOperators.__getitem__">
2801
<tt class="descname">__getitem__</tt><big>(</big><em>index</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__getitem__" title="Permalink to this definition">¶</a></dt>
2802
<dd><p>Implement the [] operator.</p>
2803
<p>This can be used by some database-specific types
2804
such as Postgresql ARRAY and HSTORE.</p>
2808
<dt id="sqlalchemy.sql.operators.ColumnOperators.__gt__">
2809
<tt class="descname">__gt__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__gt__" title="Permalink to this definition">¶</a></dt>
2810
<dd><p>Implement the <tt class="docutils literal"><span class="pre">></span></tt> operator.</p>
2811
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">></span> <span class="pre">b</span></tt>.</p>
2814
<dl class="attribute">
2815
<dt id="sqlalchemy.sql.operators.ColumnOperators.__hash__">
2816
<tt class="descname">__hash__</tt><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__hash__" title="Permalink to this definition">¶</a></dt>
2817
<dd><p>x.__hash__() <==> hash(x)</p>
2820
<dl class="attribute">
2821
<dt id="sqlalchemy.sql.operators.ColumnOperators.__init__">
2822
<tt class="descname">__init__</tt><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__init__" title="Permalink to this definition">¶</a></dt>
2823
<dd><div class="inherited-member container">
2824
<em>inherited from the</em> <tt class="xref py py-attr docutils literal"><span class="pre">__init__</span></tt> <em>attribute of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
2825
<p>x.__init__(...) initializes x; see help(type(x)) for signature</p>
2829
<dt id="sqlalchemy.sql.operators.ColumnOperators.__invert__">
2830
<tt class="descname">__invert__</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__invert__" title="Permalink to this definition">¶</a></dt>
2831
<dd><div class="inherited-member container">
2832
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators.__invert__" title="sqlalchemy.sql.operators.Operators.__invert__"><tt class="xref py py-meth docutils literal"><span class="pre">__invert__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators" title="sqlalchemy.sql.operators.Operators"><tt class="xref py py-class docutils literal"><span class="pre">Operators</span></tt></a></div>
2833
<p>Implement the <tt class="docutils literal"><span class="pre">~</span></tt> operator.</p>
2834
<p>When used with SQL expressions, results in a
2835
NOT operation, equivalent to
2836
<a class="reference internal" href="#sqlalchemy.sql.expression.not_" title="sqlalchemy.sql.expression.not_"><tt class="xref py py-func docutils literal"><span class="pre">not_()</span></tt></a>, that is:</p>
2837
<div class="highlight-python"><div class="highlight"><pre><span class="o">~</span><span class="n">a</span></pre></div>
2839
<p>is equivalent to:</p>
2840
<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">not_</span>
2841
<span class="n">not_</span><span class="p">(</span><span class="n">a</span><span class="p">)</span></pre></div>
2846
<dt id="sqlalchemy.sql.operators.ColumnOperators.__le__">
2847
<tt class="descname">__le__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__le__" title="Permalink to this definition">¶</a></dt>
2848
<dd><p>Implement the <tt class="docutils literal"><span class="pre"><=</span></tt> operator.</p>
2849
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre"><=</span> <span class="pre">b</span></tt>.</p>
2853
<dt id="sqlalchemy.sql.operators.ColumnOperators.__lshift__">
2854
<tt class="descname">__lshift__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__lshift__" title="Permalink to this definition">¶</a></dt>
2855
<dd><p>implement the << operator.</p>
2856
<p>Not used by SQLAlchemy core, this is provided
2857
for custom operator systems which want to use
2858
<< as an extension point.</p>
2862
<dt id="sqlalchemy.sql.operators.ColumnOperators.__lt__">
2863
<tt class="descname">__lt__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__lt__" title="Permalink to this definition">¶</a></dt>
2864
<dd><p>Implement the <tt class="docutils literal"><span class="pre"><</span></tt> operator.</p>
2865
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre"><</span> <span class="pre">b</span></tt>.</p>
2869
<dt id="sqlalchemy.sql.operators.ColumnOperators.__mod__">
2870
<tt class="descname">__mod__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__mod__" title="Permalink to this definition">¶</a></dt>
2871
<dd><p>Implement the <tt class="docutils literal"><span class="pre">%</span></tt> operator.</p>
2872
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">%</span> <span class="pre">b</span></tt>.</p>
2876
<dt id="sqlalchemy.sql.operators.ColumnOperators.__mul__">
2877
<tt class="descname">__mul__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__mul__" title="Permalink to this definition">¶</a></dt>
2878
<dd><p>Implement the <tt class="docutils literal"><span class="pre">*</span></tt> operator.</p>
2879
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">*</span> <span class="pre">b</span></tt>.</p>
2883
<dt id="sqlalchemy.sql.operators.ColumnOperators.__ne__">
2884
<tt class="descname">__ne__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__ne__" title="Permalink to this definition">¶</a></dt>
2885
<dd><p>Implement the <tt class="docutils literal"><span class="pre">!=</span></tt> operator.</p>
2886
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">!=</span> <span class="pre">b</span></tt>.
2887
If the target is <tt class="docutils literal"><span class="pre">None</span></tt>, produces <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IS</span> <span class="pre">NOT</span> <span class="pre">NULL</span></tt>.</p>
2891
<dt id="sqlalchemy.sql.operators.ColumnOperators.__neg__">
2892
<tt class="descname">__neg__</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__neg__" title="Permalink to this definition">¶</a></dt>
2893
<dd><p>Implement the <tt class="docutils literal"><span class="pre">-</span></tt> operator.</p>
2894
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">-a</span></tt>.</p>
2897
<dl class="staticmethod">
2898
<dt id="sqlalchemy.sql.operators.ColumnOperators.__new__">
2899
<em class="property">static </em><tt class="descname">__new__</tt><big>(</big><em>S</em>, <em>...</em><big>)</big> → a new object with type S, a subtype of T<a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__new__" title="Permalink to this definition">¶</a></dt>
2900
<dd><div class="inherited-member container">
2901
<em>inherited from the</em> <tt class="xref py py-meth docutils literal"><span class="pre">__new__()</span></tt> <em>method of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
2905
<dt id="sqlalchemy.sql.operators.ColumnOperators.__or__">
2906
<tt class="descname">__or__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__or__" title="Permalink to this definition">¶</a></dt>
2907
<dd><div class="inherited-member container">
2908
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators.__or__" title="sqlalchemy.sql.operators.Operators.__or__"><tt class="xref py py-meth docutils literal"><span class="pre">__or__()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators" title="sqlalchemy.sql.operators.Operators"><tt class="xref py py-class docutils literal"><span class="pre">Operators</span></tt></a></div>
2909
<p>Implement the <tt class="docutils literal"><span class="pre">|</span></tt> operator.</p>
2910
<p>When used with SQL expressions, results in an
2911
OR operation, equivalent to
2912
<a class="reference internal" href="#sqlalchemy.sql.expression.or_" title="sqlalchemy.sql.expression.or_"><tt class="xref py py-func docutils literal"><span class="pre">or_()</span></tt></a>, that is:</p>
2913
<div class="highlight-python"><div class="highlight"><pre><span class="n">a</span> <span class="o">|</span> <span class="n">b</span></pre></div>
2915
<p>is equivalent to:</p>
2916
<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">or_</span>
2917
<span class="n">or_</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span></pre></div>
2919
<p>Care should be taken when using <tt class="docutils literal"><span class="pre">|</span></tt> regarding
2920
operator precedence; the <tt class="docutils literal"><span class="pre">|</span></tt> operator has the highest precedence.
2921
The operands should be enclosed in parenthesis if they contain
2922
further sub expressions:</p>
2923
<div class="highlight-python"><div class="highlight"><pre><span class="p">(</span><span class="n">a</span> <span class="o">==</span> <span class="mi">2</span><span class="p">)</span> <span class="o">|</span> <span class="p">(</span><span class="n">b</span> <span class="o">==</span> <span class="mi">4</span><span class="p">)</span></pre></div>
2928
<dt id="sqlalchemy.sql.operators.ColumnOperators.__radd__">
2929
<tt class="descname">__radd__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__radd__" title="Permalink to this definition">¶</a></dt>
2930
<dd><p>Implement the <tt class="docutils literal"><span class="pre">+</span></tt> operator in reverse.</p>
2931
<p>See <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__add__" title="sqlalchemy.sql.operators.ColumnOperators.__add__"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.__add__()</span></tt></a>.</p>
2935
<dt id="sqlalchemy.sql.operators.ColumnOperators.__rdiv__">
2936
<tt class="descname">__rdiv__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__rdiv__" title="Permalink to this definition">¶</a></dt>
2937
<dd><p>Implement the <tt class="docutils literal"><span class="pre">/</span></tt> operator in reverse.</p>
2938
<p>See <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__div__" title="sqlalchemy.sql.operators.ColumnOperators.__div__"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.__div__()</span></tt></a>.</p>
2942
<dt id="sqlalchemy.sql.operators.ColumnOperators.__reduce__">
2943
<tt class="descname">__reduce__</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__reduce__" title="Permalink to this definition">¶</a></dt>
2944
<dd><div class="inherited-member container">
2945
<em>inherited from the</em> <tt class="xref py py-meth docutils literal"><span class="pre">__reduce__()</span></tt> <em>method of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
2946
<p>helper for pickle</p>
2950
<dt id="sqlalchemy.sql.operators.ColumnOperators.__reduce_ex__">
2951
<tt class="descname">__reduce_ex__</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__reduce_ex__" title="Permalink to this definition">¶</a></dt>
2952
<dd><div class="inherited-member container">
2953
<em>inherited from the</em> <tt class="xref py py-meth docutils literal"><span class="pre">__reduce_ex__()</span></tt> <em>method of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
2954
<p>helper for pickle</p>
2957
<dl class="attribute">
2958
<dt id="sqlalchemy.sql.operators.ColumnOperators.__repr__">
2959
<tt class="descname">__repr__</tt><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__repr__" title="Permalink to this definition">¶</a></dt>
2960
<dd><div class="inherited-member container">
2961
<em>inherited from the</em> <tt class="xref py py-attr docutils literal"><span class="pre">__repr__</span></tt> <em>attribute of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
2962
<p>x.__repr__() <==> repr(x)</p>
2966
<dt id="sqlalchemy.sql.operators.ColumnOperators.__rmul__">
2967
<tt class="descname">__rmul__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__rmul__" title="Permalink to this definition">¶</a></dt>
2968
<dd><p>Implement the <tt class="docutils literal"><span class="pre">*</span></tt> operator in reverse.</p>
2969
<p>See <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__mul__" title="sqlalchemy.sql.operators.ColumnOperators.__mul__"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.__mul__()</span></tt></a>.</p>
2973
<dt id="sqlalchemy.sql.operators.ColumnOperators.__rshift__">
2974
<tt class="descname">__rshift__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__rshift__" title="Permalink to this definition">¶</a></dt>
2975
<dd><p>implement the >> operator.</p>
2976
<p>Not used by SQLAlchemy core, this is provided
2977
for custom operator systems which want to use
2978
>> as an extension point.</p>
2982
<dt id="sqlalchemy.sql.operators.ColumnOperators.__rsub__">
2983
<tt class="descname">__rsub__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__rsub__" title="Permalink to this definition">¶</a></dt>
2984
<dd><p>Implement the <tt class="docutils literal"><span class="pre">-</span></tt> operator in reverse.</p>
2985
<p>See <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__sub__" title="sqlalchemy.sql.operators.ColumnOperators.__sub__"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.__sub__()</span></tt></a>.</p>
2989
<dt id="sqlalchemy.sql.operators.ColumnOperators.__rtruediv__">
2990
<tt class="descname">__rtruediv__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__rtruediv__" title="Permalink to this definition">¶</a></dt>
2991
<dd><p>Implement the <tt class="docutils literal"><span class="pre">//</span></tt> operator in reverse.</p>
2992
<p>See <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.__truediv__" title="sqlalchemy.sql.operators.ColumnOperators.__truediv__"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.__truediv__()</span></tt></a>.</p>
2995
<dl class="attribute">
2996
<dt id="sqlalchemy.sql.operators.ColumnOperators.__setattr__">
2997
<tt class="descname">__setattr__</tt><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__setattr__" title="Permalink to this definition">¶</a></dt>
2998
<dd><div class="inherited-member container">
2999
<em>inherited from the</em> <tt class="xref py py-attr docutils literal"><span class="pre">__setattr__</span></tt> <em>attribute of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
3000
<p>x.__setattr__(‘name’, value) <==> x.name = value</p>
3004
<dt id="sqlalchemy.sql.operators.ColumnOperators.__sizeof__">
3005
<tt class="descname">__sizeof__</tt><big>(</big><big>)</big> → int<a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__sizeof__" title="Permalink to this definition">¶</a></dt>
3006
<dd><div class="inherited-member container">
3007
<em>inherited from the</em> <tt class="xref py py-meth docutils literal"><span class="pre">__sizeof__()</span></tt> <em>method of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
3008
<p>size of object in memory, in bytes</p>
3011
<dl class="attribute">
3012
<dt id="sqlalchemy.sql.operators.ColumnOperators.__str__">
3013
<tt class="descname">__str__</tt><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__str__" title="Permalink to this definition">¶</a></dt>
3014
<dd><div class="inherited-member container">
3015
<em>inherited from the</em> <tt class="xref py py-attr docutils literal"><span class="pre">__str__</span></tt> <em>attribute of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
3016
<p>x.__str__() <==> str(x)</p>
3020
<dt id="sqlalchemy.sql.operators.ColumnOperators.__sub__">
3021
<tt class="descname">__sub__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__sub__" title="Permalink to this definition">¶</a></dt>
3022
<dd><p>Implement the <tt class="docutils literal"><span class="pre">-</span></tt> operator.</p>
3023
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">-</span> <span class="pre">b</span></tt>.</p>
3026
<dl class="staticmethod">
3027
<dt id="sqlalchemy.sql.operators.ColumnOperators.__subclasshook__">
3028
<em class="property">static </em><tt class="descname">__subclasshook__</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__subclasshook__" title="Permalink to this definition">¶</a></dt>
3029
<dd><div class="inherited-member container">
3030
<em>inherited from the</em> <tt class="xref py py-meth docutils literal"><span class="pre">__subclasshook__()</span></tt> <em>method of</em> <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></div>
3031
<p>Abstract classes can override this to customize issubclass().</p>
3032
<p>This is invoked early on by abc.ABCMeta.__subclasscheck__().
3033
It should return True, False or NotImplemented. If it returns
3034
NotImplemented, the normal algorithm is used. Otherwise, it
3035
overrides the normal algorithm (and the outcome is cached).</p>
3039
<dt id="sqlalchemy.sql.operators.ColumnOperators.__truediv__">
3040
<tt class="descname">__truediv__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__truediv__" title="Permalink to this definition">¶</a></dt>
3041
<dd><p>Implement the <tt class="docutils literal"><span class="pre">//</span></tt> operator.</p>
3042
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">/</span> <span class="pre">b</span></tt>.</p>
3045
<dl class="attribute">
3046
<dt id="sqlalchemy.sql.operators.ColumnOperators.__weakref__">
3047
<tt class="descname">__weakref__</tt><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.__weakref__" title="Permalink to this definition">¶</a></dt>
3048
<dd><div class="inherited-member container">
3049
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators.__weakref__" title="sqlalchemy.sql.operators.Operators.__weakref__"><tt class="xref py py-attr docutils literal"><span class="pre">__weakref__</span></tt></a> <em>attribute of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators" title="sqlalchemy.sql.operators.Operators"><tt class="xref py py-class docutils literal"><span class="pre">Operators</span></tt></a></div>
3050
<p>list of weak references to the object (if defined)</p>
3054
<dt id="sqlalchemy.sql.operators.ColumnOperators.asc">
3055
<tt class="descname">asc</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.asc" title="Permalink to this definition">¶</a></dt>
3056
<dd><p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.asc" title="sqlalchemy.sql.expression.asc"><tt class="xref py py-func docutils literal"><span class="pre">asc()</span></tt></a> clause against the
3061
<dt id="sqlalchemy.sql.operators.ColumnOperators.between">
3062
<tt class="descname">between</tt><big>(</big><em>cleft</em>, <em>cright</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.between" title="Permalink to this definition">¶</a></dt>
3063
<dd><p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.between" title="sqlalchemy.sql.expression.between"><tt class="xref py py-func docutils literal"><span class="pre">between()</span></tt></a> clause against
3064
the parent object, given the lower and upper range.</p>
3068
<dt id="sqlalchemy.sql.operators.ColumnOperators.collate">
3069
<tt class="descname">collate</tt><big>(</big><em>collation</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.collate" title="Permalink to this definition">¶</a></dt>
3070
<dd><p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.collate" title="sqlalchemy.sql.expression.collate"><tt class="xref py py-func docutils literal"><span class="pre">collate()</span></tt></a> clause against
3071
the parent object, given the collation string.</p>
3075
<dt id="sqlalchemy.sql.operators.ColumnOperators.concat">
3076
<tt class="descname">concat</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.concat" title="Permalink to this definition">¶</a></dt>
3077
<dd><p>Implement the ‘concat’ operator.</p>
3078
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">||</span> <span class="pre">b</span></tt>,
3079
or uses the <tt class="docutils literal"><span class="pre">concat()</span></tt> operator on MySQL.</p>
3083
<dt id="sqlalchemy.sql.operators.ColumnOperators.contains">
3084
<tt class="descname">contains</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.contains" title="Permalink to this definition">¶</a></dt>
3085
<dd><p>Implement the ‘contains’ operator.</p>
3086
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%<other>%'</span></tt></p>
3090
<dt id="sqlalchemy.sql.operators.ColumnOperators.desc">
3091
<tt class="descname">desc</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.desc" title="Permalink to this definition">¶</a></dt>
3092
<dd><p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.desc" title="sqlalchemy.sql.expression.desc"><tt class="xref py py-func docutils literal"><span class="pre">desc()</span></tt></a> clause against the
3097
<dt id="sqlalchemy.sql.operators.ColumnOperators.distinct">
3098
<tt class="descname">distinct</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.distinct" title="Permalink to this definition">¶</a></dt>
3099
<dd><p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.distinct" title="sqlalchemy.sql.expression.distinct"><tt class="xref py py-func docutils literal"><span class="pre">distinct()</span></tt></a> clause against the
3104
<dt id="sqlalchemy.sql.operators.ColumnOperators.endswith">
3105
<tt class="descname">endswith</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.endswith" title="Permalink to this definition">¶</a></dt>
3106
<dd><p>Implement the ‘endswith’ operator.</p>
3107
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%<other>'</span></tt></p>
3111
<dt id="sqlalchemy.sql.operators.ColumnOperators.ilike">
3112
<tt class="descname">ilike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="Permalink to this definition">¶</a></dt>
3113
<dd><p>Implement the <tt class="docutils literal"><span class="pre">ilike</span></tt> operator.</p>
3114
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">ILIKE</span> <span class="pre">other</span></tt>.</p>
3116
<div class="highlight-python"><div class="highlight"><pre><span class="n">select</span><span class="p">([</span><span class="n">sometable</span><span class="p">])</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">sometable</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">column</span><span class="o">.</span><span class="n">ilike</span><span class="p">(</span><span class="s">"</span><span class="si">%f</span><span class="s">oobar%"</span><span class="p">))</span></pre></div>
3118
<table class="docutils field-list" frame="void" rules="none">
3119
<col class="field-name" />
3120
<col class="field-body" />
3121
<tbody valign="top">
3122
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
3123
<li><strong>other</strong> – expression to be compared</li>
3124
<li><strong>escape</strong> – <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
3126
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">ilike</span><span class="p">(</span><span class="s">"foo/%bar"</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">"/"</span><span class="p">)</span></pre></div>
3134
<div class="admonition seealso">
3135
<p class="first admonition-title">See also</p>
3136
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a></p>
3141
<dt id="sqlalchemy.sql.operators.ColumnOperators.in_">
3142
<tt class="descname">in_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="Permalink to this definition">¶</a></dt>
3143
<dd><p>Implement the <tt class="docutils literal"><span class="pre">in</span></tt> operator.</p>
3144
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">IN</span> <span class="pre">other</span></tt>.
3145
“other” may be a tuple/list of column expressions,
3146
or 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.</p>
3150
<dt id="sqlalchemy.sql.operators.ColumnOperators.is_">
3151
<tt class="descname">is_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.is_" title="Permalink to this definition">¶</a></dt>
3152
<dd><p>Implement the <tt class="docutils literal"><span class="pre">IS</span></tt> operator.</p>
3153
<p>Normally, <tt class="docutils literal"><span class="pre">IS</span></tt> is generated automatically when comparing to a
3154
value of <tt class="docutils literal"><span class="pre">None</span></tt>, which resolves to <tt class="docutils literal"><span class="pre">NULL</span></tt>. However, explicit
3155
usage of <tt class="docutils literal"><span class="pre">IS</span></tt> may be desirable if comparing to boolean values
3156
on certain platforms.</p>
3157
<div class="versionadded">
3158
<p><span>New in version 0.7.9.</span></p>
3160
<div class="admonition seealso">
3161
<p class="first admonition-title">See also</p>
3162
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.isnot" title="sqlalchemy.sql.operators.ColumnOperators.isnot"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.isnot()</span></tt></a></p>
3167
<dt id="sqlalchemy.sql.operators.ColumnOperators.isnot">
3168
<tt class="descname">isnot</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.isnot" title="Permalink to this definition">¶</a></dt>
3169
<dd><p>Implement the <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> operator.</p>
3170
<p>Normally, <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> is generated automatically when comparing to a
3171
value of <tt class="docutils literal"><span class="pre">None</span></tt>, which resolves to <tt class="docutils literal"><span class="pre">NULL</span></tt>. However, explicit
3172
usage of <tt class="docutils literal"><span class="pre">IS</span> <span class="pre">NOT</span></tt> may be desirable if comparing to boolean values
3173
on certain platforms.</p>
3174
<div class="versionadded">
3175
<p><span>New in version 0.7.9.</span></p>
3177
<div class="admonition seealso">
3178
<p class="first admonition-title">See also</p>
3179
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.is_" title="sqlalchemy.sql.operators.ColumnOperators.is_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.is_()</span></tt></a></p>
3184
<dt id="sqlalchemy.sql.operators.ColumnOperators.like">
3185
<tt class="descname">like</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="Permalink to this definition">¶</a></dt>
3186
<dd><p>Implement the <tt class="docutils literal"><span class="pre">like</span></tt> operator.</p>
3187
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">a</span> <span class="pre">LIKE</span> <span class="pre">other</span></tt>.</p>
3189
<div class="highlight-python"><div class="highlight"><pre><span class="n">select</span><span class="p">([</span><span class="n">sometable</span><span class="p">])</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">sometable</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">column</span><span class="o">.</span><span class="n">like</span><span class="p">(</span><span class="s">"</span><span class="si">%f</span><span class="s">oobar%"</span><span class="p">))</span></pre></div>
3191
<table class="docutils field-list" frame="void" rules="none">
3192
<col class="field-name" />
3193
<col class="field-body" />
3194
<tbody valign="top">
3195
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
3196
<li><strong>other</strong> – expression to be compared</li>
3197
<li><strong>escape</strong> – <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
3199
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">like</span><span class="p">(</span><span class="s">"foo/%bar"</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">"/"</span><span class="p">)</span></pre></div>
3207
<div class="admonition seealso">
3208
<p class="first admonition-title">See also</p>
3209
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a></p>
3214
<dt id="sqlalchemy.sql.operators.ColumnOperators.match">
3215
<tt class="descname">match</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.match" title="Permalink to this definition">¶</a></dt>
3216
<dd><p>Implements the ‘match’ operator.</p>
3217
<p>In a column context, this produces a MATCH clause, i.e.
3218
<tt class="docutils literal"><span class="pre">MATCH</span> <span class="pre">'<other>'</span></tt>. The allowed contents of <tt class="docutils literal"><span class="pre">other</span></tt>
3219
are database backend specific.</p>
3223
<dt id="sqlalchemy.sql.operators.ColumnOperators.notilike">
3224
<tt class="descname">notilike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.notilike" title="Permalink to this definition">¶</a></dt>
3225
<dd><p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">ILIKE</span></tt> operator.</p>
3226
<p>This is equivalent to using negation with
3227
<a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a>, i.e. <tt class="docutils literal"><span class="pre">~x.ilike(y)</span></tt>.</p>
3228
<div class="versionadded">
3229
<p><span>New in version 0.8.</span></p>
3231
<div class="admonition seealso">
3232
<p class="first admonition-title">See also</p>
3233
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.ilike" title="sqlalchemy.sql.operators.ColumnOperators.ilike"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.ilike()</span></tt></a></p>
3238
<dt id="sqlalchemy.sql.operators.ColumnOperators.notin_">
3239
<tt class="descname">notin_</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.notin_" title="Permalink to this definition">¶</a></dt>
3240
<dd><p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">IN</span></tt> operator.</p>
3241
<p>This is equivalent to using negation with <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="sqlalchemy.sql.operators.ColumnOperators.in_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.in_()</span></tt></a>,
3242
i.e. <tt class="docutils literal"><span class="pre">~x.in_(y)</span></tt>.</p>
3243
<div class="versionadded">
3244
<p><span>New in version 0.8.</span></p>
3246
<div class="admonition seealso">
3247
<p class="first admonition-title">See also</p>
3248
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.in_" title="sqlalchemy.sql.operators.ColumnOperators.in_"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.in_()</span></tt></a></p>
3253
<dt id="sqlalchemy.sql.operators.ColumnOperators.notlike">
3254
<tt class="descname">notlike</tt><big>(</big><em>other</em>, <em>escape=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.notlike" title="Permalink to this definition">¶</a></dt>
3255
<dd><p>implement the <tt class="docutils literal"><span class="pre">NOT</span> <span class="pre">LIKE</span></tt> operator.</p>
3256
<p>This is equivalent to using negation with
3257
<a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a>, i.e. <tt class="docutils literal"><span class="pre">~x.like(y)</span></tt>.</p>
3258
<div class="versionadded">
3259
<p><span>New in version 0.8.</span></p>
3261
<div class="admonition seealso">
3262
<p class="first admonition-title">See also</p>
3263
<p class="last"><a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.like" title="sqlalchemy.sql.operators.ColumnOperators.like"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.like()</span></tt></a></p>
3268
<dt id="sqlalchemy.sql.operators.ColumnOperators.nullsfirst">
3269
<tt class="descname">nullsfirst</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.nullsfirst" title="Permalink to this definition">¶</a></dt>
3270
<dd><p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.nullsfirst" title="sqlalchemy.sql.expression.nullsfirst"><tt class="xref py py-func docutils literal"><span class="pre">nullsfirst()</span></tt></a> clause against the
3275
<dt id="sqlalchemy.sql.operators.ColumnOperators.nullslast">
3276
<tt class="descname">nullslast</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.nullslast" title="Permalink to this definition">¶</a></dt>
3277
<dd><p>Produce a <a class="reference internal" href="#sqlalchemy.sql.expression.nullslast" title="sqlalchemy.sql.expression.nullslast"><tt class="xref py py-func docutils literal"><span class="pre">nullslast()</span></tt></a> clause against the
3282
<dt id="sqlalchemy.sql.operators.ColumnOperators.op">
3283
<tt class="descname">op</tt><big>(</big><em>opstring</em>, <em>precedence=0</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.op" title="Permalink to this definition">¶</a></dt>
3284
<dd><div class="inherited-member container">
3285
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators.op" title="sqlalchemy.sql.operators.Operators.op"><tt class="xref py py-meth docutils literal"><span class="pre">op()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators" title="sqlalchemy.sql.operators.Operators"><tt class="xref py py-class docutils literal"><span class="pre">Operators</span></tt></a></div>
3286
<p>produce a generic operator function.</p>
3288
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">op</span><span class="p">(</span><span class="s">"*"</span><span class="p">)(</span><span class="mi">5</span><span class="p">)</span></pre></div>
3291
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span> <span class="o">*</span> <span class="mi">5</span></pre></div>
3293
<p>This function can also be used to make bitwise operators explicit. For
3295
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">op</span><span class="p">(</span><span class="s">'&'</span><span class="p">)(</span><span class="mh">0xff</span><span class="p">)</span></pre></div>
3297
<p>is a bitwise AND of the value in <tt class="docutils literal"><span class="pre">somecolumn</span></tt>.</p>
3298
<table class="docutils field-list" frame="void" rules="none">
3299
<col class="field-name" />
3300
<col class="field-body" />
3301
<tbody valign="top">
3302
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
3303
<li><strong>operator</strong> – a string which will be output as the infix operator
3304
between this element and the expression passed to the
3305
generated function.</li>
3306
<li><strong>precedence</strong> – <p>precedence to apply to the operator, when
3307
parenthesizing expressions. A lower number will cause the expression
3308
to be parenthesized when applied against another operator with
3309
higher precedence. The default value of <tt class="docutils literal"><span class="pre">0</span></tt> is lower than all
3310
operators except for the comma (<tt class="docutils literal"><span class="pre">,</span></tt>) and <tt class="docutils literal"><span class="pre">AS</span></tt> operators.
3311
A value of 100 will be higher or equal to all operators, and -100
3312
will be lower than or equal to all operators.</p>
3313
<div class="versionadded">
3314
<p><span>New in version 0.8: </span>- added the ‘precedence’ argument.</p>
3322
<div class="admonition seealso">
3323
<p class="first admonition-title">See also</p>
3324
<p class="last"><a class="reference internal" href="types.html#types-operators"><em>Redefining and Creating New Operators</em></a></p>
3329
<dt id="sqlalchemy.sql.operators.ColumnOperators.operate">
3330
<tt class="descname">operate</tt><big>(</big><em>op</em>, <em>*other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.operate" title="Permalink to this definition">¶</a></dt>
3331
<dd><div class="inherited-member container">
3332
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators.operate" title="sqlalchemy.sql.operators.Operators.operate"><tt class="xref py py-meth docutils literal"><span class="pre">operate()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators" title="sqlalchemy.sql.operators.Operators"><tt class="xref py py-class docutils literal"><span class="pre">Operators</span></tt></a></div>
3333
<p>Operate on an argument.</p>
3334
<p>This is the lowest level of operation, raises
3335
<tt class="xref py py-class docutils literal"><span class="pre">NotImplementedError</span></tt> by default.</p>
3336
<p>Overriding this on a subclass can allow common
3337
behavior to be applied to all operations.
3338
For example, overriding <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a>
3339
to apply <tt class="docutils literal"><span class="pre">func.lower()</span></tt> to the left and right
3341
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">MyComparator</span><span class="p">(</span><span class="n">ColumnOperators</span><span class="p">):</span>
3342
<span class="k">def</span> <span class="nf">operate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">op</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
3343
<span class="k">return</span> <span class="n">op</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">lower</span><span class="p">(</span><span class="bp">self</span><span class="p">),</span> <span class="n">func</span><span class="o">.</span><span class="n">lower</span><span class="p">(</span><span class="n">other</span><span class="p">))</span></pre></div>
3345
<table class="docutils field-list" frame="void" rules="none">
3346
<col class="field-name" />
3347
<col class="field-body" />
3348
<tbody valign="top">
3349
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
3350
<li><strong>op</strong> – Operator callable.</li>
3351
<li><strong>*other</strong> – the ‘other’ side of the operation. Will
3352
be a single scalar for most operations.</li>
3353
<li><strong>**kwargs</strong> – modifiers. These may be passed by special
3354
operators such as <tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.contains()</span></tt>.</li>
3363
<dt id="sqlalchemy.sql.operators.ColumnOperators.reverse_operate">
3364
<tt class="descname">reverse_operate</tt><big>(</big><em>op</em>, <em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.reverse_operate" title="Permalink to this definition">¶</a></dt>
3365
<dd><div class="inherited-member container">
3366
<em>inherited from the</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators.reverse_operate" title="sqlalchemy.sql.operators.Operators.reverse_operate"><tt class="xref py py-meth docutils literal"><span class="pre">reverse_operate()</span></tt></a> <em>method of</em> <a class="reference internal" href="#sqlalchemy.sql.operators.Operators" title="sqlalchemy.sql.operators.Operators"><tt class="xref py py-class docutils literal"><span class="pre">Operators</span></tt></a></div>
3367
<p>Reverse operate on an argument.</p>
3368
<p>Usage is the same as <tt class="xref py py-meth docutils literal"><span class="pre">operate()</span></tt>.</p>
3372
<dt id="sqlalchemy.sql.operators.ColumnOperators.startswith">
3373
<tt class="descname">startswith</tt><big>(</big><em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.startswith" title="Permalink to this definition">¶</a></dt>
3374
<dd><p>Implement the <tt class="docutils literal"><span class="pre">startwith</span></tt> operator.</p>
3375
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'<other>%'</span></tt></p>
3378
<dl class="attribute">
3379
<dt id="sqlalchemy.sql.operators.ColumnOperators.timetuple">
3380
<tt class="descname">timetuple</tt><em class="property"> = None</em><a class="headerlink" href="#sqlalchemy.sql.operators.ColumnOperators.timetuple" title="Permalink to this definition">¶</a></dt>
3381
<dd><p>Hack, allows datetime objects to be compared on the LHS.</p>
3387
<dt id="sqlalchemy.sql.operators.custom_op">
3388
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.operators.</tt><tt class="descname">custom_op</tt><big>(</big><em>opstring</em>, <em>precedence=0</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.custom_op" title="Permalink to this definition">¶</a></dt>
3389
<dd><p>Represent a ‘custom’ operator.</p>
3390
<p><a class="reference internal" href="#sqlalchemy.sql.operators.custom_op" title="sqlalchemy.sql.operators.custom_op"><tt class="xref py py-class docutils literal"><span class="pre">custom_op</span></tt></a> is normally instantitated when the
3391
<a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators.op" title="sqlalchemy.sql.operators.ColumnOperators.op"><tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.op()</span></tt></a> method is used to create a
3392
custom operator callable. The class can also be used directly
3393
when programmatically constructing expressions. E.g.
3394
to represent the “factorial” operation:</p>
3395
<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">UnaryExpression</span>
3396
<span class="kn">from</span> <span class="nn">sqlalchemy.sql</span> <span class="kn">import</span> <span class="n">operators</span>
3397
<span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">Numeric</span>
3399
<span class="n">unary</span> <span class="o">=</span> <span class="n">UnaryExpression</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">somecolumn</span><span class="p">,</span>
3400
<span class="n">modifier</span><span class="o">=</span><span class="n">operators</span><span class="o">.</span><span class="n">custom_op</span><span class="p">(</span><span class="s">"!"</span><span class="p">),</span>
3401
<span class="n">type_</span><span class="o">=</span><span class="n">Numeric</span><span class="p">)</span></pre></div>
3406
<dt id="sqlalchemy.sql.operators.Operators">
3407
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.operators.</tt><tt class="descname">Operators</tt><a class="headerlink" href="#sqlalchemy.sql.operators.Operators" title="Permalink to this definition">¶</a></dt>
3408
<dd><p>Base of comparison and logical operators.</p>
3409
<p>Implements base methods <tt class="xref py py-meth docutils literal"><span class="pre">operate()</span></tt> and <tt class="xref py py-meth docutils literal"><span class="pre">reverse_operate()</span></tt>,
3410
as well as <tt class="xref py py-meth docutils literal"><span class="pre">__and__()</span></tt>, <tt class="xref py py-meth docutils literal"><span class="pre">__or__()</span></tt>, <tt class="xref py py-meth docutils literal"><span class="pre">__invert__()</span></tt>.</p>
3411
<p>Usually is used via its most common subclass
3412
<a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a>.</p>
3414
<dt id="sqlalchemy.sql.operators.Operators.__and__">
3415
<tt class="descname">__and__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.Operators.__and__" title="Permalink to this definition">¶</a></dt>
3416
<dd><p>Implement the <tt class="docutils literal"><span class="pre">&</span></tt> operator.</p>
3417
<p>When used with SQL expressions, results in an
3418
AND operation, equivalent to
3419
<a class="reference internal" href="#sqlalchemy.sql.expression.and_" title="sqlalchemy.sql.expression.and_"><tt class="xref py py-func docutils literal"><span class="pre">and_()</span></tt></a>, that is:</p>
3420
<div class="highlight-python"><div class="highlight"><pre><span class="n">a</span> <span class="o">&</span> <span class="n">b</span></pre></div>
3422
<p>is equivalent to:</p>
3423
<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">and_</span>
3424
<span class="n">and_</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span></pre></div>
3426
<p>Care should be taken when using <tt class="docutils literal"><span class="pre">&</span></tt> regarding
3427
operator precedence; the <tt class="docutils literal"><span class="pre">&</span></tt> operator has the highest precedence.
3428
The operands should be enclosed in parenthesis if they contain
3429
further sub expressions:</p>
3430
<div class="highlight-python"><div class="highlight"><pre><span class="p">(</span><span class="n">a</span> <span class="o">==</span> <span class="mi">2</span><span class="p">)</span> <span class="o">&</span> <span class="p">(</span><span class="n">b</span> <span class="o">==</span> <span class="mi">4</span><span class="p">)</span></pre></div>
3435
<dt id="sqlalchemy.sql.operators.Operators.__invert__">
3436
<tt class="descname">__invert__</tt><big>(</big><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.Operators.__invert__" title="Permalink to this definition">¶</a></dt>
3437
<dd><p>Implement the <tt class="docutils literal"><span class="pre">~</span></tt> operator.</p>
3438
<p>When used with SQL expressions, results in a
3439
NOT operation, equivalent to
3440
<a class="reference internal" href="#sqlalchemy.sql.expression.not_" title="sqlalchemy.sql.expression.not_"><tt class="xref py py-func docutils literal"><span class="pre">not_()</span></tt></a>, that is:</p>
3441
<div class="highlight-python"><div class="highlight"><pre><span class="o">~</span><span class="n">a</span></pre></div>
3443
<p>is equivalent to:</p>
3444
<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">not_</span>
3445
<span class="n">not_</span><span class="p">(</span><span class="n">a</span><span class="p">)</span></pre></div>
3450
<dt id="sqlalchemy.sql.operators.Operators.__or__">
3451
<tt class="descname">__or__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.Operators.__or__" title="Permalink to this definition">¶</a></dt>
3452
<dd><p>Implement the <tt class="docutils literal"><span class="pre">|</span></tt> operator.</p>
3453
<p>When used with SQL expressions, results in an
3454
OR operation, equivalent to
3455
<a class="reference internal" href="#sqlalchemy.sql.expression.or_" title="sqlalchemy.sql.expression.or_"><tt class="xref py py-func docutils literal"><span class="pre">or_()</span></tt></a>, that is:</p>
3456
<div class="highlight-python"><div class="highlight"><pre><span class="n">a</span> <span class="o">|</span> <span class="n">b</span></pre></div>
3458
<p>is equivalent to:</p>
3459
<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">or_</span>
3460
<span class="n">or_</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span></pre></div>
3462
<p>Care should be taken when using <tt class="docutils literal"><span class="pre">|</span></tt> regarding
3463
operator precedence; the <tt class="docutils literal"><span class="pre">|</span></tt> operator has the highest precedence.
3464
The operands should be enclosed in parenthesis if they contain
3465
further sub expressions:</p>
3466
<div class="highlight-python"><div class="highlight"><pre><span class="p">(</span><span class="n">a</span> <span class="o">==</span> <span class="mi">2</span><span class="p">)</span> <span class="o">|</span> <span class="p">(</span><span class="n">b</span> <span class="o">==</span> <span class="mi">4</span><span class="p">)</span></pre></div>
3470
<dl class="attribute">
3471
<dt id="sqlalchemy.sql.operators.Operators.__weakref__">
3472
<tt class="descname">__weakref__</tt><a class="headerlink" href="#sqlalchemy.sql.operators.Operators.__weakref__" title="Permalink to this definition">¶</a></dt>
3473
<dd><p>list of weak references to the object (if defined)</p>
3477
<dt id="sqlalchemy.sql.operators.Operators.op">
3478
<tt class="descname">op</tt><big>(</big><em>opstring</em>, <em>precedence=0</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.Operators.op" title="Permalink to this definition">¶</a></dt>
3479
<dd><p>produce a generic operator function.</p>
3481
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">op</span><span class="p">(</span><span class="s">"*"</span><span class="p">)(</span><span class="mi">5</span><span class="p">)</span></pre></div>
3484
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span> <span class="o">*</span> <span class="mi">5</span></pre></div>
3486
<p>This function can also be used to make bitwise operators explicit. For
3488
<div class="highlight-python"><div class="highlight"><pre><span class="n">somecolumn</span><span class="o">.</span><span class="n">op</span><span class="p">(</span><span class="s">'&'</span><span class="p">)(</span><span class="mh">0xff</span><span class="p">)</span></pre></div>
3490
<p>is a bitwise AND of the value in <tt class="docutils literal"><span class="pre">somecolumn</span></tt>.</p>
3491
<table class="docutils field-list" frame="void" rules="none">
3492
<col class="field-name" />
3493
<col class="field-body" />
3494
<tbody valign="top">
3495
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
3496
<li><strong>operator</strong> – a string which will be output as the infix operator
3497
between this element and the expression passed to the
3498
generated function.</li>
3499
<li><strong>precedence</strong> – <p>precedence to apply to the operator, when
3500
parenthesizing expressions. A lower number will cause the expression
3501
to be parenthesized when applied against another operator with
3502
higher precedence. The default value of <tt class="docutils literal"><span class="pre">0</span></tt> is lower than all
3503
operators except for the comma (<tt class="docutils literal"><span class="pre">,</span></tt>) and <tt class="docutils literal"><span class="pre">AS</span></tt> operators.
3504
A value of 100 will be higher or equal to all operators, and -100
3505
will be lower than or equal to all operators.</p>
3506
<div class="versionadded">
3507
<p><span>New in version 0.8: </span>- added the ‘precedence’ argument.</p>
3515
<div class="admonition seealso">
3516
<p class="first admonition-title">See also</p>
3517
<p class="last"><a class="reference internal" href="types.html#types-operators"><em>Redefining and Creating New Operators</em></a></p>
3522
<dt id="sqlalchemy.sql.operators.Operators.operate">
3523
<tt class="descname">operate</tt><big>(</big><em>op</em>, <em>*other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.Operators.operate" title="Permalink to this definition">¶</a></dt>
3524
<dd><p>Operate on an argument.</p>
3525
<p>This is the lowest level of operation, raises
3526
<tt class="xref py py-class docutils literal"><span class="pre">NotImplementedError</span></tt> by default.</p>
3527
<p>Overriding this on a subclass can allow common
3528
behavior to be applied to all operations.
3529
For example, overriding <a class="reference internal" href="#sqlalchemy.sql.operators.ColumnOperators" title="sqlalchemy.sql.operators.ColumnOperators"><tt class="xref py py-class docutils literal"><span class="pre">ColumnOperators</span></tt></a>
3530
to apply <tt class="docutils literal"><span class="pre">func.lower()</span></tt> to the left and right
3532
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">MyComparator</span><span class="p">(</span><span class="n">ColumnOperators</span><span class="p">):</span>
3533
<span class="k">def</span> <span class="nf">operate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">op</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
3534
<span class="k">return</span> <span class="n">op</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">lower</span><span class="p">(</span><span class="bp">self</span><span class="p">),</span> <span class="n">func</span><span class="o">.</span><span class="n">lower</span><span class="p">(</span><span class="n">other</span><span class="p">))</span></pre></div>
3536
<table class="docutils field-list" frame="void" rules="none">
3537
<col class="field-name" />
3538
<col class="field-body" />
3539
<tbody valign="top">
3540
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
3541
<li><strong>op</strong> – Operator callable.</li>
3542
<li><strong>*other</strong> – the ‘other’ side of the operation. Will
3543
be a single scalar for most operations.</li>
3544
<li><strong>**kwargs</strong> – modifiers. These may be passed by special
3545
operators such as <tt class="xref py py-meth docutils literal"><span class="pre">ColumnOperators.contains()</span></tt>.</li>
3554
<dt id="sqlalchemy.sql.operators.Operators.reverse_operate">
3555
<tt class="descname">reverse_operate</tt><big>(</big><em>op</em>, <em>other</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.operators.Operators.reverse_operate" title="Permalink to this definition">¶</a></dt>
3556
<dd><p>Reverse operate on an argument.</p>
3557
<p>Usage is the same as <tt class="xref py py-meth docutils literal"><span class="pre">operate()</span></tt>.</p>
3563
<dt id="sqlalchemy.sql.expression.UnaryExpression">
3564
<em class="property">class </em><tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">UnaryExpression</tt><big>(</big><em>element</em>, <em>operator=None</em>, <em>modifier=None</em>, <em>type_=None</em>, <em>negate=None</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.UnaryExpression" title="Permalink to this definition">¶</a></dt>
3565
<dd><p>Bases: <a class="reference internal" href="#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></p>
3566
<p>Define a ‘unary’ expression.</p>
3567
<p>A unary expression has a single column expression
3568
and an operator. The operator can be placed on the left
3569
(where it is called the ‘operator’) or right (where it is called the
3570
‘modifier’) of the column expression.</p>
3572
<dt id="sqlalchemy.sql.expression.UnaryExpression.compare">
3573
<tt class="descname">compare</tt><big>(</big><em>other</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#sqlalchemy.sql.expression.UnaryExpression.compare" title="Permalink to this definition">¶</a></dt>
3574
<dd><p>Compare this <a class="reference internal" href="#sqlalchemy.sql.expression.UnaryExpression" title="sqlalchemy.sql.expression.UnaryExpression"><tt class="xref py py-class docutils literal"><span class="pre">UnaryExpression</span></tt></a> against the given
3575
<a class="reference internal" href="#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a>.</p>
3586
<div id="docs-bottom-navigation" class="docs-navigation-links">
3588
<a href="expression_api.html" title="previous chapter">SQL Statements and Expressions API</a>
3590
<a href="selectable.html" title="next chapter">Selectables, Tables, FROM objects</a>
3592
<div id="docs-copyright">
3593
© <a href="../copyright.html">Copyright</a> 2007-2013, the SQLAlchemy authors and contributors.
3594
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2b1.