This file is indexed.

/usr/share/doc/python-sqlalchemy-doc/html/glossary.html is in python-sqlalchemy-doc 0.8.4-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        
        <title>
            
    
                Glossary
             &mdash;
    SQLAlchemy 0.8 Documentation

        </title>

        
            <!-- begin iterate through SQLA + sphinx environment css_files -->
                <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
                <link rel="stylesheet" href="_static/docs.css" type="text/css" />
            <!-- end iterate through SQLA + sphinx environment css_files -->
        

        

    

    <!-- begin layout.mako headers -->

    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
          URL_ROOT:    './',
          VERSION:     '0.8.4',
          COLLAPSE_MODINDEX: false,
          FILE_SUFFIX: '.html'
      };
    </script>

    <!-- begin iterate through sphinx environment script_files -->
        <script type="text/javascript" src="_static/jquery.js"></script>
        <script type="text/javascript" src="_static/underscore.js"></script>
        <script type="text/javascript" src="_static/doctools.js"></script>
    <!-- end iterate through sphinx environment script_files -->

    <script type="text/javascript" src="_static/init.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
        <link rel="copyright" title="Copyright" href="copyright.html" />
    <link rel="top" title="SQLAlchemy 0.8 Documentation" href="index.html" />
    <!-- end layout.mako headers -->


    </head>
    <body>
        











<div id="docs-container">




<div id="docs-header">
    <h1>SQLAlchemy 0.8 Documentation</h1>

    <div id="docs-search">
    Search:
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" /> <input type="submit" value="Search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>

    <div id="docs-version-header">
        Release: <span class="version-num">0.8.4</span> | Release Date: December 8, 2013


    </div>

</div>

<div id="docs-top-navigation">
    <div id="docs-top-page-control" class="docs-navigation-links">
        <ul>

        <li>
            <a href="contents.html">Table of Contents</a> |
            <a href="genindex.html">Index</a>
            | <a href="_sources/glossary.txt">view source
        </li>
        </ul>
    </div>

    <div id="docs-navigation-banner">
        <a href="index.html">SQLAlchemy 0.8 Documentation</a>
        » 
                Glossary
            

        <h2>
            
                Glossary
            
        </h2>
    </div>

</div>

<div id="docs-body-container">

    <div id="docs-sidebar">
    <h3><a href="index.html">Table of Contents</a></h3>
    <ul>
<li><a class="reference internal" href="#">Glossary</a></li>
</ul>




    <h4>Quick Search</h4>
    <p>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" /> <input type="submit" value="Search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </p>

    </div>

    <div id="docs-body" class="withsidebar" >
        
