~ubuntu-branches/debian/jessie/sqlalchemy/jessie

« back to all changes in this revision

Viewing changes to doc/core/sqlelement.html

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2013-10-28 22:29:40 UTC
  • mfrom: (1.4.24)
  • Revision ID: package-import@ubuntu.com-20131028222940-wvyqffl4g617caun
Tags: 0.8.3-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
3
 
 
4
<html xmlns="http://www.w3.org/1999/xhtml">
 
5
    <head>
 
6
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
7
        
 
8
        <title>
 
9
            
 
10
    
 
11
                Column Elements and Expressions
 
12
             &mdash; 
 
13
    SQLAlchemy 0.8 Documentation
 
14
 
 
15
        </title>
 
16
        
 
17
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
 
18
    <link rel="stylesheet" href="../_static/docs.css" type="text/css" />
 
19
 
 
20
    <script type="text/javascript">
 
21
      var DOCUMENTATION_OPTIONS = {
 
22
          URL_ROOT:    '../',
 
23
          VERSION:     '0.8.3',
 
24
          COLLAPSE_MODINDEX: false,
 
25
          FILE_SUFFIX: '.html'
 
26
      };
 
27
    </script>
 
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" />
 
39
 
 
40
    </head>
 
41
    <body>
 
42
        
 
43
 
 
44
 
 
45
 
 
46
 
 
47
 
 
48
 
 
49
 
 
50
 
 
51
 
 
52
 
 
53
<div id="docs-container">
 
54
 
 
55
 
 
56
 
 
57
<div id="docs-header">
 
58
    <h1>SQLAlchemy 0.8 Documentation</h1>
 
59
 
 
60
    <div id="docs-search">
 
61
    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" />
 
66
    </form>
 
67
    </div>
 
68
 
 
69
    <div id="docs-version-header">
 
70
        Release: <span class="version-num">0.8.3</span> | Release Date: October 26, 2013
 
71
 
 
72
 
 
73
    </div>
 
74
 
 
75
</div>
 
76
 
 
77
<div id="docs-top-navigation">
 
78
    <div id="docs-top-page-control" class="docs-navigation-links">
 
79
        <ul>
 
80
            <li>Prev:
 
81
            <a href="expression_api.html" title="previous chapter">SQL Statements and Expressions API</a>
 
82
            </li>
 
83
            <li>Next:
 
84
            <a href="selectable.html" title="next chapter">Selectables, Tables, FROM objects</a>
 
85
            </li>
 
86
 
 
87
        <li>
 
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
 
91
        </li>
 
92
        </ul>
 
93
    </div>
 
94
 
 
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>
 
99
        » 
 
100
                Column Elements and Expressions
 
101
             
 
102
 
 
103
        <h2>
 
104
            
 
105
                Column Elements and Expressions
 
106
            
 
107
        </h2>
 
108
    </div>
 
109
 
 
110
</div>
 
111
 
 
112
<div id="docs-body-container">
 
113
 
 
114
    <div id="docs-sidebar">
 
115
    <h3><a href="../index.html">Table of Contents</a></h3>
 
116
    <ul>
 
117
<li><a class="reference internal" href="#">Column Elements and Expressions</a></li>
 
118
</ul>
 
119
 
 
120
 
 
121
    <h4>Previous Topic</h4>
 
122
    <p>
 
123
    <a href="expression_api.html" title="previous chapter">SQL Statements and Expressions API</a>
 
124
    </p>
 
125
    <h4>Next Topic</h4>
 
126
    <p>
 
127
    <a href="selectable.html" title="next chapter">Selectables, Tables, FROM objects</a>
 
128
    </p>
 
129
 
 
130
 
 
131
    <h4>Quick Search</h4>
 
132
    <p>
 
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" />
 
137
    </form>
 
138
    </p>
 
139
 
 
140
    </div>
 
141
 
 
142
    <div id="docs-body" class="withsidebar" >
 
143
        
 
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 &#8220;column elements&#8221;,
 
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">&amp;</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
 
157
same result.</p>
 
158
</dd></dl>
 
159
 
 
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>
 
164
<p>e.g.:</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>
 
166
</div>
 
167
<p>produces:</p>
 
168
<div class="highlight-python"><pre>ORDER BY mycol ASC</pre>
 
169
</div>
 
170
</dd></dl>
 
171
 
 
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>
 
180
</dd></dl>
 
181
 
 
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=&lt;symbol 'NO_ARG&gt;</em>, <em>type_=None</em>, <em>unique=False</em>, <em>required=&lt;symbol 'NO_ARG&gt;</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" />
 
189
<tbody valign="top">
 
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> &#8211; 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
 
196
required.</li>
 
197
<li><strong>value</strong> &#8211; <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>
 
207
</div>
 
208
</li>
 
209
<li><strong>callable_</strong> &#8211; A callable function that takes the place of &#8220;value&#8221;.  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> &#8211; 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
 
216
execution time.</li>
 
217
<li><strong>unique</strong> &#8211; 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> &#8211; <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
 
228
were specified.</p>
 
229
</div>
 
230
</li>
 
231
<li><strong>quote</strong> &#8211; 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>
 
234
</ul>
 
235
</td>
 
236
</tr>
 
237
</tbody>
 
238
</table>
 
239
</dd></dl>
 
240
 
 
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">
 
246
<dt>whens</dt>
 
247
<dd>A sequence of pairs, or alternatively a dict,
 
248
to be translated into &#8220;WHEN / THEN&#8221; clauses.</dd>
 
249
<dt>value</dt>
 
250
<dd>Optional for simple case statements, produces
 
251
a column expression as in &#8220;CASE &lt;expr&gt; WHEN ...&#8221;</dd>
 
252
<dt>else_</dt>
 
253
<dd>Optional as well, for case defaults produces
 
254
the &#8220;ELSE&#8221; portion of the &#8220;CASE&#8221; statement.</dd>
 
255
</dl>
 
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>
 
260
construct.</p>
 
261
<p>The expressions used for the WHEN criterion
 
262
may only be literal strings when &#8220;value&#8221; is
 
263
present, i.e. CASE table.somecol WHEN &#8220;x&#8221; THEN &#8220;y&#8221;.
 
264
Otherwise, literal strings are not accepted
 
265
in this position, and either the text(&lt;string&gt;)
 
266
or literal(&lt;string&gt;) 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">&gt;</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">&gt;</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">&#39;engineer&#39;</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">&#39;manager&#39;</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>
 
276
</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
 
280
overall:</p>
 
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">&gt;</span> <span class="mi">100</span><span class="p">,</span>
 
