glossary.html 98 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>
  7. Glossary
  8. &mdash;
  9. SQLAlchemy 1.3 Documentation
  10. </title>
  11. <!-- begin iterate through site-imported + sphinx environment css_files -->
  12. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  13. <link rel="stylesheet" href="_static/docs.css" type="text/css" />
  14. <link rel="stylesheet" href="_static/changelog.css" type="text/css" />
  15. <link rel="stylesheet" href="_static/sphinx_paramlinks.css" type="text/css" />
  16. <!-- end iterate through site-imported + sphinx environment css_files -->
  17. <!-- begin layout.mako headers -->
  18. <link rel="index" title="Index" href="genindex.html" />
  19. <link rel="search" title="Search" href="search.html" />
  20. <link rel="copyright" title="Copyright" href="copyright.html" />
  21. <link rel="top" title="SQLAlchemy 1.3 Documentation" href="index.html" />
  22. <!-- end layout.mako headers -->
  23. </head>
  24. <body>
  25. <div id="docs-container">
  26. <div id="docs-top-navigation-container" class="body-background">
  27. <div id="docs-header">
  28. <div id="docs-version-header">
  29. Release: <span class="version-num">1.3.16</span>
  30. | Release Date: April 7, 2020
  31. </div>
  32. <h1>SQLAlchemy 1.3 Documentation</h1>
  33. </div>
  34. </div>
  35. <div id="docs-body-container">
  36. <div id="fixed-sidebar" class="withsidebar">
  37. <div id="docs-sidebar-popout">
  38. <h3><a href="index.html">SQLAlchemy 1.3 Documentation</a></h3>
  39. <p id="sidebar-topnav">
  40. <a href="contents.html">Contents</a> |
  41. <a href="genindex.html">Index</a>
  42. </p>
  43. <div id="sidebar-search">
  44. <form class="search" action="search.html" method="get">
  45. <label>
  46. Search terms:
  47. <input type="text" placeholder="search..." name="q" size="12" />
  48. </label>
  49. <input type="hidden" name="check_keywords" value="yes" />
  50. <input type="hidden" name="area" value="default" />
  51. </form>
  52. </div>
  53. </div>
  54. <div id="docs-sidebar">
  55. <div id="sidebar-banner">
  56. </div>
  57. <div id="docs-sidebar-inner">
  58. <h3>
  59. <a href="index.html" title="SQLAlchemy 1.3 Documentation">SQLAlchemy 1.3 Documentation</a>
  60. </h3>
  61. <ul>
  62. <li><span class="link-container"><a class="reference external" href="intro.html">Overview</a></span></li>
  63. <li><span class="link-container"><a class="reference external" href="orm/index.html">SQLAlchemy ORM</a></span></li>
  64. <li><span class="link-container"><a class="reference external" href="core/index.html">SQLAlchemy Core</a></span></li>
  65. <li><span class="link-container"><a class="reference external" href="dialects/index.html">Dialects</a></span></li>
  66. <li><span class="link-container"><a class="reference external" href="faq/index.html">Frequently Asked Questions</a></span></li>
  67. <li><span class="link-container"><a class="reference external" href="errors.html">Error Messages</a></span></li>
  68. <li><span class="link-container"><a class="reference external" href="changelog/index.html">Changes and Migration</a></span></li>
  69. </ul>
  70. </div>
  71. </div>
  72. </div>
  73. <div id="docs-body" class="withsidebar" >
  74. <div class="section" id="glossary">
  75. <span id="id1"></span><h1>Glossary<a class="headerlink" href="#glossary" title="Permalink to this headline">¶</a></h1>
  76. <dl class="glossary">
  77. <dt id="term-ACID">ACID</dt><dt id="term-ACID-model">ACID model</dt><dd><p>An acronym for “Atomicity, Consistency, Isolation,
  78. Durability”; a set of properties that guarantee that
  79. database transactions are processed reliably.
  80. (via Wikipedia)</p>
  81. <div class="admonition seealso">
  82. <p class="admonition-title">See also</p>
  83. <p><a class="reference internal" href="#term-atomicity"><span class="xref std std-term">atomicity</span></a></p>
  84. <p><a class="reference internal" href="#term-consistency"><span class="xref std std-term">consistency</span></a></p>
  85. <p><a class="reference internal" href="#term-isolation"><span class="xref std std-term">isolation</span></a></p>
  86. <p><a class="reference internal" href="#term-durability"><span class="xref std std-term">durability</span></a></p>
  87. <p><a class="reference external" href="http://en.wikipedia.org/wiki/ACID_Model">http://en.wikipedia.org/wiki/ACID_Model</a></p>
  88. </div>
  89. </dd>
  90. <dt id="term-annotations">annotations</dt><dd><p>Annotations are a concept used internally by SQLAlchemy in order to store
  91. additional information along with <a class="reference internal" href="core/sqlelement.html#sqlalchemy.sql.expression.ClauseElement" title="sqlalchemy.sql.expression.ClauseElement"><code class="xref py py-class docutils literal notranslate"><span class="pre">ClauseElement</span></code></a> objects. A Python
  92. dictionary is associated with a copy of the object, which contains key/value
  93. pairs significant to various internal systems, mostly within the ORM:</p>
  94. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">some_column</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="s1">&#39;some_column&#39;</span><span class="p">,</span> <span class="n">Integer</span><span class="p">)</span>
  95. <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="s2">&quot;entity&quot;</span><span class="p">:</span> <span class="n">User</span><span class="p">})</span></pre></div>
  96. </div>
  97. <p>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"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Column.info</span></code></a>
  98. 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"><code class="xref py py-class docutils literal notranslate"><span class="pre">Column</span></code></a>,
  99. rather than considering all annotation values to be part of a single
  100. unit. The ORM creates copies of expression objects in order to
  101. apply annotations that are specific to their context, such as to differentiate
  102. columns that should render themselves as relative to a joined-inheritance
  103. entity versus those which should render relative to their immediate parent
  104. table alone, as well as to differentiate columns within the “join condition”
  105. of a relationship where the column in some cases needs to be expressed
  106. in terms of one particular table alias or another, based on its position
  107. within the join expression.</p>
  108. </dd>
  109. <dt id="term-association-relationship">association relationship</dt><dd><p>A two-tiered <a class="reference internal" href="#term-relationship"><span class="xref std std-term">relationship</span></a> which links two tables
  110. together using an association table in the middle. The
  111. association relationship differs from a <a class="reference internal" href="#term-many-to-many"><span class="xref std std-term">many to many</span></a>
  112. relationship in that the many-to-many table is mapped
  113. by a full class, rather than invisibly handled by the
  114. <a class="reference internal" href="orm/relationship_api.html#sqlalchemy.orm.relationship" title="sqlalchemy.orm.relationship"><code class="xref py py-func docutils literal notranslate"><span class="pre">sqlalchemy.orm.relationship()</span></code></a> construct as in the case
  115. with many-to-many, so that additional attributes are
  116. explicitly available.</p>
  117. <p>For example, if we wanted to associate employees with
  118. projects, also storing the specific role for that employee
  119. with the project, the relational schema might look like:</p>
  120. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">employee</span> <span class="p">(</span>
  121. <span class="n">id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  122. <span class="n">name</span> <span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
  123. <span class="p">)</span>
  124. <span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">project</span> <span class="p">(</span>
  125. <span class="n">id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  126. <span class="n">name</span> <span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
  127. <span class="p">)</span>
  128. <span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">employee_project</span> <span class="p">(</span>
  129. <span class="n">employee_id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  130. <span class="n">project_id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  131. <span class="n">role_name</span> <span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">30</span><span class="p">),</span>
  132. <span class="k">FOREIGN</span> <span class="k">KEY</span> <span class="n">employee_id</span> <span class="k">REFERENCES</span> <span class="n">employee</span><span class="p">(</span><span class="n">id</span><span class="p">),</span>
  133. <span class="k">FOREIGN</span> <span class="k">KEY</span> <span class="n">project_id</span> <span class="k">REFERENCES</span> <span class="n">project</span><span class="p">(</span><span class="n">id</span><span class="p">)</span>
  134. <span class="p">)</span></pre></div>
  135. </div>
  136. <p>A SQLAlchemy declarative mapping for the above might look like:</p>
  137. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">Employee</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  138. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;employee&#39;</span>
  139. <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="p">)</span>
  140. <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">30</span><span class="p">))</span>
  141. <span class="k">class</span> <span class="nc">Project</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  142. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;project&#39;</span>
  143. <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="p">)</span>
  144. <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">30</span><span class="p">))</span>
  145. <span class="k">class</span> <span class="nc">EmployeeProject</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  146. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;employee_project&#39;</span>
  147. <span class="n">employee_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">ForeignKey</span><span class="p">(</span><span class="s1">&#39;employee.id&#39;</span><span class="p">),</span> <span class="n">primary_key</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
  148. <span class="n">project_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">ForeignKey</span><span class="p">(</span><span class="s1">&#39;project.id&#39;</span><span class="p">),</span> <span class="n">primary_key</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
  149. <span class="n">role_name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">30</span><span class="p">))</span>
  150. <span class="n">project</span> <span class="o">=</span> <span class="n">relationship</span><span class="p">(</span><span class="s2">&quot;Project&quot;</span><span class="p">,</span> <span class="n">backref</span><span class="o">=</span><span class="s2">&quot;project_employees&quot;</span><span class="p">)</span>
  151. <span class="n">employee</span> <span class="o">=</span> <span class="n">relationship</span><span class="p">(</span><span class="s2">&quot;Employee&quot;</span><span class="p">,</span> <span class="n">backref</span><span class="o">=</span><span class="s2">&quot;employee_projects&quot;</span><span class="p">)</span></pre></div>
  152. </div>
  153. <p>Employees can be added to a project given a role name:</p>
  154. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">proj</span> <span class="o">=</span> <span class="n">Project</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;Client A&quot;</span><span class="p">)</span>
  155. <span class="n">emp1</span> <span class="o">=</span> <span class="n">Employee</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;emp1&quot;</span><span class="p">)</span>
  156. <span class="n">emp2</span> <span class="o">=</span> <span class="n">Employee</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;emp2&quot;</span><span class="p">)</span>
  157. <span class="n">proj</span><span class="o">.</span><span class="n">project_employees</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span>
  158. <span class="n">EmployeeProject</span><span class="p">(</span><span class="n">employee</span><span class="o">=</span><span class="n">emp1</span><span class="p">,</span> <span class="n">role</span><span class="o">=</span><span class="s2">&quot;tech lead&quot;</span><span class="p">),</span>
  159. <span class="n">EmployeeProject</span><span class="p">(</span><span class="n">employee</span><span class="o">=</span><span class="n">emp2</span><span class="p">,</span> <span class="n">role</span><span class="o">=</span><span class="s2">&quot;account executive&quot;</span><span class="p">)</span>
  160. <span class="p">])</span></pre></div>
  161. </div>
  162. <div class="admonition seealso">
  163. <p class="admonition-title">See also</p>
  164. <p><a class="reference internal" href="#term-many-to-many"><span class="xref std std-term">many to many</span></a></p>
  165. </div>
  166. </dd>
  167. <dt id="term-atomicity">atomicity</dt><dd><p>Atomicity is one of the components of the <a class="reference internal" href="#term-ACID"><span class="xref std std-term">ACID</span></a> model,
  168. and requires that each transaction is “all or nothing”:
  169. if one part of the transaction fails, the entire transaction
  170. fails, and the database state is left unchanged. An atomic
  171. system must guarantee atomicity in each and every situation,
  172. including power failures, errors, and crashes.
  173. (via Wikipedia)</p>
  174. <div class="admonition seealso">
  175. <p class="admonition-title">See also</p>
  176. <p><a class="reference internal" href="#term-ACID"><span class="xref std std-term">ACID</span></a></p>
  177. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Atomicity_(database_systems">http://en.wikipedia.org/wiki/Atomicity_(database_systems</a>)</p>
  178. </div>
  179. </dd>
  180. <dt id="term-backref">backref</dt><dt id="term-bidirectional-relationship">bidirectional relationship</dt><dd><p>An extension to the <a class="reference internal" href="#term-relationship"><span class="xref std std-term">relationship</span></a> system whereby two
  181. distinct <a class="reference internal" href="orm/relationship_api.html#sqlalchemy.orm.relationship" title="sqlalchemy.orm.relationship"><code class="xref py py-func docutils literal notranslate"><span class="pre">relationship()</span></code></a> objects can be
  182. mutually associated with each other, such that they coordinate
  183. in memory as changes occur to either side. The most common
  184. way these two relationships are constructed is by using
  185. the <a class="reference internal" href="orm/relationship_api.html#sqlalchemy.orm.relationship" title="sqlalchemy.orm.relationship"><code class="xref py py-func docutils literal notranslate"><span class="pre">relationship()</span></code></a> function explicitly
  186. for one side and specifying the <code class="docutils literal notranslate"><span class="pre">backref</span></code> keyword to it so that
  187. the other <a class="reference internal" href="orm/relationship_api.html#sqlalchemy.orm.relationship" title="sqlalchemy.orm.relationship"><code class="xref py py-func docutils literal notranslate"><span class="pre">relationship()</span></code></a> is created
  188. automatically. We can illustrate this against the example we’ve
  189. used in <a class="reference internal" href="#term-one-to-many"><span class="xref std std-term">one to many</span></a> as follows:</p>
  190. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">Department</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  191. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;department&#39;</span>
  192. <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="kc">True</span><span class="p">)</span>
  193. <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">30</span><span class="p">))</span>
  194. <span class="n">employees</span> <span class="o">=</span> <span class="n">relationship</span><span class="p">(</span><span class="s2">&quot;Employee&quot;</span><span class="p">,</span> <span class="n">backref</span><span class="o">=</span><span class="s2">&quot;department&quot;</span><span class="p">)</span>
  195. <span class="k">class</span> <span class="nc">Employee</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  196. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;employee&#39;</span>
  197. <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="kc">True</span><span class="p">)</span>
  198. <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">30</span><span class="p">))</span>
  199. <span class="n">dep_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">ForeignKey</span><span class="p">(</span><span class="s1">&#39;department.id&#39;</span><span class="p">))</span></pre></div>
  200. </div>
  201. <p>A backref can be applied to any relationship, including one to many,
  202. many to one, and <a class="reference internal" href="#term-many-to-many"><span class="xref std std-term">many to many</span></a>.</p>
  203. <div class="admonition seealso">
  204. <p class="admonition-title">See also</p>
  205. <p><a class="reference internal" href="#term-relationship"><span class="xref std std-term">relationship</span></a></p>
  206. <p><a class="reference internal" href="#term-one-to-many"><span class="xref std std-term">one to many</span></a></p>
  207. <p><a class="reference internal" href="#term-many-to-one"><span class="xref std std-term">many to one</span></a></p>
  208. <p><a class="reference internal" href="#term-many-to-many"><span class="xref std std-term">many to many</span></a></p>
  209. </div>
  210. </dd>
  211. <dt id="term-candidate-key">candidate key</dt><dd><p>A <span class="xref std std-term">relational algebra</span> term referring to an attribute or set
  212. of attributes that form a uniquely identifying key for a
  213. row. A row may have more than one candidate key, each of which
  214. is suitable for use as the primary key of that row.
  215. The primary key of a table is always a candidate key.</p>
  216. <div class="admonition seealso">
  217. <p class="admonition-title">See also</p>
  218. <p><a class="reference internal" href="#term-primary-key"><span class="xref std std-term">primary key</span></a></p>
  219. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Candidate_key">http://en.wikipedia.org/wiki/Candidate_key</a></p>
  220. <p><a class="reference external" href="https://www.databasestar.com/database-keys/">https://www.databasestar.com/database-keys/</a></p>
  221. </div>
  222. </dd>
  223. <dt id="term-check-constraint">check constraint</dt><dd><p>A check constraint is a
  224. condition that defines valid data when adding or updating an
  225. entry in a table of a relational database. A check constraint
  226. is applied to each row in the table.</p>
  227. <p>(via Wikipedia)</p>
  228. <p>A check constraint can be added to a table in standard
  229. SQL using <a class="reference internal" href="#term-DDL"><span class="xref std std-term">DDL</span></a> like the following:</p>
  230. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="k">ALTER</span> <span class="k">TABLE</span> <span class="n">distributors</span> <span class="k">ADD</span> <span class="k">CONSTRAINT</span> <span class="n">zipchk</span> <span class="k">CHECK</span> <span class="p">(</span><span class="k">char_length</span><span class="p">(</span><span class="n">zipcode</span><span class="p">)</span> <span class="o">=</span> <span class="mi">5</span><span class="p">);</span></pre></div>
  231. </div>
  232. <div class="admonition seealso">
  233. <p class="admonition-title">See also</p>
  234. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Check_constraint">http://en.wikipedia.org/wiki/Check_constraint</a></p>
  235. </div>
  236. </dd>
  237. <dt id="term-columns-clause">columns clause</dt><dd><p>The portion of the <code class="docutils literal notranslate"><span class="pre">SELECT</span></code> statement which enumerates the
  238. SQL expressions to be returned in the result set. The expressions
  239. follow the <code class="docutils literal notranslate"><span class="pre">SELECT</span></code> keyword directly and are a comma-separated
  240. list of individual expressions.</p>
  241. <p>E.g.:</p>
  242. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><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>
  243. <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>
  244. </div>
  245. <p>Above, the list of columns <code class="docutils literal notranslate"><span class="pre">user_acount.name</span></code>,
  246. <code class="docutils literal notranslate"><span class="pre">user_account.email</span></code> is the columns clause of the <code class="docutils literal notranslate"><span class="pre">SELECT</span></code>.</p>
  247. </dd>
  248. <dt id="term-consistency">consistency</dt><dd><p>Consistency is one of the components of the <a class="reference internal" href="#term-ACID"><span class="xref std std-term">ACID</span></a> model,
  249. and ensures that any transaction will
  250. bring the database from one valid state to another. Any data
  251. written to the database must be valid according to all defined
  252. rules, including but not limited to <a class="reference internal" href="#term-constraints"><span class="xref std std-term">constraints</span></a>, cascades,
  253. triggers, and any combination thereof.
  254. (via Wikipedia)</p>
  255. <div class="admonition seealso">
  256. <p class="admonition-title">See also</p>
  257. <p><a class="reference internal" href="#term-ACID"><span class="xref std std-term">ACID</span></a></p>
  258. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Consistency_(database_systems">http://en.wikipedia.org/wiki/Consistency_(database_systems</a>)</p>
  259. </div>
  260. </dd>
  261. <dt id="term-constraint">constraint</dt><dt id="term-constraints">constraints</dt><dt id="term-constrained">constrained</dt><dd><p>Rules established within a relational database that ensure
  262. the validity and consistency of data. Common forms
  263. of constraint include <a class="reference internal" href="#term-primary-key-constraint"><span class="xref std std-term">primary key constraint</span></a>,
  264. <a class="reference internal" href="#term-foreign-key-constraint"><span class="xref std std-term">foreign key constraint</span></a>, and <a class="reference internal" href="#term-check-constraint"><span class="xref std std-term">check constraint</span></a>.</p>
  265. </dd>
  266. <dt id="term-correlates">correlates</dt><dt id="term-correlated-subquery">correlated subquery</dt><dt id="term-correlated-subqueries">correlated subqueries</dt><dd><p>A <a class="reference internal" href="#term-subquery"><span class="xref std std-term">subquery</span></a> is correlated if it depends on data in the
  267. enclosing <code class="docutils literal notranslate"><span class="pre">SELECT</span></code>.</p>
  268. <p>Below, a subquery selects the aggregate value <code class="docutils literal notranslate"><span class="pre">MIN(a.id)</span></code>
  269. from the <code class="docutils literal notranslate"><span class="pre">email_address</span></code> table, such that
  270. it will be invoked for each value of <code class="docutils literal notranslate"><span class="pre">user_account.id</span></code>, correlating
  271. the value of this column against the <code class="docutils literal notranslate"><span class="pre">email_address.user_account_id</span></code>
  272. column:</p>
  273. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><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>
  274. <span class="k">FROM</span> <span class="n">user_account</span>
  275. <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>
  276. <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>
  277. <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>
  278. <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>
  279. <span class="p">)</span></pre></div>
  280. </div>
  281. <p>The above subquery refers to the <code class="docutils literal notranslate"><span class="pre">user_account</span></code> table, which is not itself
  282. in the <code class="docutils literal notranslate"><span class="pre">FROM</span></code> clause of this nested query. Instead, the <code class="docutils literal notranslate"><span class="pre">user_account</span></code>
  283. table is received from the enclosing query, where each row selected from
  284. <code class="docutils literal notranslate"><span class="pre">user_account</span></code> results in a distinct execution of the subquery.</p>
  285. <p>A correlated subquery is in most cases present in the <a class="reference internal" href="#term-WHERE-clause"><span class="xref std std-term">WHERE clause</span></a>
  286. or <a class="reference internal" href="#term-columns-clause"><span class="xref std std-term">columns clause</span></a> of the immediately enclosing <code class="docutils literal notranslate"><span class="pre">SELECT</span></code>
  287. statement, as well as in the ORDER BY or HAVING clause.</p>
  288. <p>In less common cases, a correlated subquery may be present in the
  289. <a class="reference internal" href="#term-FROM-clause"><span class="xref std std-term">FROM clause</span></a> of an enclosing <code class="docutils literal notranslate"><span class="pre">SELECT</span></code>; in these cases the
  290. correlation is typically due to the enclosing <code class="docutils literal notranslate"><span class="pre">SELECT</span></code> itself being
  291. enclosed in the WHERE,
  292. ORDER BY, columns or HAVING clause of another <code class="docutils literal notranslate"><span class="pre">SELECT</span></code>, such as:</p>
  293. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><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>
  294. <span class="k">WHERE</span> <span class="k">EXISTS</span> <span class="p">(</span>
  295. <span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="p">(</span>
  296. <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>
  297. <span class="k">FROM</span> <span class="n">child</span>
  298. <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>
  299. <span class="k">LIMIT</span> <span class="mi">3</span><span class="p">)</span>
  300. <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>
  301. </div>
  302. <p>Correlation from one <code class="docutils literal notranslate"><span class="pre">SELECT</span></code> directly to one which encloses the correlated
  303. query via its <code class="docutils literal notranslate"><span class="pre">FROM</span></code>
  304. clause is not possible, because the correlation can only proceed once the
  305. original source rows from the enclosing statement’s FROM clause are available.</p>
  306. </dd>
  307. <dt id="term-crud">crud</dt><dd><p>An acronym meaning “Create, Update, Delete”. The term in SQL refers to the
  308. set of operations that create, modify and delete data from the database,
  309. also known as <a class="reference internal" href="#term-DML"><span class="xref std std-term">DML</span></a>, and typically refers to the <code class="docutils literal notranslate"><span class="pre">INSERT</span></code>,
  310. <code class="docutils literal notranslate"><span class="pre">UPDATE</span></code>, and <code class="docutils literal notranslate"><span class="pre">DELETE</span></code> statements.</p>
  311. </dd>
  312. <dt id="term-DBAPI">DBAPI</dt><dd><p>DBAPI is shorthand for the phrase “Python Database API
  313. Specification”. This is a widely used specification
  314. within Python to define common usage patterns for all
  315. database connection packages. The DBAPI is a “low level”
  316. API which is typically the lowest level system used
  317. in a Python application to talk to a database. SQLAlchemy’s
  318. <span class="xref std std-term">dialect</span> system is constructed around the
  319. operation of the DBAPI, providing individual dialect
  320. classes which service a specific DBAPI on top of a
  321. specific database engine; for example, the <a class="reference internal" href="core/engines.html#sqlalchemy.create_engine" title="sqlalchemy.create_engine"><code class="xref py py-func docutils literal notranslate"><span class="pre">create_engine()</span></code></a>
  322. URL <code class="docutils literal notranslate"><span class="pre">postgresql+psycopg2://&#64;localhost/test</span></code>
  323. refers to the <a class="reference internal" href="dialects/postgresql.html#module-sqlalchemy.dialects.postgresql.psycopg2" title="sqlalchemy.dialects.postgresql.psycopg2"><code class="xref py py-mod docutils literal notranslate"><span class="pre">psycopg2</span></code></a>
  324. DBAPI/dialect combination, whereas the URL <code class="docutils literal notranslate"><span class="pre">mysql+mysqldb://&#64;localhost/test</span></code>
  325. refers to the <a class="reference internal" href="dialects/mysql.html#module-sqlalchemy.dialects.mysql.mysqldb" title="sqlalchemy.dialects.mysql.mysqldb"><code class="xref py py-mod docutils literal notranslate"><span class="pre">MySQL</span> <span class="pre">for</span> <span class="pre">Python</span></code></a>
  326. DBAPI DBAPI/dialect combination.</p>
  327. <div class="admonition seealso">
  328. <p class="admonition-title">See also</p>
  329. <p><a class="reference external" href="http://www.python.org/dev/peps/pep-0249/">PEP 249 - Python Database API Specification v2.0</a></p>
  330. </div>
  331. </dd>
  332. <dt id="term-DDL">DDL</dt><dd><p>An acronym for <strong>Data Definition Language</strong>. DDL is the subset
  333. of SQL that relational databases use to configure tables, constraints,
  334. and other permanent objects within a database schema. SQLAlchemy
  335. provides a rich API for constructing and emitting DDL expressions.</p>
  336. <div class="admonition seealso">
  337. <p class="admonition-title">See also</p>
  338. <p><a class="reference internal" href="core/metadata.html"><span class="std std-ref">Describing Databases with MetaData</span></a></p>
  339. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Data_definition_language">DDL (via Wikipedia)</a></p>
  340. <p><a class="reference internal" href="#term-DML"><span class="xref std std-term">DML</span></a></p>
  341. </div>
  342. </dd>
  343. <dt id="term-deleted">deleted</dt><dd><p>This describes one of the major object states which
  344. an object can have within a <a class="reference internal" href="#term-Session"><span class="xref std std-term">session</span></a>; a deleted object
  345. is an object that was formerly persistent and has had a
  346. DELETE statement emitted to the database within a flush
  347. to delete its row. The object will move to the <a class="reference internal" href="#term-detached"><span class="xref std std-term">detached</span></a>
  348. state once the session’s transaction is committed; alternatively,
  349. if the session’s transaction is rolled back, the DELETE is
  350. reverted and the object moves back to the <a class="reference internal" href="#term-persistent"><span class="xref std std-term">persistent</span></a>
  351. state.</p>
  352. <div class="admonition seealso">
  353. <p class="admonition-title">See also</p>
  354. <p><a class="reference internal" href="orm/session_state_management.html#session-object-states"><span class="std std-ref">Quickie Intro to Object States</span></a></p>
  355. </div>
  356. </dd>
  357. <dt id="term-descriptor">descriptor</dt><dt id="term-descriptors">descriptors</dt><dd><p>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>.
  358. Those methods are __get__(), __set__(), and __delete__(). If any of those methods are defined
  359. for an object, it is said to be a descriptor.</p>
  360. <p>In SQLAlchemy, descriptors are used heavily in order to provide attribute behavior
  361. on mapped classes. When a class is mapped as such:</p>
  362. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">MyClass</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  363. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;foo&#39;</span>
  364. <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="kc">True</span><span class="p">)</span>
  365. <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>
  366. </div>
  367. <p>The <code class="docutils literal notranslate"><span class="pre">MyClass</span></code> class will be <a class="reference internal" href="#term-mapped"><span class="xref std std-term">mapped</span></a> when its definition
  368. is complete, at which point the <code class="docutils literal notranslate"><span class="pre">id</span></code> and <code class="docutils literal notranslate"><span class="pre">data</span></code> attributes,
  369. starting out as <a class="reference internal" href="core/metadata.html#sqlalchemy.schema.Column" title="sqlalchemy.schema.Column"><code class="xref py py-class docutils literal notranslate"><span class="pre">Column</span></code></a> objects, will be replaced
  370. by the <a class="reference internal" href="#term-instrumentation"><span class="xref std std-term">instrumentation</span></a> system with instances
  371. of <a class="reference internal" href="orm/internals.html#sqlalchemy.orm.attributes.InstrumentedAttribute" title="sqlalchemy.orm.attributes.InstrumentedAttribute"><code class="xref py py-class docutils literal notranslate"><span class="pre">InstrumentedAttribute</span></code></a>, which are descriptors that
  372. provide the above mentioned <code class="docutils literal notranslate"><span class="pre">__get__()</span></code>, <code class="docutils literal notranslate"><span class="pre">__set__()</span></code> and
  373. <code class="docutils literal notranslate"><span class="pre">__delete__()</span></code> methods. The <a class="reference internal" href="orm/internals.html#sqlalchemy.orm.attributes.InstrumentedAttribute" title="sqlalchemy.orm.attributes.InstrumentedAttribute"><code class="xref py py-class docutils literal notranslate"><span class="pre">InstrumentedAttribute</span></code></a>
  374. will generate a SQL expression when used at the class level:</p>
  375. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</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="p">)</span>
  376. <span class="go">data = :data_1</span></pre></div>
  377. </div>
  378. <p>and at the instance level, keeps track of changes to values,
  379. and also <a class="reference internal" href="#term-lazy-loads"><span class="xref std std-term">lazy loads</span></a> unloaded attributes
  380. from the database:</p>
  381. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><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>
  382. <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>
  383. <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="s2">&quot;some data&quot;</span>
  384. <span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="k">import</span> <span class="n">inspect</span>
  385. <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>
  386. <span class="go">&quot;some data&quot;</span></pre></div>
  387. </div>
  388. </dd>
  389. <dt id="term-detached">detached</dt><dd><p>This describes one of the major object states which
  390. an object can have within a <a class="reference internal" href="#term-Session"><span class="xref std std-term">session</span></a>; a detached object
  391. is an object that has a database identity (i.e. a primary key)
  392. but is not associated with any session. An object that
  393. was previously <a class="reference internal" href="#term-persistent"><span class="xref std std-term">persistent</span></a> and was removed from its
  394. session either because it was expunged, or the owning
  395. session was closed, moves into the detached state.
  396. The detached state is generally used when objects are being
  397. moved between sessions or when being moved to/from an external
  398. object cache.</p>
  399. <div class="admonition seealso">
  400. <p class="admonition-title">See also</p>
  401. <p><a class="reference internal" href="orm/session_state_management.html#session-object-states"><span class="std std-ref">Quickie Intro to Object States</span></a></p>
  402. </div>
  403. </dd>
  404. <dt id="term-discriminator">discriminator</dt><dd><p>A result-set column which is used during <a class="reference internal" href="#term-polymorphic"><span class="xref std std-term">polymorphic</span></a> loading
  405. to determine what kind of mapped class should be applied to a particular
  406. incoming result row. In SQLAlchemy, the classes are always part
  407. of a hierarchy mapping using inheritance mapping.</p>
  408. <div class="admonition seealso">
  409. <p class="admonition-title">See also</p>
  410. <p><a class="reference internal" href="orm/inheritance.html"><span class="std std-ref">Mapping Class Inheritance Hierarchies</span></a></p>
  411. </div>
  412. </dd>
  413. <dt id="term-DML">DML</dt><dd><p>An acronym for <strong>Data Manipulation Language</strong>. DML is the subset of
  414. SQL that relational databases use to <em>modify</em> the data in tables. DML
  415. typically refers to the three widely familiar statements of INSERT,
  416. UPDATE and DELETE, otherwise known as <a class="reference internal" href="#term-crud"><span class="xref std std-term">CRUD</span></a> (acronoym for “CReate,
  417. Update, Delete”).</p>
  418. <blockquote>
  419. <div><div class="admonition seealso">
  420. <p class="admonition-title">See also</p>
  421. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Data_manipulation_language">DML (via Wikipedia)</a></p>
  422. <p><a class="reference internal" href="#term-DDL"><span class="xref std std-term">DDL</span></a></p>
  423. </div>
  424. </div></blockquote>
  425. </dd>
  426. <dt id="term-domain-model">domain model</dt><dd><p>A domain model in problem solving and software engineering is a conceptual model of all the topics related to a specific problem. It describes the various entities, their attributes, roles, and relationships, plus the constraints that govern the problem domain.</p>
  427. <p>(via Wikipedia)</p>
  428. <div class="admonition seealso">
  429. <p class="admonition-title">See also</p>
  430. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Domain_model">Domain Model (wikipedia)</a></p>
  431. </div>
  432. </dd>
  433. <dt id="term-durability">durability</dt><dd><p>Durability is a property of the <a class="reference internal" href="#term-ACID"><span class="xref std std-term">ACID</span></a> model
  434. which means that once a transaction has been committed,
  435. it will remain so, even in the event of power loss, crashes,
  436. or errors. In a relational database, for instance, once a
  437. group of SQL statements execute, the results need to be stored
  438. permanently (even if the database crashes immediately
  439. thereafter).
  440. (via Wikipedia)</p>
  441. <div class="admonition seealso">
  442. <p class="admonition-title">See also</p>
  443. <p><a class="reference internal" href="#term-ACID"><span class="xref std std-term">ACID</span></a></p>
  444. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Durability_(database_systems">http://en.wikipedia.org/wiki/Durability_(database_systems</a>)</p>
  445. </div>
  446. </dd>
  447. <dt id="term-expire">expire</dt><dt id="term-expires">expires</dt><dt id="term-expiring">expiring</dt><dd><p>In the SQLAlchemy ORM, refers to when the data in a <a class="reference internal" href="#term-persistent"><span class="xref std std-term">persistent</span></a>
  448. or sometimes <a class="reference internal" href="#term-detached"><span class="xref std std-term">detached</span></a> object is erased, such that when
  449. the object’s attributes are next accessed, a <a class="reference internal" href="#term-lazy-load"><span class="xref std std-term">lazy load</span></a> SQL
  450. query will be emitted in order to refresh the data for this object
  451. as stored in the current ongoing transaction.</p>
  452. <div class="admonition seealso">
  453. <p class="admonition-title">See also</p>
  454. <p><a class="reference internal" href="orm/session_state_management.html#session-expire"><span class="std std-ref">Refreshing / Expiring</span></a></p>
  455. </div>
  456. </dd>
  457. <dt id="term-foreign-key-constraint">foreign key constraint</dt><dd><p>A referential constraint between two tables. A foreign key is a field or set of fields in a
  458. relational table that matches a <a class="reference internal" href="#term-candidate-key"><span class="xref std std-term">candidate key</span></a> of another table.
  459. The foreign key can be used to cross-reference tables.
  460. (via Wikipedia)</p>
  461. <p>A foreign key constraint can be added to a table in standard
  462. SQL using <a class="reference internal" href="#term-DDL"><span class="xref std std-term">DDL</span></a> like the following:</p>
  463. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="k">ALTER</span> <span class="k">TABLE</span> <span class="n">employee</span> <span class="k">ADD</span> <span class="k">CONSTRAINT</span> <span class="n">dep_id_fk</span>
  464. <span class="k">FOREIGN</span> <span class="k">KEY</span> <span class="p">(</span><span class="n">employee</span><span class="p">)</span> <span class="k">REFERENCES</span> <span class="n">department</span> <span class="p">(</span><span class="n">dep_id</span><span class="p">)</span></pre></div>
  465. </div>
  466. <div class="admonition seealso">
  467. <p class="admonition-title">See also</p>
  468. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Foreign_key_constraint">http://en.wikipedia.org/wiki/Foreign_key_constraint</a></p>
  469. </div>
  470. </dd>
  471. <dt id="term-FROM-clause">FROM clause</dt><dd><p>The portion of the <code class="docutils literal notranslate"><span class="pre">SELECT</span></code> statement which indicates the initial
  472. source of rows.</p>
  473. <p>A simple <code class="docutils literal notranslate"><span class="pre">SELECT</span></code> will feature one or more table names in its
  474. FROM clause. Multiple sources are separated by a comma:</p>
  475. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><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>
  476. <span class="k">FROM</span> <span class="k">user</span><span class="p">,</span> <span class="n">address</span>
  477. <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>
  478. </div>
  479. <p>The FROM clause is also where explicit joins are specified. We can
  480. rewrite the above <code class="docutils literal notranslate"><span class="pre">SELECT</span></code> using a single <code class="docutils literal notranslate"><span class="pre">FROM</span></code> element which consists
  481. of a <code class="docutils literal notranslate"><span class="pre">JOIN</span></code> of the two tables:</p>
  482. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><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>
  483. <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>
  484. </div>
  485. </dd>
  486. <dt id="term-generative">generative</dt><dd><p>A term that SQLAlchemy uses to refer what’s normally known
  487. as <a class="reference internal" href="#term-method-chaining"><span class="xref std std-term">method chaining</span></a>; see that term for details.</p>
  488. </dd>
  489. <dt id="term-identity-map">identity map</dt><dd><p>A mapping between Python objects and their database identities.
  490. The identity map is a collection that’s associated with an
  491. ORM <a class="reference internal" href="#term-Session"><span class="xref std std-term">session</span></a> object, and maintains a single instance
  492. of every database object keyed to its identity. The advantage
  493. to this pattern is that all operations which occur for a particular
  494. database identity are transparently coordinated onto a single
  495. object instance. When using an identity map in conjunction with
  496. an <a class="reference internal" href="#term-isolated"><span class="xref std std-term">isolated</span></a> transaction, having a reference
  497. to an object that’s known to have a particular primary key can
  498. be considered from a practical standpoint to be a
  499. proxy to the actual database row.</p>
  500. <div class="admonition seealso">
  501. <p class="admonition-title">See also</p>
  502. <p>Martin Fowler - Identity Map - <a class="reference external" href="http://martinfowler.com/eaaCatalog/identityMap.html">http://martinfowler.com/eaaCatalog/identityMap.html</a></p>
  503. </div>
  504. </dd>
  505. <dt id="term-instrumentation">instrumentation</dt><dt id="term-instrumented">instrumented</dt><dt id="term-instrumenting">instrumenting</dt><dd><p>Instrumentation refers to the process of augmenting the functionality
  506. and attribute set of a particular class. Ideally, the
  507. behavior of the class should remain close to a regular
  508. class, except that additional behaviors and features are
  509. made available. The SQLAlchemy <a class="reference internal" href="#term-mapping"><span class="xref std std-term">mapping</span></a> process,
  510. among other things, adds database-enabled <a class="reference internal" href="#term-descriptors"><span class="xref std std-term">descriptors</span></a>
  511. to a mapped
  512. class each of which represents a particular database column
  513. or relationship to a related class.</p>
  514. </dd>
  515. <dt id="term-isolation">isolation</dt><dt id="term-isolated">isolated</dt><dd><p>The isolation property of the <a class="reference internal" href="#term-ACID"><span class="xref std std-term">ACID</span></a> model
  516. ensures that the concurrent execution
  517. of transactions results in a system state that would be
  518. obtained if transactions were executed serially, i.e. one
  519. after the other. Each transaction must execute in total
  520. isolation i.e. if T1 and T2 execute concurrently then each
  521. should remain independent of the other.
  522. (via Wikipedia)</p>
  523. <div class="admonition seealso">
  524. <p class="admonition-title">See also</p>
  525. <p><a class="reference internal" href="#term-ACID"><span class="xref std std-term">ACID</span></a></p>
  526. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Isolation_(database_systems">http://en.wikipedia.org/wiki/Isolation_(database_systems</a>)</p>
  527. </div>
  528. </dd>
  529. <dt id="term-lazy-load">lazy load</dt><dt id="term-lazy-loads">lazy loads</dt><dt id="term-lazy-loaded">lazy loaded</dt><dt id="term-lazy-loading">lazy loading</dt><dd><p>In object relational mapping, a “lazy load” refers to an
  530. attribute that does not contain its database-side value
  531. for some period of time, typically when the object is
  532. first loaded. Instead, the attribute receives a
  533. <em>memoization</em> that causes it to go out to the database
  534. and load its data when it’s first used. Using this pattern,
  535. the complexity and time spent within object fetches can
  536. sometimes be reduced, in that
  537. attributes for related tables don’t need to be addressed
  538. immediately.</p>
  539. <div class="admonition seealso">
  540. <p class="admonition-title">See also</p>
  541. <p><a class="reference external" href="http://martinfowler.com/eaaCatalog/lazyLoad.html">Lazy Load (on Martin Fowler)</a></p>
  542. <p><a class="reference internal" href="#term-N-plus-one-problem"><span class="xref std std-term">N plus one problem</span></a></p>
  543. <p><a class="reference internal" href="orm/loading_relationships.html"><span class="doc">Relationship Loading Techniques</span></a></p>
  544. </div>
  545. </dd>
  546. <dt id="term-many-to-many">many to many</dt><dd><p>A style of <a class="reference internal" href="orm/relationship_api.html#sqlalchemy.orm.relationship" title="sqlalchemy.orm.relationship"><code class="xref py py-func docutils literal notranslate"><span class="pre">sqlalchemy.orm.relationship()</span></code></a> which links two tables together
  547. via an intermediary table in the middle. Using this configuration,
  548. any number of rows on the left side may refer to any number of
  549. rows on the right, and vice versa.</p>
  550. <p>A schema where employees can be associated with projects:</p>
  551. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">employee</span> <span class="p">(</span>
  552. <span class="n">id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  553. <span class="n">name</span> <span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
  554. <span class="p">)</span>
  555. <span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">project</span> <span class="p">(</span>
  556. <span class="n">id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  557. <span class="n">name</span> <span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
  558. <span class="p">)</span>
  559. <span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">employee_project</span> <span class="p">(</span>
  560. <span class="n">employee_id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  561. <span class="n">project_id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  562. <span class="k">FOREIGN</span> <span class="k">KEY</span> <span class="n">employee_id</span> <span class="k">REFERENCES</span> <span class="n">employee</span><span class="p">(</span><span class="n">id</span><span class="p">),</span>
  563. <span class="k">FOREIGN</span> <span class="k">KEY</span> <span class="n">project_id</span> <span class="k">REFERENCES</span> <span class="n">project</span><span class="p">(</span><span class="n">id</span><span class="p">)</span>
  564. <span class="p">)</span></pre></div>
  565. </div>
  566. <p>Above, the <code class="docutils literal notranslate"><span class="pre">employee_project</span></code> table is the many-to-many table,
  567. which naturally forms a composite primary key consisting
  568. of the primary key from each related table.</p>
  569. <p>In SQLAlchemy, the <a class="reference internal" href="orm/relationship_api.html#sqlalchemy.orm.relationship" title="sqlalchemy.orm.relationship"><code class="xref py py-func docutils literal notranslate"><span class="pre">sqlalchemy.orm.relationship()</span></code></a> function
  570. can represent this style of relationship in a mostly
  571. transparent fashion, where the many-to-many table is
  572. specified using plain table metadata:</p>
  573. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">Employee</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  574. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;employee&#39;</span>
  575. <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="p">)</span>
  576. <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">30</span><span class="p">))</span>
  577. <span class="n">projects</span> <span class="o">=</span> <span class="n">relationship</span><span class="p">(</span>
  578. <span class="s2">&quot;Project&quot;</span><span class="p">,</span>
  579. <span class="n">secondary</span><span class="o">=</span><span class="n">Table</span><span class="p">(</span><span class="s1">&#39;employee_project&#39;</span><span class="p">,</span> <span class="n">Base</span><span class="o">.</span><span class="n">metadata</span><span class="p">,</span>
  580. <span class="n">Column</span><span class="p">(</span><span class="s2">&quot;employee_id&quot;</span><span class="p">,</span> <span class="n">Integer</span><span class="p">,</span> <span class="n">ForeignKey</span><span class="p">(</span><span class="s1">&#39;employee.id&#39;</span><span class="p">),</span>
  581. <span class="n">primary_key</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span>
  582. <span class="n">Column</span><span class="p">(</span><span class="s2">&quot;project_id&quot;</span><span class="p">,</span> <span class="n">Integer</span><span class="p">,</span> <span class="n">ForeignKey</span><span class="p">(</span><span class="s1">&#39;project.id&#39;</span><span class="p">),</span>
  583. <span class="n">primary_key</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
  584. <span class="p">),</span>
  585. <span class="n">backref</span><span class="o">=</span><span class="s2">&quot;employees&quot;</span>
  586. <span class="p">)</span>
  587. <span class="k">class</span> <span class="nc">Project</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  588. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;project&#39;</span>
  589. <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="p">)</span>
  590. <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">30</span><span class="p">))</span></pre></div>
  591. </div>
  592. <p>Above, the <code class="docutils literal notranslate"><span class="pre">Employee.projects</span></code> and back-referencing <code class="docutils literal notranslate"><span class="pre">Project.employees</span></code>
  593. collections are defined:</p>
  594. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">proj</span> <span class="o">=</span> <span class="n">Project</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;Client A&quot;</span><span class="p">)</span>
  595. <span class="n">emp1</span> <span class="o">=</span> <span class="n">Employee</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;emp1&quot;</span><span class="p">)</span>
  596. <span class="n">emp2</span> <span class="o">=</span> <span class="n">Employee</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;emp2&quot;</span><span class="p">)</span>
  597. <span class="n">proj</span><span class="o">.</span><span class="n">employees</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="n">emp1</span><span class="p">,</span> <span class="n">emp2</span><span class="p">])</span></pre></div>
  598. </div>
  599. <div class="admonition seealso">
  600. <p class="admonition-title">See also</p>
  601. <p><a class="reference internal" href="#term-association-relationship"><span class="xref std std-term">association relationship</span></a></p>
  602. <p><a class="reference internal" href="#term-relationship"><span class="xref std std-term">relationship</span></a></p>
  603. <p><a class="reference internal" href="#term-one-to-many"><span class="xref std std-term">one to many</span></a></p>
  604. <p><a class="reference internal" href="#term-many-to-one"><span class="xref std std-term">many to one</span></a></p>
  605. </div>
  606. </dd>
  607. <dt id="term-many-to-one">many to one</dt><dd><p>A style of <a class="reference internal" href="orm/relationship_api.html#sqlalchemy.orm.relationship" title="sqlalchemy.orm.relationship"><code class="xref py py-func docutils literal notranslate"><span class="pre">relationship()</span></code></a> which links
  608. a foreign key in the parent mapper’s table to the primary
  609. key of a related table. Each parent object can
  610. then refer to exactly zero or one related object.</p>
  611. <p>The related objects in turn will have an implicit or
  612. explicit <a class="reference internal" href="#term-one-to-many"><span class="xref std std-term">one to many</span></a> relationship to any number
  613. of parent objects that refer to them.</p>
  614. <p>An example many to one schema (which, note, is identical
  615. to the <a class="reference internal" href="#term-one-to-many"><span class="xref std std-term">one to many</span></a> schema):</p>
  616. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">department</span> <span class="p">(</span>
  617. <span class="n">id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  618. <span class="n">name</span> <span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
  619. <span class="p">)</span>
  620. <span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">employee</span> <span class="p">(</span>
  621. <span class="n">id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  622. <span class="n">name</span> <span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">30</span><span class="p">),</span>
  623. <span class="n">dep_id</span> <span class="nb">INTEGER</span> <span class="k">REFERENCES</span> <span class="n">department</span><span class="p">(</span><span class="n">id</span><span class="p">)</span>
  624. <span class="p">)</span></pre></div>
  625. </div>
  626. <p>The relationship from <code class="docutils literal notranslate"><span class="pre">employee</span></code> to <code class="docutils literal notranslate"><span class="pre">department</span></code> is
  627. many to one, since many employee records can be associated with a
  628. single department. A SQLAlchemy mapping might look like:</p>
  629. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">Department</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  630. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;department&#39;</span>
  631. <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="kc">True</span><span class="p">)</span>
  632. <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">30</span><span class="p">))</span>
  633. <span class="k">class</span> <span class="nc">Employee</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  634. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;employee&#39;</span>
  635. <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="kc">True</span><span class="p">)</span>
  636. <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">30</span><span class="p">))</span>
  637. <span class="n">dep_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">ForeignKey</span><span class="p">(</span><span class="s1">&#39;department.id&#39;</span><span class="p">))</span>
  638. <span class="n">department</span> <span class="o">=</span> <span class="n">relationship</span><span class="p">(</span><span class="s2">&quot;Department&quot;</span><span class="p">)</span></pre></div>
  639. </div>
  640. <div class="admonition seealso">
  641. <p class="admonition-title">See also</p>
  642. <p><a class="reference internal" href="#term-relationship"><span class="xref std std-term">relationship</span></a></p>
  643. <p><a class="reference internal" href="#term-one-to-many"><span class="xref std std-term">one to many</span></a></p>
  644. <p><a class="reference internal" href="#term-backref"><span class="xref std std-term">backref</span></a></p>
  645. </div>
  646. </dd>
  647. <dt id="term-mapping">mapping</dt><dt id="term-mapped">mapped</dt><dd><p>We say a class is “mapped” when it has been passed through the
  648. <a class="reference internal" href="orm/mapping_api.html#sqlalchemy.orm.mapper" title="sqlalchemy.orm.mapper"><code class="xref py py-func docutils literal notranslate"><span class="pre">orm.mapper()</span></code></a> function. This process associates the
  649. class with a database table or other <span class="xref std std-term">selectable</span>
  650. construct, so that instances of it can be persisted
  651. using a <a class="reference internal" href="orm/session_api.html#sqlalchemy.orm.session.Session" title="sqlalchemy.orm.session.Session"><code class="xref py py-class docutils literal notranslate"><span class="pre">Session</span></code></a> as well as loaded using a
  652. <a class="reference internal" href="orm/query.html#sqlalchemy.orm.query.Query" title="sqlalchemy.orm.query.Query"><code class="xref py py-class docutils literal notranslate"><span class="pre">Query</span></code></a>.</p>
  653. </dd>
  654. <dt id="term-marshalling">marshalling</dt><dt id="term-data-marshalling">data marshalling</dt><dd><p>The process of transforming the memory representation of an object to
  655. a data format suitable for storage or transmission to another part of
  656. a system, when data must be moved between different parts of a
  657. computer program or from one program to another. In terms of
  658. SQLAlchemy, we often need to “marshal” data into a format appropriate
  659. for passing into the relational database.</p>
  660. <div class="admonition seealso">
  661. <p class="admonition-title">See also</p>
  662. <p><a class="reference external" href="https://en.wikipedia.org/wiki/Marshalling_(computer_science)">Marshalling (via Wikipedia)</a></p>
  663. <p><a class="reference internal" href="core/custom_types.html#types-typedecorator"><span class="std std-ref">Augmenting Existing Types</span></a> - SQLAlchemy’s <a class="reference internal" href="core/custom_types.html#sqlalchemy.types.TypeDecorator" title="sqlalchemy.types.TypeDecorator"><code class="xref py py-class docutils literal notranslate"><span class="pre">TypeDecorator</span></code></a>
  664. is commonly used for data marshalling as data is sent into the
  665. database for INSERT and UPDATE statements, and “unmarshalling”
  666. data as it is retrieved using SELECT statements.</p>
  667. </div>
  668. </dd>
  669. <dt id="term-method-chaining">method chaining</dt><dd><p>An object-oriented technique whereby the state of an object
  670. is constructed by calling methods on the object. The
  671. object features any number of methods, each of which return
  672. a new object (or in some cases the same object) with
  673. additional state added to the object.</p>
  674. <p>The two SQLAlchemy objects that make the most use of
  675. method chaining are the <a class="reference internal" href="core/selectable.html#sqlalchemy.sql.expression.Select" title="sqlalchemy.sql.expression.Select"><code class="xref py py-class docutils literal notranslate"><span class="pre">Select</span></code></a>
  676. object and the <a class="reference internal" href="orm/query.html#sqlalchemy.orm.query.Query" title="sqlalchemy.orm.query.Query"><code class="xref py py-class docutils literal notranslate"><span class="pre">Query</span></code></a> object.
  677. For example, a <a class="reference internal" href="core/selectable.html#sqlalchemy.sql.expression.Select" title="sqlalchemy.sql.expression.Select"><code class="xref py py-class docutils literal notranslate"><span class="pre">Select</span></code></a> object can
  678. be assigned two expressions to its WHERE clause as well
  679. 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"><code class="xref py py-meth docutils literal notranslate"><span class="pre">where()</span></code></a>
  680. and <a class="reference internal" href="core/selectable.html#sqlalchemy.sql.expression.Select.order_by" title="sqlalchemy.sql.expression.Select.order_by"><code class="xref py py-meth docutils literal notranslate"><span class="pre">order_by()</span></code></a> methods:</p>
  681. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">stmt</span> <span class="o">=</span> <span class="n">select</span><span class="p">([</span><span class="n">user</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>\
  682. <span class="n">where</span><span class="p">(</span><span class="n">user</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">id</span> <span class="o">&gt;</span> <span class="mi">5</span><span class="p">)</span><span class="o">.</span>\
  683. <span class="n">where</span><span class="p">(</span><span class="n">user</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">like</span><span class="p">(</span><span class="s1">&#39;e%&#39;</span><span class="p">)</span><span class="o">.</span>\
  684. <span class="n">order_by</span><span class="p">(</span><span class="n">user</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">name</span><span class="p">)</span></pre></div>
  685. </div>
  686. <p>Each method call above returns a copy of the original
  687. <a class="reference internal" href="core/selectable.html#sqlalchemy.sql.expression.Select" title="sqlalchemy.sql.expression.Select"><code class="xref py py-class docutils literal notranslate"><span class="pre">Select</span></code></a> object with additional qualifiers
  688. added.</p>
  689. <div class="admonition seealso">
  690. <p class="admonition-title">See also</p>
  691. <p><a class="reference internal" href="#term-generative"><span class="xref std std-term">generative</span></a></p>
  692. </div>
  693. </dd>
  694. <dt id="term-N-plus-one-problem">N plus one problem</dt><dd><p>The N plus one problem is a common side effect of the
  695. <a class="reference internal" href="#term-lazy-load"><span class="xref std std-term">lazy load</span></a> pattern, whereby an application wishes
  696. to iterate through a related attribute or collection on
  697. each member of a result set of objects, where that
  698. attribute or collection is set to be loaded via the lazy
  699. load pattern. The net result is that a SELECT statement
  700. is emitted to load the initial result set of parent objects;
  701. then, as the application iterates through each member,
  702. an additional SELECT statement is emitted for each member
  703. in order to load the related attribute or collection for
  704. that member. The end result is that for a result set of
  705. N parent objects, there will be N + 1 SELECT statements emitted.</p>
  706. <p>The N plus one problem is alleviated using <span class="xref std std-term">eager loading</span>.</p>
  707. <div class="admonition seealso">
  708. <p class="admonition-title">See also</p>
  709. <p><a class="reference internal" href="orm/loading_relationships.html"><span class="doc">Relationship Loading Techniques</span></a></p>
  710. </div>
  711. </dd>
  712. <dt id="term-one-to-many">one to many</dt><dd><p>A style of <a class="reference internal" href="orm/relationship_api.html#sqlalchemy.orm.relationship" title="sqlalchemy.orm.relationship"><code class="xref py py-func docutils literal notranslate"><span class="pre">relationship()</span></code></a> which links
  713. the primary key of the parent mapper’s table to the foreign
  714. key of a related table. Each unique parent object can
  715. then refer to zero or more unique related objects.</p>
  716. <p>The related objects in turn will have an implicit or
  717. explicit <a class="reference internal" href="#term-many-to-one"><span class="xref std std-term">many to one</span></a> relationship to their parent
  718. object.</p>
  719. <p>An example one to many schema (which, note, is identical
  720. to the <a class="reference internal" href="#term-many-to-one"><span class="xref std std-term">many to one</span></a> schema):</p>
  721. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">department</span> <span class="p">(</span>
  722. <span class="n">id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  723. <span class="n">name</span> <span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
  724. <span class="p">)</span>
  725. <span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">employee</span> <span class="p">(</span>
  726. <span class="n">id</span> <span class="nb">INTEGER</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
  727. <span class="n">name</span> <span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">30</span><span class="p">),</span>
  728. <span class="n">dep_id</span> <span class="nb">INTEGER</span> <span class="k">REFERENCES</span> <span class="n">department</span><span class="p">(</span><span class="n">id</span><span class="p">)</span>
  729. <span class="p">)</span></pre></div>
  730. </div>
  731. <p>The relationship from <code class="docutils literal notranslate"><span class="pre">department</span></code> to <code class="docutils literal notranslate"><span class="pre">employee</span></code> is
  732. one to many, since many employee records can be associated with a
  733. single department. A SQLAlchemy mapping might look like:</p>
  734. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">Department</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  735. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;department&#39;</span>
  736. <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="kc">True</span><span class="p">)</span>
  737. <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">30</span><span class="p">))</span>
  738. <span class="n">employees</span> <span class="o">=</span> <span class="n">relationship</span><span class="p">(</span><span class="s2">&quot;Employee&quot;</span><span class="p">)</span>
  739. <span class="k">class</span> <span class="nc">Employee</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
  740. <span class="n">__tablename__</span> <span class="o">=</span> <span class="s1">&#39;employee&#39;</span>
  741. <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="kc">True</span><span class="p">)</span>
  742. <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">30</span><span class="p">))</span>
  743. <span class="n">dep_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">ForeignKey</span><span class="p">(</span><span class="s1">&#39;department.id&#39;</span><span class="p">))</span></pre></div>
  744. </div>
  745. <div class="admonition seealso">
  746. <p class="admonition-title">See also</p>
  747. <p><a class="reference internal" href="#term-relationship"><span class="xref std std-term">relationship</span></a></p>
  748. <p><a class="reference internal" href="#term-many-to-one"><span class="xref std std-term">many to one</span></a></p>
  749. <p><a class="reference internal" href="#term-backref"><span class="xref std std-term">backref</span></a></p>
  750. </div>
  751. </dd>
  752. <dt id="term-pending">pending</dt><dd><p>This describes one of the major object states which
  753. an object can have within a <a class="reference internal" href="#term-Session"><span class="xref std std-term">session</span></a>; a pending object
  754. is a new object that doesn’t have any database identity,
  755. but has been recently associated with a session. When
  756. the session emits a flush and the row is inserted, the
  757. object moves to the <a class="reference internal" href="#term-persistent"><span class="xref std std-term">persistent</span></a> state.</p>
  758. <div class="admonition seealso">
  759. <p class="admonition-title">See also</p>
  760. <p><a class="reference internal" href="orm/session_state_management.html#session-object-states"><span class="std std-ref">Quickie Intro to Object States</span></a></p>
  761. </div>
  762. </dd>
  763. <dt id="term-persistent">persistent</dt><dd><p>This describes one of the major object states which
  764. an object can have within a <a class="reference internal" href="#term-Session"><span class="xref std std-term">session</span></a>; a persistent object
  765. is an object that has a database identity (i.e. a primary key)
  766. and is currently associated with a session. Any object
  767. that was previously <a class="reference internal" href="#term-pending"><span class="xref std std-term">pending</span></a> and has now been inserted
  768. is in the persistent state, as is any object that’s
  769. been loaded by the session from the database. When a
  770. persistent object is removed from a session, it is known
  771. as <a class="reference internal" href="#term-detached"><span class="xref std std-term">detached</span></a>.</p>
  772. <div class="admonition seealso">
  773. <p class="admonition-title">See also</p>
  774. <p><a class="reference internal" href="orm/session_state_management.html#session-object-states"><span class="std std-ref">Quickie Intro to Object States</span></a></p>
  775. </div>
  776. </dd>
  777. <dt id="term-polymorphic">polymorphic</dt><dt id="term-polymorphically">polymorphically</dt><dd><p>Refers to a function that handles several types at once. In SQLAlchemy,
  778. the term is usually applied to the concept of an ORM mapped class
  779. whereby a query operation will return different subclasses
  780. based on information in the result set, typically by checking the
  781. value of a particular column in the result known as the <a class="reference internal" href="#term-discriminator"><span class="xref std std-term">discriminator</span></a>.</p>
  782. <p>Polymorphic loading in SQLAlchemy implies that a one or a
  783. combination of three different schemes are used to map a hierarchy
  784. of classes; “joined”, “single”, and “concrete”. The section
  785. <a class="reference internal" href="orm/inheritance.html"><span class="std std-ref">Mapping Class Inheritance Hierarchies</span></a> describes inheritance mapping fully.</p>
  786. </dd>
  787. <dt id="term-primary-key">primary key</dt><dt id="term-primary-key-constraint">primary key constraint</dt><dd><p>A <a class="reference internal" href="#term-constraint"><span class="xref std std-term">constraint</span></a> that uniquely defines the characteristics
  788. of each <span class="xref std std-term">row</span>. The primary key has to consist of
  789. characteristics that cannot be duplicated by any other row.
  790. The primary key may consist of a single attribute or
  791. multiple attributes in combination.
  792. (via Wikipedia)</p>
  793. <p>The primary key of a table is typically, though not always,
  794. defined within the <code class="docutils literal notranslate"><span class="pre">CREATE</span> <span class="pre">TABLE</span></code> <a class="reference internal" href="#term-DDL"><span class="xref std std-term">DDL</span></a>:</p>
  795. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">employee</span> <span class="p">(</span>
  796. <span class="n">emp_id</span> <span class="nb">INTEGER</span><span class="p">,</span>
  797. <span class="n">emp_name</span> <span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">30</span><span class="p">),</span>
  798. <span class="n">dep_id</span> <span class="nb">INTEGER</span><span class="p">,</span>
  799. <span class="k">PRIMARY</span> <span class="k">KEY</span> <span class="p">(</span><span class="n">emp_id</span><span class="p">)</span>
  800. <span class="p">)</span></pre></div>
  801. </div>
  802. <div class="admonition seealso">
  803. <p class="admonition-title">See also</p>
  804. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Primary_Key">http://en.wikipedia.org/wiki/Primary_Key</a></p>
  805. </div>
  806. </dd>
  807. <dt id="term-relationship">relationship</dt><dt id="term-relationships">relationships</dt><dd><p>A connecting unit between two mapped classes, corresponding
  808. to some relationship between the two tables in the database.</p>
  809. <p>The relationship is defined using the SQLAlchemy function
  810. <a class="reference internal" href="orm/relationship_api.html#sqlalchemy.orm.relationship" title="sqlalchemy.orm.relationship"><code class="xref py py-func docutils literal notranslate"><span class="pre">relationship()</span></code></a>. Once created, SQLAlchemy
  811. inspects the arguments and underlying mappings involved
  812. in order to classify the relationship as one of three types:
  813. <a class="reference internal" href="#term-one-to-many"><span class="xref std std-term">one to many</span></a>, <a class="reference internal" href="#term-many-to-one"><span class="xref std std-term">many to one</span></a>, or <a class="reference internal" href="#term-many-to-many"><span class="xref std std-term">many to many</span></a>.
  814. With this classification, the relationship construct
  815. handles the task of persisting the appropriate linkages
  816. in the database in response to in-memory object associations,
  817. as well as the job of loading object references and collections
  818. into memory based on the current linkages in the
  819. database.</p>
  820. <div class="admonition seealso">
  821. <p class="admonition-title">See also</p>
  822. <p><a class="reference internal" href="orm/relationships.html"><span class="std std-ref">Relationship Configuration</span></a></p>
  823. </div>
  824. </dd>
  825. <dt id="term-release">release</dt><dt id="term-releases">releases</dt><dt id="term-released">released</dt><dd><p>In the context of SQLAlchemy, the term “released”
  826. refers to the process of ending the usage of a particular
  827. database connection. SQLAlchemy features the usage
  828. of connection pools, which allows configurability as to
  829. the lifespan of database connections. When using a pooled
  830. connection, the process of “closing” it, i.e. invoking
  831. a statement like <code class="docutils literal notranslate"><span class="pre">connection.close()</span></code>, may have the effect
  832. of the connection being returned to an existing pool,
  833. or it may have the effect of actually shutting down the
  834. underlying TCP/IP connection referred to by that connection -
  835. which one takes place depends on configuration as well
  836. as the current state of the pool. So we used the term
  837. <em>released</em> instead, to mean “do whatever it is you do
  838. with connections when we’re done using them”.</p>
  839. <p>The term will sometimes be used in the phrase, “release
  840. transactional resources”, to indicate more explicitly that
  841. what we are actually “releasing” is any transactional
  842. state which as accumulated upon the connection. In most
  843. situations, the process of selecting from tables, emitting
  844. updates, etc. acquires <a class="reference internal" href="#term-isolated"><span class="xref std std-term">isolated</span></a> state upon
  845. that connection as well as potential row or table locks.
  846. This state is all local to a particular transaction
  847. on the connection, and is released when we emit a rollback.
  848. An important feature of the connection pool is that when
  849. we return a connection to the pool, the <code class="docutils literal notranslate"><span class="pre">connection.rollback()</span></code>
  850. method of the DBAPI is called as well, so that as the
  851. connection is set up to be used again, it’s in a “clean”
  852. state with no references held to the previous series
  853. of operations.</p>
  854. <div class="admonition seealso">
  855. <p class="admonition-title">See also</p>
  856. <p><a class="reference internal" href="core/pooling.html"><span class="std std-ref">Connection Pooling</span></a></p>
  857. </div>
  858. </dd>
  859. <dt id="term-RETURNING">RETURNING</dt><dd><p>This is a non-SQL standard clause provided in various forms by
  860. certain backends, which provides the service of returning a result
  861. set upon execution of an INSERT, UPDATE or DELETE statement. Any set
  862. of columns from the matched rows can be returned, as though they were
  863. produced from a SELECT statement.</p>
  864. <p>The RETURNING clause provides both a dramatic performance boost to
  865. common update/select scenarios, including retrieval of inline- or
  866. default- generated primary key values and defaults at the moment they
  867. were created, as well as a way to get at server-generated
  868. default values in an atomic way.</p>
  869. <p>An example of RETURNING, idiomatic to PostgreSQL, looks like:</p>
  870. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">INSERT</span> <span class="n">INTO</span> <span class="n">user_account</span> <span class="p">(</span><span class="n">name</span><span class="p">)</span> <span class="n">VALUES</span> <span class="p">(</span><span class="s1">&#39;new name&#39;</span><span class="p">)</span> <span class="n">RETURNING</span> <span class="nb">id</span><span class="p">,</span> <span class="n">timestamp</span></pre></div>
  871. </div>
  872. <p>Above, the INSERT statement will provide upon execution a result set
  873. which includes the values of the columns <code class="docutils literal notranslate"><span class="pre">user_account.id</span></code> and
  874. <code class="docutils literal notranslate"><span class="pre">user_account.timestamp</span></code>, which above should have been generated as default
  875. values as they are not included otherwise (but note any series of columns
  876. or SQL expressions can be placed into RETURNING, not just default-value columns).</p>
  877. <p>The backends that currently support
  878. RETURNING or a similar construct are PostgreSQL, SQL Server, Oracle,
  879. and Firebird. The PostgreSQL and Firebird implementations are generally
  880. full featured, whereas the implementations of SQL Server and Oracle
  881. have caveats. On SQL Server, the clause is known as “OUTPUT INSERTED”
  882. for INSERT and UPDATE statements and “OUTPUT DELETED” for DELETE statements;
  883. the key caveat is that triggers are not supported in conjunction with this
  884. keyword. On Oracle, it is known as “RETURNING…INTO”, and requires that the
  885. value be placed into an OUT parameter, meaning not only is the syntax awkward,
  886. but it can also only be used for one row at a time.</p>
  887. <p>SQLAlchemy’s <a class="reference internal" href="core/dml.html#sqlalchemy.sql.expression.UpdateBase.returning" title="sqlalchemy.sql.expression.UpdateBase.returning"><code class="xref py py-meth docutils literal notranslate"><span class="pre">UpdateBase.returning()</span></code></a> system provides a layer of abstraction
  888. on top of the RETURNING systems of these backends to provide a consistent
  889. interface for returning columns. The ORM also includes many optimizations
  890. that make use of RETURNING when available.</p>
  891. </dd>
  892. <dt id="term-Session">Session</dt><dd><p>The container or scope for ORM database operations. Sessions
  893. load instances from the database, track changes to mapped
  894. instances and persist changes in a single unit of work when
  895. flushed.</p>
  896. <div class="admonition seealso">
  897. <p class="admonition-title">See also</p>
  898. <p><a class="reference internal" href="orm/session.html"><span class="doc">Using the Session</span></a></p>
  899. </div>
  900. </dd>
  901. <dt id="term-subquery">subquery</dt><dd><p>Refers to a <code class="docutils literal notranslate"><span class="pre">SELECT</span></code> statement that is embedded within an enclosing
  902. <code class="docutils literal notranslate"><span class="pre">SELECT</span></code>.</p>
  903. <p>A subquery comes in two general flavors, one known as a “scalar select”
  904. which specifically must return exactly one row and one column, and the
  905. other form which acts as a “derived table” and serves as a source of
  906. rows for the FROM clause of another select. A scalar select is eligible
  907. to be placed in the <a class="reference internal" href="#term-WHERE-clause"><span class="xref std std-term">WHERE clause</span></a>, <a class="reference internal" href="#term-columns-clause"><span class="xref std std-term">columns clause</span></a>,
  908. ORDER BY clause or HAVING clause of the enclosing select, whereas the
  909. derived table form is eligible to be placed in the FROM clause of the
  910. enclosing <code class="docutils literal notranslate"><span class="pre">SELECT</span></code>.</p>
  911. <p>Examples:</p>
  912. <ol class="arabic">
  913. <li><p>a scalar subquery placed in the <a class="reference internal" href="#term-columns-clause"><span class="xref std std-term">columns clause</span></a> of an enclosing
  914. <code class="docutils literal notranslate"><span class="pre">SELECT</span></code>. The subquery in this example is a <a class="reference internal" href="#term-correlated-subquery"><span class="xref std std-term">correlated subquery</span></a> because part
  915. of the rows which it selects from are given via the enclosing statement.</p>
  916. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><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>
  917. <span class="k">FROM</span> <span class="k">user</span></pre></div>
  918. </div>
  919. </li>
  920. <li><p>a scalar subquery placed in the <a class="reference internal" href="#term-WHERE-clause"><span class="xref std std-term">WHERE clause</span></a> of an enclosing
  921. <code class="docutils literal notranslate"><span class="pre">SELECT</span></code>. This subquery in this example is not correlated as it selects a fixed result.</p>
  922. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><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>
  923. <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>
  924. </div>
  925. </li>
  926. <li><p>a derived table subquery placed in the <a class="reference internal" href="#term-FROM-clause"><span class="xref std std-term">FROM clause</span></a> of an enclosing
  927. <code class="docutils literal notranslate"><span class="pre">SELECT</span></code>. Such a subquery is almost always given an alias name.</p>
  928. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><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>
  929. <span class="k">FROM</span>
  930. <span class="k">user</span> <span class="k">JOIN</span>
  931. <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>
  932. <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>
  933. </div>
  934. </li>
  935. </ol>
  936. </dd>
  937. <dt id="term-transient">transient</dt><dd><p>This describes one of the major object states which
  938. an object can have within a <a class="reference internal" href="#term-Session"><span class="xref std std-term">session</span></a>; a transient object
  939. is a new object that doesn’t have any database identity
  940. and has not been associated with a session yet. When the
  941. object is added to the session, it moves to the
  942. <a class="reference internal" href="#term-pending"><span class="xref std std-term">pending</span></a> state.</p>
  943. <div class="admonition seealso">
  944. <p class="admonition-title">See also</p>
  945. <p><a class="reference internal" href="orm/session_state_management.html#session-object-states"><span class="std std-ref">Quickie Intro to Object States</span></a></p>
  946. </div>
  947. </dd>
  948. <dt id="term-unique-constraint">unique constraint</dt><dt id="term-unique-key-index">unique key index</dt><dd><p>A unique key index can uniquely identify each row of data
  949. values in a database table. A unique key index comprises a
  950. single column or a set of columns in a single database table.
  951. No two distinct rows or data records in a database table can
  952. have the same data value (or combination of data values) in
  953. those unique key index columns if NULL values are not used.
  954. Depending on its design, a database table may have many unique
  955. key indexes but at most one primary key index.</p>
  956. <p>(via Wikipedia)</p>
  957. <div class="admonition seealso">
  958. <p class="admonition-title">See also</p>
  959. <p><a class="reference external" href="http://en.wikipedia.org/wiki/Unique_key#Defining_unique_keys">http://en.wikipedia.org/wiki/Unique_key#Defining_unique_keys</a></p>
  960. </div>
  961. </dd>
  962. <dt id="term-unit-of-work">unit of work</dt><dd><p>This pattern is where the system transparently keeps
  963. track of changes to objects and periodically flushes all those
  964. pending changes out to the database. SQLAlchemy’s Session
  965. implements this pattern fully in a manner similar to that of
  966. Hibernate.</p>
  967. <div class="admonition seealso">
  968. <p class="admonition-title">See also</p>
  969. <p><a class="reference external" href="http://martinfowler.com/eaaCatalog/unitOfWork.html">Unit of Work by Martin Fowler</a></p>
  970. <p><a class="reference internal" href="orm/session.html"><span class="doc">Using the Session</span></a></p>
  971. </div>
  972. </dd>
  973. <dt id="term-WHERE-clause">WHERE clause</dt><dd><p>The portion of the <code class="docutils literal notranslate"><span class="pre">SELECT</span></code> statement which indicates criteria
  974. by which rows should be filtered. It is a single SQL expression
  975. which follows the keyword <code class="docutils literal notranslate"><span class="pre">WHERE</span></code>.</p>
  976. <div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><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>
  977. <span class="k">FROM</span> <span class="n">user_account</span>
  978. <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>
  979. </div>
  980. <p>Above, the phrase <code class="docutils literal notranslate"><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></code>
  981. comprises the WHERE clause of the <code class="docutils literal notranslate"><span class="pre">SELECT</span></code>.</p>
  982. </dd>
  983. </dl>
  984. </div>
  985. </div>
  986. </div>
  987. <div id="docs-bottom-navigation" class="docs-navigation-links, withsidebar">
  988. <div id="docs-copyright">
  989. &copy; <a href="copyright.html">Copyright</a> 2007-2020, the SQLAlchemy authors and contributors.
  990. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 3.0.0.
  991. </div>
  992. </div>
  993. </div>
  994. <script type="text/javascript">
  995. var DOCUMENTATION_OPTIONS = {
  996. URL_ROOT: './',
  997. VERSION: '1.3.16',
  998. COLLAPSE_MODINDEX: false,
  999. FILE_SUFFIX: '.html'
  1000. };
  1001. </script>
  1002. <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  1003. <!-- begin iterate through sphinx environment script_files -->
  1004. <script type="text/javascript" src="_static/jquery.js"></script>
  1005. <script type="text/javascript" src="_static/underscore.js"></script>
  1006. <script type="text/javascript" src="_static/doctools.js"></script>
  1007. <script type="text/javascript" src="_static/language_data.js"></script>
  1008. <!-- end iterate through sphinx environment script_files -->
  1009. <script type="text/javascript" src="_static/detectmobile.js"></script>
  1010. <script type="text/javascript" src="_static/init.js"></script>
  1011. </body>
  1012. </html>