<div class="section" id="glossary">
<span id="id1"></span><h1>Glossary<a class="headerlink" href="#glossary" title="Permalink to this headline"></a></h1>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The Glossary is a brand new addition to the documentation.  While
sparse at the moment we hope to fill it up with plenty of new
terms soon!</p>
</div>
<dl class="glossary docutils">
<dt id="term-acid"><span id="term-acid-model"></span>ACID<br />ACID model</dt>
<dd><p class="first">An acronym for &#8220;Atomicity, Consistency, Isolation,
Durability&#8221;; a set of properties that guarantee that
database transactions are processed reliably.
(via Wikipedia)</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p><a class="reference internal" href="#term-atomicity"><em class="xref std std-term">atomicity</em></a></p>
<p><a class="reference internal" href="#term-consistency"><em class="xref std std-term">consistency</em></a></p>
<p><a class="reference internal" href="#term-isolation"><em class="xref std std-term">isolation</em></a></p>
<p><a class="reference internal" href="#term-durability"><em class="xref std std-term">durability</em></a></p>
<p class="last"><a class="reference external" href="http://en.wikipedia.org/wiki/ACID_Model">http://en.wikipedia.org/wiki/ACID_Model</a></p>
</div>
</dd>
<dt id="term-annotations">annotations</dt>
<dd><p class="first">Annotations are a concept used internally by SQLAlchemy in order to store
additional information along with <a class="reference internal" href="core/sqlelement.html#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><tt class="xref py py-class docutils literal"><span class="pre">ClauseElement</span></tt></a> objects.  A Python
dictionary is associated with a copy of the object, which contains key/value
pairs significant to various internal systems, mostly within the ORM:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">some_column</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="s">&#39;some_column&#39;</span><span class="p">,</span> <span class="n">Integer</span><span class="p">)</span>
<span class="n">some_column_annotated</span> <span class="o">=</span> <span class="n">some_column</span><span class="o">.</span><span class="n">_annotate</span><span class="p">({</span><span class="s">&quot;entity&quot;</span><span class="p">:</span> <span class="n">User</span><span class="p">})</span></pre></div>
</div>
<p class="last">The annotation system differs from the public dictionary <a class="reference internal" href="core/metadata.html#sqlalchemy.schema.Column.info" title="sqlalchemy.schema.Column.info"><tt class="xref py py-attr docutils literal"><span class="pre">Column.info</span></tt></a>
in that the above annotation operation creates a <em>copy</em> of the new <a class="reference internal" href="core/metadata.html#sqlalchemy.schema.Column" title="sqlalchemy.schema.Column"><tt class="xref py py-class docutils literal"><span class="pre">Column</span></tt></a>,
rather than considering all annotation values to be part of a single
unit.  The ORM creates copies of expression objects in order to
apply annotations that are specific to their context, such as to differentiate
columns that should render themselves as relative to a joined-inheritance
entity versus those which should render relative to their immediate parent
table alone, as well as to differentiate columns within the &#8220;join condition&#8221;
of a relationship where the column in some cases needs to be expressed
in terms of one particular table alias or another, based on its position
within the join expression.</p>
</dd>
<dt id="term-atomicity">atomicity</dt>
<dd><p class="first">Atomicity is one of the components of the <a class="reference internal" href="#term-acid"><em class="xref std std-term">ACID</em></a> model,
and requires that each transaction is &#8220;all or nothing&#8221;:
if one part of the transaction fails, the entire transaction
fails, and the database state is left unchanged. An atomic
system must guarantee atomicity in each and every situation,
including power failures, errors, and crashes.
(via Wikipedia)</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p><a class="reference internal" href="#term-acid"><em class="xref std std-term">ACID</em></a></p>
<p class="last"><a class="reference external" href="http://en.wikipedia.org/wiki/Atomicity_(database_systems">http://en.wikipedia.org/wiki/Atomicity_(database_systems</a>)</p>
</div>
</dd>
<dt id="term-columns-clause">columns clause</dt>
<dd><p class="first">The portion of the <tt class="docutils literal"><span class="pre">SELECT</span></tt> statement which enumerates the
SQL expressions to be returned in the result set.  The expressions
follow the <tt class="docutils literal"><span class="pre">SELECT</span></tt> keyword directly and are a comma-separated
list of individual expressions.</p>
<p>E.g.:</p>
<div class="highlight-sql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="n">user_account</span><span class="p">.</span><span class="n">name</span><span class="p">,</span> <span class="n">user_account</span><span class="p">.</span><span class="n">email</span>
<span class="k">FROM</span> <span class="n">user_account</span> <span class="k">WHERE</span> <span class="n">user_account</span><span class="p">.</span><span class="n">name</span> <span class="o">=</span> <span class="s1">&#39;fred&#39;</span></pre></div>
</div>
<p class="last">Above, the list of columns <tt class="docutils literal"><span class="pre">user_acount.name</span></tt>,
<tt class="docutils literal"><span class="pre">user_account.email</span></tt> is the columns clause of the <tt class="docutils literal"><span class="pre">SELECT</span></tt>.</p>
</dd>
<dt id="term-consistency">consistency</dt>
<dd><p class="first">Consistency is one of the compoments of the <a class="reference internal" href="#term-acid"><em class="xref std std-term">ACID</em></a> model,
and ensures that any transaction will
bring the database from one valid state to another. Any data
written to the database must be valid according to all defined
rules, including but not limited to <em class="xref std std-term">constraints</em>, cascades,
triggers, and any combination thereof.
(via Wikipedia)</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p><a class="reference internal" href="#term-acid"><em class="xref std std-term">ACID</em></a></p>
<p class="last"><a class="reference external" href="http://en.wikipedia.org/wiki/Consistency_(database_systems">http://en.wikipedia.org/wiki/Consistency_(database_systems</a>)</p>
</div>
</dd>
<dt id="term-correlates"><span id="term-correlated-subquery"></span><span id="term-correlated-subqueries"></span>correlates<br />correlated subquery<br />correlated subqueries</dt>
<dd><p class="first">A <a class="reference internal" href="#term-subquery"><em class="xref std std-term">subquery</em></a> is correlated if it depends on data in the
enclosing <tt class="docutils literal"><span class="pre">SELECT</span></tt>.</p>
<p>Below, a subquery selects the aggregate value <tt class="docutils literal"><span class="pre">MIN(a.id)</span></tt>
from the <tt class="docutils literal"><span class="pre">email_address</span></tt> table, such that
it will be invoked for each value of <tt class="docutils literal"><span class="pre">user_account.id</span></tt>, correlating
the value of this column against the <tt class="docutils literal"><span class="pre">email_address.user_account_id</span></tt>
column:</p>
<div class="highlight-sql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="n">user_account</span><span class="p">.</span><span class="n">name</span><span class="p">,</span> <span class="n">email_address</span><span class="p">.</span><span class="n">email</span>
 <span class="k">FROM</span> <span class="n">user_account</span>
 <span class="k">JOIN</span> <span class="n">email_address</span> <span class="k">ON</span> <span class="n">user_account</span><span class="p">.</span><span class="n">id</span><span class="o">=</span><span class="n">email_address</span><span class="p">.</span><span class="n">user_account_id</span>
 <span class="k">WHERE</span> <span class="n">email_address</span><span class="p">.</span><span class="n">id</span> <span class="o">=</span> <span class="p">(</span>
    <span class="k">SELECT</span> <span class="k">MIN</span><span class="p">(</span><span class="n">a</span><span class="p">.</span><span class="n">id</span><span class="p">)</span> <span class="k">FROM</span> <span class="n">email_address</span> <span class="k">AS</span> <span class="n">a</span>
    <span class="k">WHERE</span> <span class="n">a</span><span class="p">.</span><span class="n">user_account_id</span><span class="o">=</span><span class="n">user_account</span><span class="p">.</span><span class="n">id</span>
 <span class="p">)</span></pre></div>