282
        <span class="n">literal_column</span><span class="p">(</span><span class="s">&quot;&#39;greaterthan100&#39;&quot;</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">&gt;</span> <span class="mi">10</span><span class="p">,</span> <span class="n">literal_column</span><span class="p">(</span><span class="s">&quot;&#39;greaterthan10&#39;&quot;</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">&quot;&#39;lethan10&#39;&quot;</span><span class="p">,</span> <span class="n">String</span><span class="p">))</span></pre></div>
 
286
</div>
 
287
</dd></dl>
 
288
 
 
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>
 
296
</div>
 
297
<p>or:</p>
 
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>
 
299
</div>
 
300
</dd></dl>
 
301
 
 
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 &#8220;syntactical&#8221; 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>
 
316
</div>
 
317
<table class="docutils field-list" frame="void" rules="none">
 
318
<col class="field-name" />
 
319
<col class="field-body" />
 
320
<tbody valign="top">
 
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> &#8211; 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> &#8211; 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>
 
327
</ul>
 
328
</td>
 
329
</tr>
 
330
</tbody>
 
331
</table>
 
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>
 
333
</dd></dl>
 
334
 
 
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>
 
339
<p>e.g.:</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">&#39;utf8_bin&#39;</span><span class="p">)</span></pre></div>
 
341
</div>
 
342
<p>produces:</p>
 
343
<div class="highlight-python"><pre>mycolumn COLLATE utf8_bin</pre>
 
344
</div>
 
345
</dd></dl>
 
346
 
 
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>
 
351
<p>e.g.:</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>
 
353
</div>
 
354
<p>produces:</p>
 
355
<div class="highlight-python"><pre>ORDER BY mycol DESC</pre>
 
356
</div>
 
357
</dd></dl>
 
358
 
 
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>
 
363
<p>e.g.:</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>
 
365
</div>
 
366
<p>renders:</p>
 
367
<div class="highlight-python"><pre>DISTINCT a</pre>
 
368
</div>
 
369
</dd></dl>
 
370
 
 
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>
 
375
</dd></dl>
 
376
 
 
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>
 
382
</dd></dl>
 
383
 
 
384
<dl class="data">
 
385
<dt id="sqlalchemy.sql.expression.func">
 
386
<tt class="descclassname">sqlalchemy.sql.expression.</tt><tt class="descname">func</tt><em class="property"> = &lt;sqlalchemy.sql.expression._FunctionGenerator object at 0x10216cf90&gt;</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">&gt;&gt;&gt; </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>
 
392
</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">&gt;&gt;&gt; </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>
 
397
</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">&gt;&gt;&gt; </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>
 
404
</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">&gt;&gt;&gt; </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>
 
409
</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">&gt;&gt;&gt; </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&#39;hi&#39;</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">&#39; &#39;</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&#39;there&#39;</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>
 
418
</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 &#8220;column&#8221; 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>
 
426
</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 &#8220;functions&#8221; from a SQLAlchemy
 
431
perspective.</p>
 
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>
 
436
</div>
 
437
<p>Functions which are interpreted as &#8220;generic&#8221; 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>
 
440
</dd></dl>
 
441
 
 
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">
 
452
<dt>name</dt>
 
453
<dd>label name</dd>
 
454
<dt>obj</dt>
 
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>
 
456
</dl>
 
457
</dd></dl>
 
458
 
 
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" />
 
473
<tbody valign="top">
 
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> &#8211; 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> &#8211; 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>
 
479
</ul>
 
480
</td>
 
481
</tr>
 
482
</tbody>
 
483
</table>
 
484
</dd></dl>
 
485
 
 
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, &#8216;+&#8217; means string concatenation or numerical addition based on
 
495
the type).</p>
 
496
<table class="docutils field-list" frame="void" rules="none">
 
497
<col class="field-name" />
 
498
<col class="field-body" />
 
499
<tbody valign="top">
 
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> &#8211; 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>
 
504
function.</li>
 
505
<li><strong>type_</strong> &#8211; 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>
 
506
object which will
 
507
provide result-set translation and additional expression semantics for
 
508
this column. If left as None the type will be NullType.</li>
 
509
</ul>
 
510
</td>
 
511
</tr>
 
512
</tbody>
 
513
</table>
 
514
</dd></dl>
 
515
 
 
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
 
522
same result.</p>
 
523
</dd></dl>
 
524
 
 
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>
 
529
</dd></dl>
 
530
 
 
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>
 
535
<p>e.g.:</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>
 
537
</div>
 
538
<p>produces:</p>
 
539
<div class="highlight-python"><pre>ORDER BY mycol DESC NULLS FIRST</pre>
 
540
</div>
 
541
</dd></dl>
 
542
 
 
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>
 
547
<p>e.g.:</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>
 
549
</div>
 
550
<p>produces:</p>
 
551
<div class="highlight-python"><pre>ORDER BY mycol DESC NULLS LAST</pre>
 
552
</div>
 
553
</dd></dl>
 
554
 
 
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
 
561
same result.</p>
 
562
</dd></dl>
 
563
 
 
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 &#8216;OUT&#8217; 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 &#8220;output&#8221; 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>
 
573
</dd></dl>
 
574
 
 
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 &#8220;window&#8221; functions,
 
580
for database backends that support window functions.</p>
 
581
<p>E.g.:</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">&#39;x&#39;</span><span class="p">)</span></pre></div>
 
584
</div>
 
585
<p>Would produce &#8220;ROW_NUMBER() OVER(ORDER BY x)&#8221;.</p>
 
586
<table class="docutils field-list" frame="void" rules="none">
 
587
<col class="field-name" />
 
588
<col class="field-body" />
 
589
<tbody valign="top">
 
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> &#8211; 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> &#8211; 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> &#8211; 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>
 
599
</ul>
 
600
</td>
 
601
</tr>
 
602
</tbody>
 
603
</table>
 
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>
 
608
</div>
 
609
</dd></dl>
 
610
 
 
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>
 
615
<p>E.g.:</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">&quot;SELECT * FROM users&quot;</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>
 
618
</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>.
 
626
E.g.:</p>
 
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">&quot;SELECT * FROM users WHERE id=:user_id&quot;</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>
 
629
</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">&quot;SELECT id FROM users WHERE updated_at&gt;:updated&quot;</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">&#39;updated&#39;</span><span class="p">,</span> <span class="n">DateTime</span><span class="p">())]</span>
 
635
        <span class="p">)</span></pre></div>
 
636
</div>
 
637
<p>Typing during result row processing is also an important concern.
 
638
Result column types
 
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">&quot;SELECT id, name FROM users&quot;</span><span class="p">,</span>
 
643
        <span class="n">typemap</span><span class="o">=</span><span class="p">{</span>
 
644
            <span class="s">&#39;id&#39;</span><span class="p">:</span><span class="n">Integer</span><span class="p">,</span>
 
645
            <span class="s">&#39;name&#39;</span><span class="p">:</span><span class="n">Unicode</span>
 
646
        <span class="p">}</span>
 
647
<span class="p">)</span></pre></div>
 
648
</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">&quot;id=:user_id&quot;</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>
 
656
</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 &#8220;autocommit&#8221;
 
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">&quot;EXEC my_procedural_thing()&quot;</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>
 
665
</div>
 
666
<p>Note that SQLAlchemy&#8217;s usual &#8220;autocommit&#8221; 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" />
 
674
<tbody valign="top">
 
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> &#8211; the text of the SQL statement to be created.  use <tt class="docutils literal"><span class="pre">:&lt;param&gt;</span></tt>
 
677
to specify bind parameters; they will be compiled to their
 
678
engine-specific format.</li>
 
679
<li><strong>autocommit</strong> &#8211; Deprecated.  Use .execution_options(autocommit=&lt;True|False&gt;)
 
680
to set the autocommit option.</li>
 
681
<li><strong>bind</strong> &#8211; an optional connection or engine to be used for this text query.</li>
 
682
<li><strong>bindparams</strong> &#8211; 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> &#8211; 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>
 
692
</ul>
 
693
</td>
 
694
</tr>
 
695
</tbody>
 
696
</table>
 
697
</dd></dl>
 
698
 
 
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>
 
704
</dd></dl>
 
705
 
 
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>
 
714
</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>
 
722
</div>
 
723
</dd></dl>
 
724
 
 
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
&#8220;CAST&#8221; expression is rendered - the given type is only applied towards
 
732
expression typing and against received result values.</p>
 
733
<p>e.g.:</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>
 
736
 
 
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>
 
739
 
 
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>
 
745
 
 
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>
 
751
 
 
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">&#39;bar&#39;</span><span class="p">)</span>
 
757
            <span class="p">)</span>
 
758
<span class="p">)</span></pre></div>
 
759
</div>
 
760
</dd></dl>
 
761
 
 
762
<dl class="class">
 
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">&lt;operator&gt;</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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="n">column</span><span class="p">(</span><span class="s">&#39;a&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="n">column</span><span class="p">(</span><span class="s">&#39;b&#39;</span><span class="p">)</span>
 
771
<span class="go">&lt;sqlalchemy.sql.expression.BinaryExpression object at 0x101029dd0&gt;</span>
 
772
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">column</span><span class="p">(</span><span class="s">&#39;a&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="n">column</span><span class="p">(</span><span class="s">&#39;b&#39;</span><span class="p">)</span>
 
773
<span class="go">a + b</span></pre></div>
 
774
</div>
 
775
<table class="docutils field-list" frame="void" rules="none">
 
776
<col class="field-name" />
 
777
<col class="field-body" />
 
778
<tbody valign="top">
 
779
<tr class="field-odd field"><th class="field-name" colspan="2">Inherited-members :</th></tr>
 
780
<tr class="field-odd field"><td>&nbsp;</td><td class="field-body"></td>
 
781
</tr>
 
782
</tbody>
 
783
</table>
 
784
<dl class="method">
 
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>
 
789
</dd></dl>
 
790
 
 
791
</dd></dl>
 
792
 
 
793
<dl class="class">
 
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>
 
799
<dl class="method">
 
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>
 
807
</dd></dl>
 
808
 
 
809
<dl class="method">
 
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" />
 
816
<tbody valign="top">
 
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> &#8211; 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
 
823
required.</li>
 
824
<li><strong>value</strong> &#8211; 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> &#8211; A callable function that takes the place of &#8220;value&#8221;.  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> &#8211; 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
 
834
execution time.</li>
 
835
<li><strong>unique</strong> &#8211; 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> &#8211; 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> &#8211; a value is required at execution time.</li>
 
843
<li><strong>isoutparam</strong> &#8211; if True, the parameter should be treated like a stored procedure
 
844
&#8220;OUT&#8221; parameter.</li>
 
845
</ul>
 
846
</td>
 
847
</tr>
 
848
</tbody>
 
849
</table>
 
850
</dd></dl>
 
851
 
 
852
<dl class="method">
 
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">&lt;=</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">&lt;=</span> <span class="pre">b</span></tt>.</p>
 
859
</dd></dl>
 
860
 
 
861
<dl class="method">
 
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">&lt;</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">&lt;</span> <span class="pre">b</span></tt>.</p>
 
868
</dd></dl>
 
869
 
 
870
<dl class="method">
 
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>
 
878
</dd></dl>
 
879
 
 
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 &#8216;anonymous label&#8217; 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 &#8216;unnamed&#8217; like binary
 
892
expressions and function calls.</p>
 
893
</dd></dl>
 
894
 
 
895
<dl class="method">
 
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
 
901
parent object.</p>
 
902
</dd></dl>
 
903
 
 
904
<dl class="method">
 
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>
 
911
</dd></dl>
 
912
 
 
913
<dl class="method">
 
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>
 
920
</dd></dl>
 
921
 
 
922
<dl class="method">
 
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
 
926
clause.</p>
 
927
</dd></dl>
 
928
 
 
929
<dl class="method">
 
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" />
 
944
<tbody valign="top">
 
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> &#8211; 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>&#8216;s bound engine, if any.</li>
 
949
<li><strong>column_keys</strong> &#8211; 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> &#8211; 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>&#8216;s bound engine, if
 
956
any.</li>
 
957
<li><strong>inline</strong> &#8211; 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&#8217;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>
 
964
</ul>
 
965
</td>
 
966
</tr>
 
967
</tbody>
 
968
</table>
 
969
</dd></dl>
 
970
 
 
971
<dl class="method">
 
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 &#8216;concat&#8217; 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>
 
979
</dd></dl>
 
980
 
 
981
<dl class="method">
 
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 &#8216;contains&#8217; operator.</p>
 
987
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%&lt;other&gt;%'</span></tt></p>
 
988
</dd></dl>
 
989
 
 
990
<dl class="method">
 
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
 
996
parent object.</p>
 
997
</dd></dl>
 
998
 
 
999
<dl class="method">
 
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
 
1005
parent object.</p>
 
1006
</dd></dl>
 
1007
 
 
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
 
1013
was set.</p>
 
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>
 
1016
</dd></dl>
 
1017
 
 
1018
<dl class="method">
 
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 &#8216;endswith&#8217; operator.</p>
 
1024
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%&lt;other&gt;'</span></tt></p>
 
1025
</dd></dl>
 
1026
 
 
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>
 
1034
</dd></dl>
 
1035
 
 
1036
<dl class="method">
 
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
 
1047
clause-level).</p>
 
1048
</dd></dl>
 
1049
 
 
1050
<dl class="method">
 
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>
 
1057
<p>E.g.:</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">&quot;</span><span class="si">%f</span><span class="s">oobar%&quot;</span><span class="p">))</span></pre></div>
 
1059
</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> &#8211; expression to be compared</li>
 
1066
<li><strong>escape</strong> &#8211; <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
 
1067
keyword, e.g.:</p>
 
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">&quot;foo/%bar&quot;</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">&quot;/&quot;</span><span class="p">)</span></pre></div>
 
1069
</div>
 
1070
</li>
 
1071
</ul>
 
1072
</td>
 
1073
</tr>
 
1074
</tbody>
 
1075
</table>
 
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>
 
1079
</div>
 
1080
</dd></dl>
 
1081
 
 
1082
<dl class="method">
 
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
&#8220;other&#8221; 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>
 
1091
</dd></dl>
 
1092
 
 
1093
<dl class="method">
 
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>
 
1105
</div>
 
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>
 
1109
</div>
 
1110
</dd></dl>
 
1111
 
 
1112
<dl class="method">
 
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>
 
1124
</div>
 
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>
 
1128
</div>
 
1129
</dd></dl>
 
1130
 
 
1131
<dl class="method">
 
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">&lt;columnname&gt;</span> <span class="pre">AS</span> <span class="pre">&lt;name&gt;</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 &#8216;name&#8217; is None, an anonymous label name will be generated.</p>
 
1139
</dd></dl>
 
1140
 
 
1141
<dl class="method">
 
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>
 
1148
<p>E.g.:</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">&quot;</span><span class="si">%f</span><span class="s">oobar%&quot;</span><span class="p">))</span></pre></div>
 
1150
</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> &#8211; expression to be compared</li>
 
1157
<li><strong>escape</strong> &#8211; <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
 
1158
keyword, e.g.:</p>
 
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">&quot;foo/%bar&quot;</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">&quot;/&quot;</span><span class="p">)</span></pre></div>
 
1160
</div>
 
1161
</li>
 
1162
</ul>
 
1163
</td>
 
1164
</tr>
 
1165
</tbody>
 
1166
</table>
 
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>
 
1170
</div>
 
1171
</dd></dl>
 
1172
 
 
1173
<dl class="method">
 
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 &#8216;match&#8217; 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">'&lt;other&gt;'</span></tt>.  The allowed contents of <tt class="docutils literal"><span class="pre">other</span></tt>
 
1181
are database backend specific.</p>
 
1182
</dd></dl>
 
1183
 
 
1184
<dl class="method">
 
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>
 
1194
</div>
 
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>
 
1198
</div>
 
1199
</dd></dl>
 
1200
 
 
1201
<dl class="method">
 
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>
 
1211
</div>
 
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>
 
1215
</div>
 
1216
</dd></dl>
 
1217
 
 
1218
<dl class="method">
 
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>
 
1228
</div>
 
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>
 
1232
</div>
 
1233
</dd></dl>
 
1234
 
 
1235
<dl class="method">
 
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
 
1241
parent object.</p>
 
1242
</dd></dl>
 
1243
 
 
1244
<dl class="method">
 
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
 