</div>
<p>The above subquery refers to the <tt class="docutils literal"><span class="pre">user_account</span></tt> table, which is not itself
in the <tt class="docutils literal"><span class="pre">FROM</span></tt> clause of this nested query.   Instead, the <tt class="docutils literal"><span class="pre">user_account</span></tt>
table is recieved from the enclosing query, where each row selected from
<tt class="docutils literal"><span class="pre">user_account</span></tt> results in a distinct execution of the subquery.</p>
<p>A correlated subquery is in most cases present in the <a class="reference internal" href="#term-where-clause"><em class="xref std std-term">WHERE clause</em></a>
or <a class="reference internal" href="#term-columns-clause"><em class="xref std std-term">columns clause</em></a> of the immediately enclosing <tt class="docutils literal"><span class="pre">SELECT</span></tt>
statement, as well as in the ORDER BY or HAVING clause.</p>
<p>In less common cases, a correlated subquery may be present in the
<a class="reference internal" href="#term-from-clause"><em class="xref std std-term">FROM clause</em></a> of an enclosing <tt class="docutils literal"><span class="pre">SELECT</span></tt>; in these cases the
correlation is typically due to the enclosing <tt class="docutils literal"><span class="pre">SELECT</span></tt> itself being
enclosed in the WHERE,
ORDER BY, columns or HAVING clause of another <tt class="docutils literal"><span class="pre">SELECT</span></tt>, such as:</p>
<div class="highlight-sql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="n">parent</span><span class="p">.</span><span class="n">id</span> <span class="k">FROM</span> <span class="n">parent</span>
<span class="k">WHERE</span> <span class="k">EXISTS</span> <span class="p">(</span>
    <span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="p">(</span>
        <span class="k">SELECT</span> <span class="n">child</span><span class="p">.</span><span class="n">id</span> <span class="k">AS</span> <span class="n">id</span><span class="p">,</span> <span class="n">child</span><span class="p">.</span><span class="n">parent_id</span> <span class="k">AS</span> <span class="n">parent_id</span><span class="p">,</span> <span class="n">child</span><span class="p">.</span><span class="n">pos</span> <span class="k">AS</span> <span class="n">pos</span>
        <span class="k">FROM</span> <span class="n">child</span>
        <span class="k">WHERE</span> <span class="n">child</span><span class="p">.</span><span class="n">parent_id</span> <span class="o">=</span> <span class="n">parent</span><span class="p">.</span><span class="n">id</span> <span class="k">ORDER</span> <span class="k">BY</span> <span class="n">child</span><span class="p">.</span><span class="n">pos</span>
    <span class="k">LIMIT</span> <span class="mi">3</span><span class="p">)</span>
<span class="k">WHERE</span> <span class="n">id</span> <span class="o">=</span> <span class="mi">7</span><span class="p">)</span></pre></div>
</div>
<p class="last">Correlation from one <tt class="docutils literal"><span class="pre">SELECT</span></tt> directly to one which encloses the correlated
query via its <tt class="docutils literal"><span class="pre">FROM</span></tt>
clause is not possible, because the correlation can only proceed once the
original source rows from the enclosing statement&#8217;s FROM clause are available.</p>
</dd>
<dt id="term-dbapi">DBAPI</dt>
<dd><p class="first">DBAPI is shorthand for the phrase &#8220;Python Database API
Specification&#8221;.  This is a widely used specification
within Python to define common usage patterns for all
database connection packages.   The DBAPI is a &#8220;low level&#8221;
API which is typically the lowest level system used
in a Python application to talk to a database.  SQLAlchemy&#8217;s
<em class="xref std std-term">dialect</em> system is constructed around the
operation of the DBAPI, providing individual dialect
classes which service a specific DBAPI on top of a
specific database engine; for example, the <a class="reference internal" href="core/engines.html#sqlalchemy.create_engine" title="sqlalchemy.create_engine"><tt class="xref py py-func docutils literal"><span class="pre">create_engine()</span></tt></a>
URL <tt class="docutils literal"><span class="pre">postgresql+psycopg2://&#64;localhost/test</span></tt>
refers to the <a class="reference internal" href="dialects/postgresql.html#module-sqlalchemy.dialects.postgresql.psycopg2" title="sqlalchemy.dialects.postgresql.psycopg2"><tt class="xref py py-mod docutils literal"><span class="pre">psycopg2</span></tt></a>
DBAPI/dialect combination, whereas the URL <tt class="docutils literal"><span class="pre">mysql+mysqldb://&#64;localhost/test</span></tt>
refers to the <a class="reference internal" href="dialects/mysql.html#module-sqlalchemy.dialects.mysql.mysqldb" title="sqlalchemy.dialects.mysql.mysqldb"><tt class="xref py py-mod docutils literal"><span class="pre">MySQL</span> <span class="pre">for</span> <span class="pre">Python</span></tt></a>
DBAPI DBAPI/dialect combination.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference external" href="http://www.python.org/dev/peps/pep-0249/">PEP 249 - Python Database API Specification v2.0</a></p>
</div>
</dd>
<dt id="term-descriptor"><span id="term-descriptors"></span>descriptor<br />descriptors</dt>
<dd><p class="first">In Python, a descriptor is an object attribute with “binding behavior”, one whose attribute access has been overridden by methods in the <a class="reference external" href="http://docs.python.org/howto/descriptor.html">descriptor protocol</a>.
Those methods are __get__(), __set__(), and __delete__(). If any of those methods are defined
for an object, it is said to be a descriptor.</p>
<p>In SQLAlchemy, descriptors are used heavily in order to provide attribute behavior
on mapped classes.   When a class is mapped as such:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">MyClass</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
    <span class="n">__tablename__</span> <span class="o">=</span> <span class="s">&#39;foo&#39;</span>

    <span class="nb">id</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">Integer</span><span class="p">,</span> <span class="n">primary_key</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
    <span class="n">data</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">)</span></pre></div>