1250
parent object.</p>
 
1251
</dd></dl>
 
1252
 
 
1253
<dl class="method">
 
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>
 
1259
<p>e.g.:</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">&quot;*&quot;</span><span class="p">)(</span><span class="mi">5</span><span class="p">)</span></pre></div>
 
1261
</div>
 
1262
<p>produces:</p>
 
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>
 
1264
</div>
 
1265
<p>This function can also be used to make bitwise operators explicit. For
 
1266
example:</p>
 
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">&#39;&amp;&#39;</span><span class="p">)(</span><span class="mh">0xff</span><span class="p">)</span></pre></div>
 
1268
</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> &#8211; 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> &#8211; <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 &#8216;precedence&#8217; argument.</p>
 
1287
</div>
 
1288
</li>
 
1289
</ul>
 
1290
</td>
 
1291
</tr>
 
1292
</tbody>
 
1293
</table>
 
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>
 
1297
</div>
 
1298
</dd></dl>
 
1299
 
 
1300
<dl class="method">
 
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">&gt;&gt;&gt; </span><span class="n">clause</span> <span class="o">=</span> <span class="n">column</span><span class="p">(</span><span class="s">&#39;x&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="n">bindparam</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">)</span>
 
1309
<span class="gp">&gt;&gt;&gt; </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">{&#39;foo&#39;:None}</span>
 
1311
<span class="gp">&gt;&gt;&gt; </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">&#39;foo&#39;</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">{&#39;foo&#39;:7}</span></pre></div>
 
1313
</div>
 
1314
</dd></dl>
 
1315
 
 
1316
<dl class="method">
 
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 &#8216;grouping&#8217; 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
&#8220;grouping&#8221; construct, i.e. parenthesis.   In particular
 
1324
it&#8217;s used by &#8220;binary&#8221; 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&#8217;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
 
1337
over OR.</p>
 
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>
 
1340
</dd></dl>
 
1341
 
 
1342
<dl class="method">
 
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>
 
1349
</dd></dl>
 
1350
 
 
1351
<dl class="method">
 
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">'&lt;other&gt;%'</span></tt></p>
 
1358
</dd></dl>
 
1359
 
 
1360
<dl class="method">
 
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
 
1368
used.</p>
 
1369
</dd></dl>
 
1370
 
 
1371
</dd></dl>
 
1372
 
 
1373
<dl class="class">
 
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
 
1378
expression.</p>
 
1379
<dl class="method">
 
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>
 
1388
</dd></dl>
 
1389
 
 
1390
<dl class="method">
 
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> &#8211; 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>&#8216;s bound engine, if any.</li>
 
1408
<li><strong>column_keys</strong> &#8211; 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> &#8211; 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>&#8216;s bound engine, if
 
1415
any.</li>
 
1416
<li><strong>inline</strong> &#8211; 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&#8217;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>
 
1423
</ul>
 
1424
</td>
 
1425
</tr>
 
1426
</tbody>
 
1427
</table>
 
1428
</dd></dl>
 
1429
 
 
1430
<dl class="method">
 
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
 
1439
clause-level).</p>
 
1440
</dd></dl>
 
1441
 
 
1442
<dl class="method">
 
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">&gt;&gt;&gt; </span><span class="n">clause</span> <span class="o">=</span> <span class="n">column</span><span class="p">(</span><span class="s">&#39;x&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="n">bindparam</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">)</span>
 
1449
<span class="gp">&gt;&gt;&gt; </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">{&#39;foo&#39;:None}</span>
 
1451
<span class="gp">&gt;&gt;&gt; </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">&#39;foo&#39;</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">{&#39;foo&#39;:7}</span></pre></div>
 
1453
</div>
 
1454
</dd></dl>
 
1455
 
 
1456
<dl class="method">
 
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 &#8216;grouping&#8217; 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
&#8220;grouping&#8221; construct, i.e. parenthesis.   In particular
 
1462
it&#8217;s used by &#8220;binary&#8221; 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&#8217;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
 
1475
over OR.</p>
 
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>
 
1478
</dd></dl>
 
1479
 
 
1480
<dl class="method">
 
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
 
1486
used.</p>
 
1487
</dd></dl>
 
1488
 
 
1489
</dd></dl>
 
1490
 
 
1491
<dl class="class">
 
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>
 
1497
<dl class="method">
 
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>
 
1502
</dd></dl>
 
1503
 
 
1504
</dd></dl>
 
1505
 
 
1506
<dl class="class">
 
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>
 
1518
 
 
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">&quot;c1&quot;</span><span class="p">),</span> <span class="n">column</span><span class="p">(</span><span class="s">&quot;c2&quot;</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>
 
1521
</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>
 
1528
 
 
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">&quot;5 + 7&quot;</span><span class="p">)])</span></pre></div>
 
1530
</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 &#8220;lightweight&#8221; 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>
 
1536
 
 
1537
<span class="n">user</span> <span class="o">=</span> <span class="n">table</span><span class="p">(</span><span class="s">&quot;user&quot;</span><span class="p">,</span>
 
1538
        <span class="n">column</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">),</span>
 
1539
        <span class="n">column</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">),</span>
 
1540
        <span class="n">column</span><span class="p">(</span><span class="s">&quot;description&quot;</span><span class="p">),</span>
 
1541
<span class="p">)</span></pre></div>
 
1542
</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&#8217;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> &#8211; the text of the element.</li>
 
1552
<li><strong>selectable</strong> &#8211; parent selectable.</li>
 
1553
<li><strong>type</strong> &#8211; <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> &#8211; 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>
 
1560
</ul>
 
1561
</td>
 
1562
</tr>
 
1563
</tbody>
 
1564
</table>
 
1565
<dl class="method">
 
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>
 
1573
</dd></dl>
 
1574
 
 
1575
<dl class="method">
 
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">&lt;=</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">&lt;=</span> <span class="pre">b</span></tt>.</p>
 
1582
</dd></dl>
 
1583
 
 
1584
<dl class="method">
 
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">&lt;</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">&lt;</span> <span class="pre">b</span></tt>.</p>
 
1591
</dd></dl>
 
1592
 
 
1593
<dl class="method">
 
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>
 
1601
</dd></dl>
 
1602
 
 
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 &#8216;anonymous label&#8217; 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 &#8216;unnamed&#8217; like binary
 
1615
expressions and function calls.</p>
 
1616
</dd></dl>
 
1617
 
 
1618
<dl class="method">
 
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
 
1624
parent object.</p>
 
1625
</dd></dl>
 
1626
 
 
1627
<dl class="method">
 
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>
 
1634
</dd></dl>
 
1635
 
 
1636
<dl class="method">
 
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>
 
1643
</dd></dl>
 
1644
 
 
1645
<dl class="method">
 
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> &#8211; when True, consider two columns that
 
1658
share a common base column as equivalent (i.e. shares_lineage())</li>
 
1659
<li><strong>equivalents</strong> &#8211; a dictionary of columns as keys mapped to sets
 
1660
of columns. If the given &#8220;other&#8221; 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>
 
1665
</ul>
 
1666
</td>
 
1667
</tr>
 
1668
</tbody>
 
1669
</table>
 
1670
</dd></dl>
 
1671
 
 
1672
<dl class="method">
 
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> &#8211; 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>&#8216;s bound engine, if any.</li>
 
1692
<li><strong>column_keys</strong> &#8211; 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> &#8211; 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>&#8216;s bound engine, if
 
1699
any.</li>
 
1700
<li><strong>inline</strong> &#8211; 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&#8217;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>
 
1707
</ul>
 
1708
</td>
 
1709
</tr>
 
1710
</tbody>
 
1711
</table>
 
1712
</dd></dl>
 
1713
 
 
1714
<dl class="method">
 
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 &#8216;concat&#8217; 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>
 
1722
</dd></dl>
 
1723
 
 
1724
<dl class="method">
 
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 &#8216;contains&#8217; operator.</p>
 
1730
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%&lt;other&gt;%'</span></tt></p>
 
1731
</dd></dl>
 
1732
 
 
1733
<dl class="method">
 
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
 
1739
parent object.</p>
 
1740
</dd></dl>
 
1741
 
 
1742
<dl class="method">
 
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
 
1748
parent object.</p>
 
1749
</dd></dl>
 
1750
 
 
1751
<dl class="method">
 
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 &#8216;endswith&#8217; operator.</p>
 
1757
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%&lt;other&gt;'</span></tt></p>
 
1758
</dd></dl>
 
1759
 
 
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>
 
1767
</dd></dl>
 
1768
 
 
1769
<dl class="method">
 
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
 
1780
clause-level).</p>
 
1781
</dd></dl>
 
1782
 
 
1783
<dl class="method">
 
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>
 
1790
<p>E.g.:</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">&quot;</span><span class="si">%f</span><span class="s">oobar%&quot;</span><span class="p">))</span></pre></div>
 
1792
</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> &#8211; expression to be compared</li>
 
1799
<li><strong>escape</strong> &#8211; <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
 
1800
keyword, e.g.:</p>
 
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">&quot;foo/%bar&quot;</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">&quot;/&quot;</span><span class="p">)</span></pre></div>
 
1802
</div>
 
1803
</li>
 
1804
</ul>
 
1805
</td>
 
1806
</tr>
 
1807
</tbody>
 
1808
</table>
 
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>
 
1812
</div>
 
1813
</dd></dl>
 
1814
 
 
1815
<dl class="method">
 
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
&#8220;other&#8221; 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>
 
1824
</dd></dl>
 
1825
 
 
1826
<dl class="method">
 
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>
 
1838
</div>
 
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>
 
1842
</div>
 
1843
</dd></dl>
 
1844
 
 
1845
<dl class="method">
 
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>
 
1857
</div>
 
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>
 
1861
</div>
 
1862
</dd></dl>
 
1863
 
 
1864
<dl class="method">
 
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">&lt;columnname&gt;</span> <span class="pre">AS</span> <span class="pre">&lt;name&gt;</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 &#8216;name&#8217; is None, an anonymous label name will be generated.</p>
 
1872
</dd></dl>
 
1873
 
 
1874
<dl class="method">
 
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>
 
1881
<p>E.g.:</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">&quot;</span><span class="si">%f</span><span class="s">oobar%&quot;</span><span class="p">))</span></pre></div>
 
1883
</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> &#8211; expression to be compared</li>
 
1890
<li><strong>escape</strong> &#8211; <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
 
1891
keyword, e.g.:</p>
 
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">&quot;foo/%bar&quot;</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">&quot;/&quot;</span><span class="p">)</span></pre></div>
 
1893
</div>
 
1894
</li>
 
1895
</ul>
 
1896
</td>
 
1897
</tr>
 
1898
</tbody>
 
1899
</table>
 
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>
 
1903
</div>
 
1904
</dd></dl>
 
1905
 
 
1906
<dl class="method">
 
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 &#8216;match&#8217; 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">'&lt;other&gt;'</span></tt>.  The allowed contents of <tt class="docutils literal"><span class="pre">other</span></tt>
 
1914
are database backend specific.</p>
 
1915
</dd></dl>
 
1916
 
 
1917
<dl class="method">
 
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>
 
1927
</div>
 
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>
 
1931
</div>
 
1932
</dd></dl>
 
1933
 
 
1934
<dl class="method">
 
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>
 
1944
</div>
 
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>
 
1948
</div>
 
1949
</dd></dl>
 
1950
 
 
1951
<dl class="method">
 
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>
 
1961
</div>
 
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>
 
1965
</div>
 
1966
</dd></dl>
 
1967
 
 
1968
<dl class="method">
 
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
 
1974
parent object.</p>
 
1975
</dd></dl>
 
1976
 
 
1977
<dl class="method">
 
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
 
1983
parent object.</p>
 
1984
</dd></dl>
 
1985
 
 
1986
<dl class="method">
 
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>
 
1992
<p>e.g.:</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">&quot;*&quot;</span><span class="p">)(</span><span class="mi">5</span><span class="p">)</span></pre></div>
 
1994
</div>
 
1995
<p>produces:</p>
 
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>
 
1997
</div>
 
1998
<p>This function can also be used to make bitwise operators explicit. For
 
1999
example:</p>
 
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">&#39;&amp;&#39;</span><span class="p">)(</span><span class="mh">0xff</span><span class="p">)</span></pre></div>
 
2001
</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> &#8211; 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> &#8211; <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 &#8216;precedence&#8217; argument.</p>
 
2020
</div>
 
2021
</li>
 
2022
</ul>
 
2023
</td>
 
2024
</tr>
 
2025
</tbody>
 
2026
</table>
 
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>
 
2030
</div>
 
2031
</dd></dl>
 
2032
 
 
2033
<dl class="method">
 
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 &#8216;grouping&#8217; 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
&#8220;grouping&#8221; construct, i.e. parenthesis.   In particular
 
2041
it&#8217;s used by &#8220;binary&#8221; 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&#8217;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
 
2054
over OR.</p>
 
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>
 
2057
</dd></dl>
 
2058
 
 
2059
<dl class="method">
 
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>
 
2066
</dd></dl>
 
2067
 
 
2068
<dl class="method">
 
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">'&lt;other&gt;%'</span></tt></p>
 
2075
</dd></dl>
 
2076
 
 
2077
</dd></dl>
 
2078
 
 
2079
<dl class="class">
 
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
 
2084
instances.</p>
 
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>
 
2087
<dl class="method">
 
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>
 
2093
</dd></dl>
 
2094
 
 
2095
<dl class="method">
 
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
 
2100
same key.</p>
 
2101
<blockquote>
 
2102
<div><p>e.g.:</p>
 
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">&#39;sometable&#39;</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">&#39;col1&#39;</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">&#39;col1&#39;</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">&#39;columnone&#39;</span><span class="p">))</span></pre></div>
 
2105
</div>
 
2106
<p>will remove the original &#8216;col1&#8217; from the collection, and add
 
2107
the new column under the name &#8216;columnname&#8217;.</p>
 
2108
</div></blockquote>
 
2109
<p>Used by schema.Column to override columns during table reflection.</p>
 
2110
</dd></dl>
 
2111
 
 
2112
</dd></dl>
 
2113
 
 
2114
<dl class="class">
 
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
&#8220;columns&#8221; 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">&lt;</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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="n">column</span><span class="p">(</span><span class="s">&#39;a&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="n">column</span><span class="p">(</span><span class="s">&#39;b&#39;</span><span class="p">)</span>
 
2139
<span class="go">&lt;sqlalchemy.sql.expression.BinaryExpression object at 0x101029dd0&gt;</span>
 
2140
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">column</span><span class="p">(</span><span class="s">&#39;a&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="n">column</span><span class="p">(</span><span class="s">&#39;b&#39;</span><span class="p">)</span>
 
2141
<span class="go">a + b</span></pre></div>
 
2142
</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 &#8220;derived&#8221; <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>
 
2150
<dl class="method">
 
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>
 
2158
</dd></dl>
 
2159
 
 
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>
 
2166
</dd></dl>
 
2167
 
 
2168
<dl class="method">
 
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">&lt;=</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">&lt;=</span> <span class="pre">b</span></tt>.</p>
 
2175
</dd></dl>
 
2176
 
 
2177
<dl class="method">
 
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">&lt;</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">&lt;</span> <span class="pre">b</span></tt>.</p>
 