</div>
<p>The <tt class="docutils literal"><span class="pre">MyClass</span></tt> class will be <a class="reference internal" href="#term-mapped"><em class="xref std std-term">mapped</em></a> when its definition
is complete, at which point the <tt class="docutils literal"><span class="pre">id</span></tt> and <tt class="docutils literal"><span class="pre">data</span></tt> attributes,
starting out as <a class="reference internal" href="core/metadata.html#sqlalchemy.schema.Column" title="sqlalchemy.schema.Column"><tt class="xref py py-class docutils literal"><span class="pre">Column</span></tt></a> objects, will be replaced
by the <a class="reference internal" href="#term-instrumentation"><em class="xref std std-term">instrumentation</em></a> system with instances
of <a class="reference internal" href="orm/internals.html#sqlalchemy.orm.attributes.InstrumentedAttribute" title="sqlalchemy.orm.attributes.InstrumentedAttribute"><tt class="xref py py-class docutils literal"><span class="pre">InstrumentedAttribute</span></tt></a>, which are descriptors that
provide the above mentioned <tt class="docutils literal"><span class="pre">__get__()</span></tt>, <tt class="docutils literal"><span class="pre">__set__()</span></tt> and
<tt class="docutils literal"><span class="pre">__delete__()</span></tt> methods.   The <a class="reference internal" href="orm/internals.html#sqlalchemy.orm.attributes.InstrumentedAttribute" title="sqlalchemy.orm.attributes.InstrumentedAttribute"><tt class="xref py py-class docutils literal"><span class="pre">InstrumentedAttribute</span></tt></a>
will generate a SQL expression when used at the class level:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">MyClass</span><span class="o">.</span><span class="n">data</span> <span class="o">==</span> <span class="mi">5</span>
<span class="go">data = :data_1</span></pre></div>
</div>
<p>and at the instance level, keeps track of changes to values,
and also <a class="reference internal" href="#term-lazy-loads"><em class="xref std std-term">lazy loads</em></a> unloaded attributes
from the database:</p>
<div class="last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">m1</span> <span class="o">=</span> <span class="n">MyClass</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">m1</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="mi">5</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">m1</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="s">&quot;some data&quot;</span>