2184
</dd></dl>
 
2185
 
 
2186
<dl class="method">
 
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>
 
2194
</dd></dl>
 
2195
 
 
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 &#8216;anonymous label&#8217; 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 &#8216;unnamed&#8217; like binary
 
2206
expressions and function calls.</p>
 
2207
</dd></dl>
 
2208
 
 
2209
<dl class="method">
 
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
 
2215
parent object.</p>
 
2216
</dd></dl>
 
2217
 
 
2218
<dl class="method">
 
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>
 
2225
</dd></dl>
 
2226
 
 
2227
<dl class="method">
 
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>
 
2234
</dd></dl>
 
2235
 
 
2236
<dl class="method">
 
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> &#8211; when True, consider two columns that
 
2247
share a common base column as equivalent (i.e. shares_lineage())</li>
 
2248
<li><strong>equivalents</strong> &#8211; a dictionary of columns as keys mapped to sets
 
2249
of columns. If the given &#8220;other&#8221; 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>
 
2254
</ul>
 
2255
</td>
 
2256
</tr>
 
2257
</tbody>
 
2258
</table>
 
2259
</dd></dl>
 
2260
 
 
2261
<dl class="method">
 
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> &#8211; 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>&#8216;s bound engine, if any.</li>
 
2281
<li><strong>column_keys</strong> &#8211; 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> &#8211; 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>&#8216;s bound engine, if
 
2288
any.</li>
 
2289
<li><strong>inline</strong> &#8211; 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&#8217;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>
 
2296
</ul>
 
2297
</td>
 
2298
</tr>
 
2299
</tbody>
 
2300
</table>
 
2301
</dd></dl>
 
2302
 
 
2303
<dl class="method">
 
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 &#8216;concat&#8217; 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>
 
2311
</dd></dl>
 
2312
 
 
2313
<dl class="method">
 
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 &#8216;contains&#8217; operator.</p>
 
2319
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%&lt;other&gt;%'</span></tt></p>
 
2320
</dd></dl>
 
2321
 
 
2322
<dl class="method">
 
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
 
2328
parent object.</p>
 
2329
</dd></dl>
 
2330
 
 
2331
<dl class="method">
 
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
 
2337
parent object.</p>
 
2338
</dd></dl>
 
2339
 
 
2340
<dl class="method">
 
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 &#8216;endswith&#8217; operator.</p>
 
2346
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%&lt;other&gt;'</span></tt></p>
 
2347
</dd></dl>
 
2348
 
 
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>
 
2354
</dd></dl>
 
2355
 
 
2356
<dl class="method">
 
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
 
2367
clause-level).</p>
 
2368
</dd></dl>
 
2369
 
 
2370
<dl class="method">
 
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>
 
2377
<p>E.g.:</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">&quot;</span><span class="si">%f</span><span class="s">oobar%&quot;</span><span class="p">))</span></pre></div>
 
2379
</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> &#8211; expression to be compared</li>
 
2386
<li><strong>escape</strong> &#8211; <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
 
2387
keyword, e.g.:</p>
 
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">&quot;foo/%bar&quot;</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">&quot;/&quot;</span><span class="p">)</span></pre></div>
 
2389
</div>
 
2390
</li>
 
2391
</ul>
 
2392
</td>
 
2393
</tr>
 
2394
</tbody>
 
2395
</table>
 
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>
 
2399
</div>
 
2400
</dd></dl>
 
2401
 
 
2402
<dl class="method">
 
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
&#8220;other&#8221; 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>
 
2411
</dd></dl>
 
2412
 
 
2413
<dl class="method">
 
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>
 
2425
</div>
 
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>
 
2429
</div>
 
2430
</dd></dl>
 
2431
 
 
2432
<dl class="method">
 
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>
 
2444
</div>
 
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>
 
2448
</div>
 
2449
</dd></dl>
 
2450
 
 
2451
<dl class="method">
 
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">&lt;columnname&gt;</span> <span class="pre">AS</span> <span class="pre">&lt;name&gt;</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 &#8216;name&#8217; is None, an anonymous label name will be generated.</p>
 
2457
</dd></dl>
 
2458
 
 
2459
<dl class="method">
 
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>
 
2466
<p>E.g.:</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">&quot;</span><span class="si">%f</span><span class="s">oobar%&quot;</span><span class="p">))</span></pre></div>
 
2468
</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> &#8211; expression to be compared</li>
 
2475
<li><strong>escape</strong> &#8211; <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
 
2476
keyword, e.g.:</p>
 
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">&quot;foo/%bar&quot;</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">&quot;/&quot;</span><span class="p">)</span></pre></div>
 
2478
</div>
 
2479
</li>
 
2480
</ul>
 
2481
</td>
 
2482
</tr>
 
2483
</tbody>
 
2484
</table>
 
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>
 
2488
</div>
 
2489
</dd></dl>
 
2490
 
 
2491
<dl class="method">
 
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 &#8216;match&#8217; 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">'&lt;other&gt;'</span></tt>.  The allowed contents of <tt class="docutils literal"><span class="pre">other</span></tt>
 
2499
are database backend specific.</p>
 
2500
</dd></dl>
 
2501
 
 
2502
<dl class="method">
 
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>
 
2512
</div>
 
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>
 
2516
</div>
 
2517
</dd></dl>
 
2518
 
 
2519
<dl class="method">
 
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>
 
2529
</div>
 
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>
 
2533
</div>
 
2534
</dd></dl>
 
2535
 
 
2536
<dl class="method">
 
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>
 
2546
</div>
 
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>
 
2550
</div>
 
2551
</dd></dl>
 
2552
 
 
2553
<dl class="method">
 
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
 
2559
parent object.</p>
 
2560
</dd></dl>
 
2561
 
 
2562
<dl class="method">
 
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
 
2568
parent object.</p>
 
2569
</dd></dl>
 
2570
 
 
2571
<dl class="method">
 
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>
 
2577
<p>e.g.:</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">&quot;*&quot;</span><span class="p">)(</span><span class="mi">5</span><span class="p">)</span></pre></div>
 
2579
</div>
 
2580
<p>produces:</p>
 
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>
 
2582
</div>
 
2583
<p>This function can also be used to make bitwise operators explicit. For
 
2584
example:</p>
 
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">&#39;&amp;&#39;</span><span class="p">)(</span><span class="mh">0xff</span><span class="p">)</span></pre></div>
 
2586
</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> &#8211; 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> &#8211; <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 &#8216;precedence&#8217; argument.</p>
 
2605
</div>
 
2606
</li>
 
2607
</ul>
 
2608
</td>
 
2609
</tr>
 
2610
</tbody>
 
2611
</table>
 
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>
 
2615
</div>
 
2616
</dd></dl>
 
2617
 
 
2618
<dl class="method">
 
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">&gt;&gt;&gt; </span><span class="n">clause</span> <span class="o">=</span> <span class="n">column</span><span class="p">(</span><span class="s">&#39;x&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="n">bindparam</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">)</span>
 
2627
<span class="gp">&gt;&gt;&gt; </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">{&#39;foo&#39;:None}</span>
 
2629
<span class="gp">&gt;&gt;&gt; </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">&#39;foo&#39;</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">{&#39;foo&#39;:7}</span></pre></div>
 
2631
</div>
 
2632
</dd></dl>
 
2633
 
 
2634
<dl class="method">
 
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 &#8216;grouping&#8217; 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
&#8220;grouping&#8221; construct, i.e. parenthesis.   In particular
 
2642
it&#8217;s used by &#8220;binary&#8221; 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&#8217;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
 
2655
over OR.</p>
 
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>
 
2658
</dd></dl>
 
2659
 
 
2660
<dl class="method">
 
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>
 
2665
</dd></dl>
 
2666
 
 
2667
<dl class="method">
 
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">'&lt;other&gt;%'</span></tt></p>
 
2674
</dd></dl>
 
2675
 
 
2676
<dl class="method">
 
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
 
2684
used.</p>
 
2685
</dd></dl>
 
2686
 
 
2687
</dd></dl>
 
2688
 
 
2689
<dl class="class">
 
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>
 
2704
</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>
 
2708
</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
 
2713
construct.</p>
 
2714
<p>See also:</p>
 
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>
 
2719
<dl class="method">
 
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>
 
2728
</dd></dl>
 
2729
 
 
2730
<dl class="method">
 
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">&amp;</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">&amp;</span> <span class="n">b</span></pre></div>
 
2740
</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>
 
2744
</div>
 
2745
<p>Care should be taken when using <tt class="docutils literal"><span class="pre">&amp;</span></tt> regarding
 
2746
operator precedence; the <tt class="docutils literal"><span class="pre">&amp;</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">&amp;</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>
 
2750
</div>
 
2751
</dd></dl>
 
2752
 
 
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__(&#8216;name&#8217;) &lt;==&gt; del x.name</p>
 
2759
</dd></dl>
 
2760
 
 
2761
<dl class="method">
 
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>
 
2766
</dd></dl>
 
2767
 
 
2768
<dl class="method">
 
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>
 
2774
</dd></dl>
 
2775
 
 
2776
<dl class="method">
 
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>
 
2782
</dd></dl>
 
2783
 
 
2784
<dl class="method">
 
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">&gt;=</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">&gt;=</span> <span class="pre">b</span></tt>.</p>
 
2789
</dd></dl>
 
2790
 
 
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__(&#8216;name&#8217;) &lt;==&gt; x.name</p>
 
2797
</dd></dl>
 
2798
 
 
2799
<dl class="method">
 
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>
 
2805
</dd></dl>
 
2806
 
 
2807
<dl class="method">
 
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">&gt;</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">&gt;</span> <span class="pre">b</span></tt>.</p>
 
2812
</dd></dl>
 
2813
 
 
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__() &lt;==&gt; hash(x)</p>
 
2818
</dd></dl>
 
2819
 
 
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>
 
2826
</dd></dl>
 
2827
 
 
2828
<dl class="method">
 
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>
 
2838
</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>
 
2842
</div>
 
2843
</dd></dl>
 
2844
 
 
2845
<dl class="method">
 
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">&lt;=</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">&lt;=</span> <span class="pre">b</span></tt>.</p>
 
2850
</dd></dl>
 
2851
 
 
2852
<dl class="method">
 
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 &lt;&lt; operator.</p>
 
2856
<p>Not used by SQLAlchemy core, this is provided
 
2857
for custom operator systems which want to use
 
2858
&lt;&lt; as an extension point.</p>
 
2859
</dd></dl>
 
2860
 
 
2861
<dl class="method">
 
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">&lt;</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">&lt;</span> <span class="pre">b</span></tt>.</p>
 
2866
</dd></dl>
 
2867
 
 
2868
<dl class="method">
 
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>
 
2873
</dd></dl>
 
2874
 
 
2875
<dl class="method">
 
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>
 
2880
</dd></dl>
 
2881
 
 
2882
<dl class="method">
 
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>
 
2888
</dd></dl>
 
2889
 
 
2890
<dl class="method">
 
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>
 
2895
</dd></dl>
 
2896
 
 
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> &rarr; 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>
 
2902
</dd></dl>
 
2903
 
 
2904
<dl class="method">
 
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>
 
2914
</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>
 
2918
</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>
 
2924
</div>
 
2925
</dd></dl>
 
2926
 
 
2927
<dl class="method">
 
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>
 
2932
</dd></dl>
 
2933
 
 
2934
<dl class="method">
 
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>
 
2939
</dd></dl>
 
2940
 
 
2941
<dl class="method">
 
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>
 
2947
</dd></dl>
 
2948
 
 
2949
<dl class="method">
 
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>
 
2955
</dd></dl>
 
2956
 
 
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__() &lt;==&gt; repr(x)</p>
 
2963
</dd></dl>
 
2964
 
 
2965
<dl class="method">
 
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>
 
2970
</dd></dl>
 
2971
 
 
2972
<dl class="method">
 
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 &gt;&gt; operator.</p>
 
2976
<p>Not used by SQLAlchemy core, this is provided
 
2977
for custom operator systems which want to use
 
2978
&gt;&gt; as an extension point.</p>
 
2979
</dd></dl>
 
2980
 
 
2981
<dl class="method">
 
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>
 
2986
</dd></dl>
 
2987
 
 
2988
<dl class="method">
 
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>
 
2993
</dd></dl>
 
2994
 
 
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__(&#8216;name&#8217;, value) &lt;==&gt; x.name = value</p>
 
3001
</dd></dl>
 
3002
 
 
3003
<dl class="method">
 
3004
<dt id="sqlalchemy.sql.operators.ColumnOperators.__sizeof__">
 
3005
<tt class="descname">__sizeof__</tt><big>(</big><big>)</big> &rarr; 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>
 
3009
</dd></dl>
 
3010
 
 
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__() &lt;==&gt; str(x)</p>
 
3017
</dd></dl>
 
3018
 
 
3019
<dl class="method">
 
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>
 
3024
</dd></dl>
 
3025
 
 
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>
 
3036
</dd></dl>
 
3037
 
 
3038
<dl class="method">
 
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>
 
3043
</dd></dl>
 
3044
 
 
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>
 
3051
</dd></dl>
 
3052
 
 
3053
<dl class="method">
 
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
 
3057
parent object.</p>
 
3058
</dd></dl>
 
3059
 
 
3060
<dl class="method">
 
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>
 
3065
</dd></dl>
 
3066
 
 
3067
<dl class="method">
 
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>
 
3072
</dd></dl>
 
3073
 
 
3074
<dl class="method">
 
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 &#8216;concat&#8217; 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>
 
3080
</dd></dl>
 
3081
 
 
3082
<dl class="method">
 
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 &#8216;contains&#8217; operator.</p>
 
3086
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%&lt;other&gt;%'</span></tt></p>
 
3087
</dd></dl>
 
3088
 
 
3089
<dl class="method">
 
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
 
3093
parent object.</p>
 
3094
</dd></dl>
 
3095
 
 
3096
<dl class="method">
 
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
 
3100
parent object.</p>
 
3101
</dd></dl>
 
3102
 
 
3103
<dl class="method">
 
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 &#8216;endswith&#8217; operator.</p>
 
3107
<p>In a column context, produces the clause <tt class="docutils literal"><span class="pre">LIKE</span> <span class="pre">'%&lt;other&gt;'</span></tt></p>
 
3108
</dd></dl>
 
3109
 
 
3110
<dl class="method">
 
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>
 
3115
<p>E.g.:</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">&quot;</span><span class="si">%f</span><span class="s">oobar%&quot;</span><span class="p">))</span></pre></div>
 
3117
</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> &#8211; expression to be compared</li>
 
3124
<li><strong>escape</strong> &#8211; <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
 
3125
keyword, e.g.:</p>
 
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">&quot;foo/%bar&quot;</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">&quot;/&quot;</span><span class="p">)</span></pre></div>
 
3127
</div>
 
3128
</li>
 
3129
</ul>
 
3130
</td>
 
3131
</tr>
 
3132
</tbody>
 
3133
</table>
 
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>
 
3137
</div>
 
3138
</dd></dl>
 
3139
 
 
3140
<dl class="method">
 
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
&#8220;other&#8221; 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>
 
3147
</dd></dl>
 
3148
 
 
3149
<dl class="method">
 
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>
 
3159
</div>
 
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>
 
3163
</div>
 
3164
</dd></dl>
 
3165
 
 
3166
<dl class="method">
 
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>
 
3176
</div>
 
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>
 
3180
</div>
 
3181
</dd></dl>
 
3182
 
 
3183
<dl class="method">
 
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>
 
3188
<p>E.g.:</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">&quot;</span><span class="si">%f</span><span class="s">oobar%&quot;</span><span class="p">))</span></pre></div>
 
3190
</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> &#8211; expression to be compared</li>
 
3197
<li><strong>escape</strong> &#8211; <p>optional escape character, renders the <tt class="docutils literal"><span class="pre">ESCAPE</span></tt>
 
3198
keyword, e.g.:</p>
 
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">&quot;foo/%bar&quot;</span><span class="p">,</span> <span class="n">escape</span><span class="o">=</span><span class="s">&quot;/&quot;</span><span class="p">)</span></pre></div>
 
3200
</div>
 
3201
</li>
 
3202
</ul>
 
3203
</td>
 
3204
</tr>
 
3205
</tbody>
 
3206
</table>
 
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>
 
3210
</div>
 
3211
</dd></dl>
 
3212
 
 
3213
<dl class="method">
 
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 &#8216;match&#8217; 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">'&lt;other&gt;'</span></tt>.  The allowed contents of <tt class="docutils literal"><span class="pre">other</span></tt>
 
3219
are database backend specific.</p>
 
3220
</dd></dl>
 
3221
 
 
3222
<dl class="method">
 
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>
 
3230
</div>
 
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>
 
3234
</div>
 
3235
</dd></dl>
 
3236
 
 
3237
<dl class="method">
 
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>
 
3245
</div>
 
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>
 
3249
</div>
 
3250
</dd></dl>
 
3251
 
 
3252
<dl class="method">
 
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>
 
3260
</div>
 
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>
 
3264
</div>
 
3265
</dd></dl>
 
3266
 
 
3267
<dl class="method">
 
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
 
3271
parent object.</p>
 
3272
</dd></dl>
 
3273
 
 
3274
<dl class="method">
 
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
 
3278
parent object.</p>
 
3279
</dd></dl>
 
3280
 
 
3281
<dl class="method">
 
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>
 
3287
<p>e.g.:</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">&quot;*&quot;</span><span class="p">)(</span><span class="mi">5</span><span class="p">)</span></pre></div>
 
3289
</div>
 
3290
<p>produces:</p>
 
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>
 
3292
</div>
 
3293
<p>This function can also be used to make bitwise operators explicit. For
 
3294
example:</p>
 
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">&#39;&amp;&#39;</span><span class="p">)(</span><span class="mh">0xff</span><span class="p">)</span></pre></div>
 
3296
</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> &#8211; 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> &#8211; <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 &#8216;precedence&#8217; argument.</p>
 
3315
</div>
 
3316
</li>
 
3317
</ul>
 
3318
</td>
 
3319
</tr>
 
3320
</tbody>
 
3321
</table>
 
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>
 
3325
</div>
 
3326
</dd></dl>
 
3327
 
 
3328
<dl class="method">
 
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
 
3340
side:</p>
 
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>
 
3344
</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> &#8211; Operator callable.</li>
 
3351
<li><strong>*other</strong> &#8211; the &#8216;other&#8217; side of the operation. Will
 
3352
be a single scalar for most operations.</li>
 
3353
<li><strong>**kwargs</strong> &#8211; 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>
 
3355
</ul>
 
3356
</td>
 
3357
</tr>
 
3358
</tbody>
 
3359
</table>
 
3360
</dd></dl>
 
3361
 
 
3362
<dl class="method">
 
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>
 
3369
</dd></dl>
 
3370
 
 
3371
<dl class="method">
 
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">'&lt;other&gt;%'</span></tt></p>
 
3376
</dd></dl>
 
3377
 
 
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>
 
3382
</dd></dl>
 
3383
 
 
3384
</dd></dl>
 
3385
 
 
3386
<dl class="class">
 
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 &#8216;custom&#8217; 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 &#8220;factorial&#8221; 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>
 
3398
 
 
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">&quot;!&quot;</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>
 
3402
</div>
 
3403
</dd></dl>
 
3404
 
 
3405
<dl class="class">
 
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>
 
3413
<dl class="method">
 
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">&amp;</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">&amp;</span> <span class="n">b</span></pre></div>
 
3421
</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>
 
3425
</div>
 
3426
<p>Care should be taken when using <tt class="docutils literal"><span class="pre">&amp;</span></tt> regarding
 
3427
operator precedence; the <tt class="docutils literal"><span class="pre">&amp;</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">&amp;</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>
 
3431
</div>
 
3432
</dd></dl>
 
3433
 
 
3434
<dl class="method">
 
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>
 
3442
</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>
 
3446
</div>
 
3447
</dd></dl>
 
3448
 
 
3449
<dl class="method">
 
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>
 
3457
</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>
 
3461
</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>
 
3467
</div>
 
3468
</dd></dl>
 
3469
 
 
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>
 
3474
</dd></dl>
 
3475
 
 
3476
<dl class="method">
 
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>
 
3480
<p>e.g.:</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">&quot;*&quot;</span><span class="p">)(</span><span class="mi">5</span><span class="p">)</span></pre></div>
 
3482
</div>
 
3483
<p>produces:</p>
 
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>
 
3485
</div>
 
3486
<p>This function can also be used to make bitwise operators explicit. For
 
3487
example:</p>
 
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">&#39;&amp;&#39;</span><span class="p">)(</span><span class="mh">0xff</span><span class="p">)</span></pre></div>
 
3489
</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> &#8211; 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> &#8211; <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 &#8216;precedence&#8217; argument.</p>
 
3508
</div>
 
3509
</li>
 
3510
</ul>
 
3511
</td>
 
3512
</tr>
 
3513
</tbody>
 
3514
</table>
 
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>
 
3518
</div>
 
3519
</dd></dl>
 
3520
 
 
3521
<dl class="method">
 
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
 
3531
side:</p>
 
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>
 
3535
</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> &#8211; Operator callable.</li>
 
3542
<li><strong>*other</strong> &#8211; the &#8216;other&#8217; side of the operation. Will
 
3543
be a single scalar for most operations.</li>
 
3544
<li><strong>**kwargs</strong> &#8211; 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>
 
3546
</ul>
 
3547
</td>
 
3548
</tr>
 
3549
</tbody>
 
3550
</table>
 
3551
</dd></dl>
 
3552
 
 
3553
<dl class="method">
 
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>
 
3558
</dd></dl>
 
3559
 
 
3560
</dd></dl>
 
3561
 
 
3562
<dl class="class">
 
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 &#8216;unary&#8217; 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 &#8216;operator&#8217;) or right (where it is called the
 
3570
&#8216;modifier&#8217;) of the column expression.</p>
 
3571
<dl class="method">
 
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>
 
3576
</dd></dl>
 
3577
 
 
3578
</dd></dl>
 
3579
 
 
3580
</div>
 
3581
 
 
3582
    </div>
 
3583
 
 
3584
</div>
 
3585
 
 
3586
<div id="docs-bottom-navigation" class="docs-navigation-links">
 
3587
        Previous:
 
3588
        <a href="expression_api.html" title="previous chapter">SQL Statements and Expressions API</a>
 
3589
        Next:
 
3590
        <a href="selectable.html" title="next chapter">Selectables, Tables, FROM objects</a>
 
3591
 
 
3592
    <div id="docs-copyright">
 
3593
        &copy; <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.
 
3595
    </div>
 
3596
</div>
 
3597
 
 
3598
</div>
 
3599
 
 
3600
        
 
3601
    </body>
 
3602
</html>
 
3603
 
 
3604