<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">inspect</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">inspect</span><span class="p">(</span><span class="n">m1</span><span class="p">)</span><span class="o">.</span><span class="n">attrs</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">added</span>
<span class="go">&quot;some data&quot;</span></pre></div>
</div>
</dd>
<dt id="term-discriminator">discriminator</dt>
<dd><p class="first">A result-set column which is used during <a class="reference internal" href="#term-polymorphic"><em class="xref std std-term">polymorphic</em></a> loading
to determine what kind of mapped class should be applied to a particular
incoming result row.   In SQLAlchemy, the classes are always part
of a hierarchy mapping using inheritance mapping.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="orm/inheritance.html"><em>Mapping Class Inheritance Hierarchies</em></a></p>
</div>
</dd>
<dt id="term-durability">durability</dt>
<dd><p class="first">Durability is a property of the <a class="reference internal" href="#term-acid"><em class="xref std std-term">ACID</em></a> model
which means that once a transaction has been committed,
it will remain so, even in the event of power loss, crashes,
or errors. In a relational database, for instance, once a
group of SQL statements execute, the results need to be stored
permanently (even if the database crashes immediately
thereafter).
(via Wikipedia)</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p><a class="reference internal" href="#term-acid"><em class="xref std std-term">ACID</em></a></p>
<p class="last"><a class="reference external" href="http://en.wikipedia.org/wiki/Durability_(database_systems">http://en.wikipedia.org/wiki/Durability_(database_systems</a>)</p>
</div>
</dd>
<dt id="term-from-clause">FROM clause</dt>
<dd><p class="first">The portion of the <tt class="docutils literal"><span class="pre">SELECT</span></tt> statement which incicates the initial
source of rows.</p>
<p>A simple <tt class="docutils literal"><span class="pre">SELECT</span></tt> will feature one or more table names in its
FROM clause.  Multiple sources are separated by a comma:</p>
<div class="highlight-sql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="k">user</span><span class="p">.</span><span class="n">name</span><span class="p">,</span> <span class="n">address</span><span class="p">.</span><span class="n">email_address</span>
<span class="k">FROM</span> <span class="k">user</span><span class="p">,</span> <span class="n">address</span>
<span class="k">WHERE</span> <span class="k">user</span><span class="p">.</span><span class="n">id</span><span class="o">=</span><span class="n">address</span><span class="p">.</span><span class="n">user_id</span></pre></div>
</div>
<p>The FROM clause is also where explicit joins are specified.  We can
rewrite the above <tt class="docutils literal"><span class="pre">SELECT</span></tt> using a single <tt class="docutils literal"><span class="pre">FROM</span></tt> element which consists
of a <tt class="docutils literal"><span class="pre">JOIN</span></tt> of the two tables:</p>
<div class="last highlight-sql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="k">user</span><span class="p">.</span><span class="n">name</span><span class="p">,</span> <span class="n">address</span><span class="p">.</span><span class="n">email_address</span>
<span class="k">FROM</span> <span class="k">user</span> <span class="k">JOIN</span> <span class="n">address</span> <span class="k">ON</span> <span class="k">user</span><span class="p">.</span><span class="n">id</span><span class="o">=</span><span class="n">address</span><span class="p">.</span><span class="n">user_id</span></pre></div>
</div>
</dd>
<dt id="term-generative">generative</dt>
<dd>A term that SQLAlchemy uses to refer what&#8217;s normally known
as <a class="reference internal" href="#term-method-chaining"><em class="xref std std-term">method chaining</em></a>; see that term for details.</dd>
<dt id="term-identity-map">identity map</dt>
<dd><p class="first">A mapping between Python objects and their database identities.
The identity map is a collection that&#8217;s associated with an
ORM <a class="reference internal" href="#term-session"><em class="xref std std-term">session</em></a> object, and maintains a single instance
of every database object keyed to its identity.   The advantage
to this pattern is that all operations which occur for a particular
database identity are transparently coordinated onto a single
object instance.  When using an identity map in conjunction with
an <a class="reference internal" href="#term-isolated"><em class="xref std std-term">isolated</em></a> transaction, having a reference
to an object that&#8217;s known to have a particular primary key can
be considered from a practical standpoint to be a
proxy to the actual database row.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">Martin Fowler - Identity Map - <a class="reference external" href="http://martinfowler.com/eaaCatalog/identityMap.html">http://martinfowler.com/eaaCatalog/identityMap.html</a></p>
</div>
</dd>
<dt id="term-instrumentation"><span id="term-instrumented"></span>instrumentation<br />instrumented</dt>
<dd>Instrumentation refers to the process of augmenting the functionality
and attribute set of a particular class.   Ideally, the
behavior of the class should remain close to a regular
class, except that additional behviors and features are
made available.  The SQLAlchemy <a class="reference internal" href="#term-mapping"><em class="xref std std-term">mapping</em></a> process,
among other things, adds database-enabled <a class="reference internal" href="#term-descriptors"><em class="xref std std-term">descriptors</em></a>
to a mapped
class which each represent a particular database column
or relationship to a related class.</dd>
<dt id="term-isolation"><span id="term-isolated"></span>isolation<br />isolated</dt>
<dd><p class="first">The isolation property of the <a class="reference internal" href="#term-acid"><em class="xref std std-term">ACID</em></a> model
ensures that the concurrent execution
of transactions results in a system state that would be
obtained if transactions were executed serially, i.e. one
after the other. Each transaction must execute in total
isolation i.e. if T1 and T2 execute concurrently then each
should remain independent of the other.
(via Wikipedia)</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p><a class="reference internal" href="#term-acid"><em class="xref std std-term">ACID</em></a></p>
<p class="last"><a class="reference external" href="http://en.wikipedia.org/wiki/Isolation_(database_systems">http://en.wikipedia.org/wiki/Isolation_(database_systems</a>)</p>
</div>
</dd>
<dt id="term-lazy-load"><span id="term-lazy-loads"></span>lazy load<br />lazy loads</dt>
<dd><p class="first">In object relational mapping, a &#8220;lazy load&#8221; refers to an
attribute that does not contain its database-side value
for some period of time, typically when the object is
first loaded.  Instead, the attribute receives a
<em>memoization</em> that causes it to go out to the database
and load its data when it&#8217;s first used.   Using this pattern,
the complexity and time spent within object fetches can
sometimes be reduced, in that
attributes for related tables don&#8217;t need to be addressed
immediately.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p><a class="reference external" href="http://martinfowler.com/eaaCatalog/lazyLoad.html">Lazy Load (on Martin Fowler)</a></p>
<p><a class="reference internal" href="#term-n-plus-one-problem"><em class="xref std std-term">N plus one problem</em></a></p>
<p class="last"><a class="reference internal" href="orm/loading.html"><em>Relationship Loading Techniques</em></a></p>
</div>
</dd>
<dt id="term-mapping"><span id="term-mapped"></span>mapping<br />mapped</dt>
<dd>We say a class is &#8220;mapped&#8221; when it has been passed through the
<a class="reference internal" href="orm/mapper_config.html#sqlalchemy.orm.mapper" title="sqlalchemy.orm.mapper"><tt class="xref py py-func docutils literal"><span class="pre">orm.mapper()</span></tt></a> function.   This process associates the
class with a database table or other <em class="xref std std-term">selectable</em>
construct, so that instances of it can be persisted
using a <a class="reference internal" href="orm/session.html#sqlalchemy.orm.session.Session" title="sqlalchemy.orm.session.Session"><tt class="xref py py-class docutils literal"><span class="pre">Session</span></tt></a> as well as loaded using a
<a class="reference internal" href="orm/query.html#sqlalchemy.orm.query.Query" title="sqlalchemy.orm.query.Query"><tt class="xref py py-class docutils literal"><span class="pre">Query</span></tt></a>.</dd>
<dt id="term-method-chaining">method chaining</dt>
<dd><p class="first">An object-oriented technique whereby the state of an object
is constructed by calling methods on the object.   The
object features any number of methods, each of which return
a new object (or in some cases the same object) with
additional state added to the object.</p>
<p>The two SQLAlchemy objects that make the most use of
method chaining are the <a class="reference internal" href="core/selectable.html#sqlalchemy.sql.expression.Select" title="sqlalchemy.sql.expression.Select"><tt class="xref py py-class docutils literal"><span class="pre">Select</span></tt></a>
object and the <a class="reference internal" href="orm/query.html#sqlalchemy.orm.query.Query" title="sqlalchemy.orm.query.Query"><tt class="xref py py-class docutils literal"><span class="pre">Query</span></tt></a> object.
For example, a <a class="reference internal" href="core/selectable.html#sqlalchemy.sql.expression.Select" title="sqlalchemy.sql.expression.Select"><tt class="xref py py-class docutils literal"><span class="pre">Select</span></tt></a> object can
be assigned two expressions to its WHERE clause as well
as an ORDER BY clause by calling upon the <a class="reference internal" href="core/selectable.html#sqlalchemy.sql.expression.Select.where" title="sqlalchemy.sql.expression.Select.where"><tt class="xref py py-meth docutils literal"><span class="pre">where()</span></tt></a>
and <a class="reference internal" href="core/selectable.html#sqlalchemy.sql.expression.Select.order_by" title="sqlalchemy.sql.expression.Select.order_by"><tt class="xref py py-meth docutils literal"><span class="pre">order_by()</span></tt></a> methods:</p>
<div class="highlight-python"><div class="highlight"><pre>stmt = select([user.c.name]).\
            where(user.c.id &gt; 5).\
            where(user.c.name.like(&#39;e%&#39;).\
            order_by(user.c.name)</pre></div>
</div>
<p>Each method call above returns a copy of the original
<a class="reference internal" href="core/selectable.html#sqlalchemy.sql.expression.Select" title="sqlalchemy.sql.expression.Select"><tt class="xref py py-class docutils literal"><span class="pre">Select</span></tt></a> object with additional qualifiers
added.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="#term-generative"><em class="xref std std-term">generative</em></a></p>
</div>
</dd>
<dt id="term-n-plus-one-problem">N plus one problem</dt>
<dd><p class="first">The N plus one problem is a common side effect of the
<a class="reference internal" href="#term-lazy-load"><em class="xref std std-term">lazy load</em></a> pattern, whereby an application wishes
to iterate through a related attribute or collection on
each member of a result set of objects, where that
attribute or collection is set to be loaded via the lazy
load pattern.   The net result is that a SELECT statement
is emitted to load the initial result set of parent objects;
then, as the application iterates through each member,
an additional SELECT statement is emitted for each member
in order to load the related attribute or collection for
that member.  The end result is that for a result set of
N parent objects, there will be N + 1 SELECT statements emitted.</p>
<p>The N plus one problem is alleviated using <em class="xref std std-term">eager loading</em>.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="orm/loading.html"><em>Relationship Loading Techniques</em></a></p>
</div>
</dd>
<dt id="term-polymorphic"><span id="term-polymorphically"></span>polymorphic<br />polymorphically</dt>
<dd><p class="first">Refers to a function that handles several types at once.  In SQLAlchemy,
the term is usually applied to the concept of an ORM mapped class
whereby a query operation will return different subclasses
based on information in the result set, typically by checking the
value of a particular column in the result known as the <a class="reference internal" href="#term-discriminator"><em class="xref std std-term">discriminator</em></a>.</p>
<p class="last">Polymorphic loading in SQLAlchemy implies that a one or a
combination of three different schemes are used to map a hierarchy
of classes; &#8220;joined&#8221;, &#8220;single&#8221;, and &#8220;concrete&#8221;.   The section
<a class="reference internal" href="orm/inheritance.html"><em>Mapping Class Inheritance Hierarchies</em></a> describes inheritance mapping fully.</p>
</dd>
<dt id="term-release"><span id="term-releases"></span><span id="term-released"></span>release<br />releases<br />released</dt>
<dd><p class="first">In the context of SQLAlchemy, the term &#8220;released&#8221;
refers to the process of ending the usage of a particular
database connection.    SQLAlchemy features the usage
of connection pools, which allows configurability as to
the lifespan of database connections.   When using a pooled
connection, the process of &#8220;closing&#8221; it, i.e. invoking
a statement like <tt class="docutils literal"><span class="pre">connection.close()</span></tt>, may have the effect
of the connection being returned to an existing pool,
or it may have the effect of actually shutting down the
underlying TCP/IP connection referred to by that connection -
which one takes place depends on configuration as well
as the current state of the pool.  So we used the term
<em>released</em> instead, to mean &#8220;do whatever it is you do
with connections when we&#8217;re done using them&#8221;.</p>
<p>The term will sometimes be used in the phrase, &#8220;release
transactional resources&#8221;, to indicate more explicitly that
what we are actually &#8220;releasing&#8221; is any transactional
state which as accumulated upon the connection.  In most
situations, the proces of selecting from tables, emitting
updates, etc. acquires <a class="reference internal" href="#term-isolated"><em class="xref std std-term">isolated</em></a> state upon
that connection as well as potential row or table locks.
This state is all local to a particular transaction
on the connection, and is released when we emit a rollback.
An important feature of the connection pool is that when
we return a connection to the pool, the <tt class="docutils literal"><span class="pre">connection.rollback()</span></tt>
method of the DBAPI is called as well, so that as the
connection is set up to be used again, it&#8217;s in a &#8220;clean&#8221;
state with no references held to the previous series
of operations.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="core/pooling.html"><em>Connection Pooling</em></a></p>
</div>
</dd>
<dt id="term-returning">RETURNING</dt>
<dd><p class="first">This is a non-SQL standard clause provided in various forms by
certain backends, which provides the service of returning a result
set upon execution of an INSERT, UPDATE or DELETE statement.  Any set
of columns from the matched rows can be returned, as though they were
produced from a SELECT statement.</p>
<p>The RETURNING clause provides both a dramatic performance boost to
common update/select scenarios, including retrieval of inline- or
default- generated primary key values and defaults at the moment they
were created, as well as a way to get at server-generated
default values in an atomic way.</p>
<p>An example of RETURNING, idiomatic to Postgresql, looks like:</p>
<div class="highlight-python"><div class="highlight"><pre>INSERT INTO user_account (name) VALUES (&#39;new name&#39;) RETURNING id, timestamp</pre></div>
</div>
<p>Above, the INSERT statement will provide upon execution a result set
which includes the values of the columns <tt class="docutils literal"><span class="pre">user_account.id</span></tt> and
<tt class="docutils literal"><span class="pre">user_account.timestamp</span></tt>, which above should have been generated as default
values as they are not included otherwise (but note any series of columns
or SQL expressions can be placed into RETURNING, not just default-value columns).</p>
<p>The backends that currently support
RETURNING or a similar construct are Postgresql, SQL Server, Oracle,
and Firebird.    The Postgresql and Firebird implementations are generally
full featured, whereas the implementations of SQL Server and Oracle
have caveats. On SQL Server, the clause is known as &#8220;OUTPUT INSERTED&#8221;
for INSERT and UPDATE statements and &#8220;OUTPUT DELETED&#8221; for DELETE statements;
the key caveat is that triggers are not supported in conjunction with this
keyword.  On Oracle, it is known as &#8220;RETURNING...INTO&#8221;, and requires that the
value be placed into an OUT paramter, meaning not only is the syntax awkward,
but it can also only be used for one row at a time.</p>
<p class="last">SQLAlchemy&#8217;s <a class="reference internal" href="core/dml.html#sqlalchemy.sql.expression.UpdateBase.returning" title="sqlalchemy.sql.expression.UpdateBase.returning"><tt class="xref py py-meth docutils literal"><span class="pre">UpdateBase.returning()</span></tt></a> system provides a layer of abstraction
on top of the RETURNING systems of these backends to provide a consistent
interface for returning columns.  The ORM also includes many optimizations
that make use of RETURNING when available.</p>
</dd>
<dt id="term-session">Session</dt>
<dd><p class="first">The container or scope for ORM database operations. Sessions
load instances from the database, track changes to mapped
instances and persist changes in a single unit of work when
flushed.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="orm/session.html"><em>Using the Session</em></a></p>
</div>
</dd>
<dt id="term-subquery">subquery</dt>
<dd><p class="first">Refers to a <tt class="docutils literal"><span class="pre">SELECT</span></tt> statement that is embedded within an enclosing
<tt class="docutils literal"><span class="pre">SELECT</span></tt>.</p>
<p>A subquery comes in two general flavors, one known as a &#8220;scalar select&#8221;
which specifically must return exactly one row and one column, and the
other form which acts as a &#8220;derived table&#8221; and serves as a source of
rows for the FROM clause of another select.  A scalar select is eligble
to be placed in the <a class="reference internal" href="#term-where-clause"><em class="xref std std-term">WHERE clause</em></a>, <a class="reference internal" href="#term-columns-clause"><em class="xref std std-term">columns clause</em></a>,
ORDER BY clause or HAVING clause of the enclosing select, whereas the
derived table form is eligible to be placed in the FROM clause of the
enclosing <tt class="docutils literal"><span class="pre">SELECT</span></tt>.</p>
<p>Examples:</p>
<ol class="last arabic">
<li><p class="first">a scalar subquery placed in the <a class="reference internal" href="#term-columns-clause"><em class="xref std std-term">columns clause</em></a> of an enclosing
<tt class="docutils literal"><span class="pre">SELECT</span></tt>.  The subquery in this example is a <a class="reference internal" href="#term-correlated-subquery"><em class="xref std std-term">correlated subquery</em></a> because part
of the rows which it selects from are given via the enclosing statement.</p>
<div class="highlight-sql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="n">id</span><span class="p">,</span> <span class="p">(</span><span class="k">SELECT</span> <span class="n">name</span> <span class="k">FROM</span> <span class="n">address</span> <span class="k">WHERE</span> <span class="n">address</span><span class="p">.</span><span class="n">user_id</span><span class="o">=</span><span class="k">user</span><span class="p">.</span><span class="n">id</span><span class="p">)</span>
<span class="k">FROM</span> <span class="k">user</span></pre></div>
</div>
</li>
<li><p class="first">a scalar subquery placed in the <a class="reference internal" href="#term-where-clause"><em class="xref std std-term">WHERE clause</em></a> of an enclosing
<tt class="docutils literal"><span class="pre">SELECT</span></tt>.  This subquery in this example is not correlated as it selects a fixed result.</p>
<div class="highlight-sql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="n">id</span><span class="p">,</span> <span class="n">name</span> <span class="k">FROM</span> <span class="k">user</span>
<span class="k">WHERE</span> <span class="n">status</span><span class="o">=</span><span class="p">(</span><span class="k">SELECT</span> <span class="n">status_id</span> <span class="k">FROM</span> <span class="n">status_code</span> <span class="k">WHERE</span> <span class="n">code</span><span class="o">=</span><span class="s1">&#39;C&#39;</span><span class="p">)</span></pre></div>
</div>
</li>
<li><p class="first">a derived table subquery placed in the <a class="reference internal" href="#term-from-clause"><em class="xref std std-term">FROM clause</em></a> of an enclosing
<tt class="docutils literal"><span class="pre">SELECT</span></tt>.   Such a subquery is almost always given an alias name.</p>
<div class="highlight-sql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="k">user</span><span class="p">.</span><span class="n">id</span><span class="p">,</span> <span class="k">user</span><span class="p">.</span><span class="n">name</span><span class="p">,</span> <span class="n">ad_subq</span><span class="p">.</span><span class="n">email_address</span>
<span class="k">FROM</span>
    <span class="k">user</span> <span class="k">JOIN</span>
    <span class="p">(</span><span class="k">select</span> <span class="n">user_id</span><span class="p">,</span> <span class="n">email_address</span> <span class="k">FROM</span> <span class="n">address</span> <span class="k">WHERE</span> <span class="n">address_type</span><span class="o">=</span><span class="s1">&#39;Q&#39;</span><span class="p">)</span> <span class="k">AS</span> <span class="n">ad_subq</span>
    <span class="k">ON</span> <span class="k">user</span><span class="p">.</span><span class="n">id</span> <span class="o">=</span> <span class="n">ad_subq</span><span class="p">.</span><span class="n">user_id</span></pre></div>
</div>
</li>
</ol>
</dd>
<dt id="term-unit-of-work">unit of work</dt>
<dd><p class="first">This pattern is where the system transparently keeps
track of changes to objects and periodically flushes all those
pending changes out to the database. SQLAlchemy&#8217;s Session
implements this pattern fully in a manner similar to that of
Hibernate.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p><a class="reference external" href="http://martinfowler.com/eaaCatalog/unitOfWork.html">Unit of Work by Martin Fowler</a></p>
<p class="last"><a class="reference internal" href="orm/session.html"><em>Using the Session</em></a></p>
</div>
</dd>
<dt id="term-where-clause">WHERE clause</dt>
<dd><p class="first">The portion of the <tt class="docutils literal"><span class="pre">SELECT</span></tt> statement which indicates criteria
by which rows should be filtered.   It is a single SQL expression
which follows the keyword <tt class="docutils literal"><span class="pre">WHERE</span></tt>.</p>
<div class="highlight-sql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="n">user_account</span><span class="p">.</span><span class="n">name</span><span class="p">,</span> <span class="n">user_account</span><span class="p">.</span><span class="n">email</span>
<span class="k">FROM</span> <span class="n">user_account</span>
<span class="k">WHERE</span> <span class="n">user_account</span><span class="p">.</span><span class="n">name</span> <span class="o">=</span> <span class="s1">&#39;fred&#39;</span> <span class="k">AND</span> <span class="n">user_account</span><span class="p">.</span><span class="n">status</span> <span class="o">=</span> <span class="s1">&#39;E&#39;</span></pre></div>
</div>
<p class="last">Above, the phrase <tt class="docutils literal"><span class="pre">WHERE</span> <span class="pre">user_account.name</span> <span class="pre">=</span> <span class="pre">'fred'</span> <span class="pre">AND</span> <span class="pre">user_account.status</span> <span class="pre">=</span> <span class="pre">'E'</span></tt>
comprises the WHERE clause of the <tt class="docutils literal"><span class="pre">SELECT</span></tt>.</p>
</dd>
</dl>
</div>

    </div>

</div>

<div id="docs-bottom-navigation" class="docs-navigation-links">

    <div id="docs-copyright">
        &copy; <a href="copyright.html">Copyright</a> 2007-2013, the SQLAlchemy authors and contributors.
        Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2.1.
    </div>
</div>

</div>

        
    </body>
</html>