| | | |
Offset 215, 16 lines modified | Offset 215, 16 lines modified |
215 | <div·class="section"·id="module-examples.association"> | 215 | <div·class="section"·id="module-examples.association"> |
216 | <span·id="associations"></span><span·id="examples-associations"></span><h3>Associations<a·class="headerlink"·href="#module-examples.association"·title="Permalink·to·this·headline">¶</a></h3> | 216 | <span·id="associations"></span><span·id="examples-associations"></span><h3>Associations<a·class="headerlink"·href="#module-examples.association"·title="Permalink·to·this·headline">¶</a></h3> |
217 | <p>Examples·illustrating·the·usage·of·the·“association·object”·pattern, | 217 | <p>Examples·illustrating·the·usage·of·the·“association·object”·pattern, |
218 | where·an·intermediary·class·mediates·the·relationship·between·two | 218 | where·an·intermediary·class·mediates·the·relationship·between·two |
219 | classes·that·are·associated·in·a·many-to-many·pattern.</p> | 219 | classes·that·are·associated·in·a·many-to-many·pattern.</p> |
220 | <p>Listing·of·files:<ul·class="simple"> | 220 | <p>Listing·of·files:<ul·class="simple"> |
221 | <li><a·class="reference·external"·href="../_modules/examples/association/dict_of_sets_with_default.html">dict_of_sets_with_default.py</a></li> | 221 | <li><a·class="reference·external"·href="../_modules/examples/association/dict_of_sets_with_default.html">dict_of_sets_with_default.py</a></li> |
222 | <li><a·class="reference·external"·href="../_modules/examples/association/proxied_association.html">proxied_association.py</a></li> | |
223 | <li><a·class="reference·external"·href="../_modules/examples/association/basic_association.html">basic_association.py</a></li> | 222 | <li><a·class="reference·external"·href="../_modules/examples/association/basic_association.html">basic_association.py</a></li> |
| 223 | <li><a·class="reference·external"·href="../_modules/examples/association/proxied_association.html">proxied_association.py</a></li> |
224 | </ul> | 224 | </ul> |
225 | </p> | 225 | </p> |
226 | </div> | 226 | </div> |
227 | <div·class="section"·id="module-examples.graphs"> | 227 | <div·class="section"·id="module-examples.graphs"> |
228 | <span·id="directed-graphs"></span><h3>Directed·Graphs<a·class="headerlink"·href="#module-examples.graphs"·title="Permalink·to·this·headline">¶</a></h3> | 228 | <span·id="directed-graphs"></span><h3>Directed·Graphs<a·class="headerlink"·href="#module-examples.graphs"·title="Permalink·to·this·headline">¶</a></h3> |
229 | <p>An·example·of·persistence·for·a·directed·graph·structure.···The | 229 | <p>An·example·of·persistence·for·a·directed·graph·structure.···The |
230 | graph·is·stored·as·a·collection·of·edges,·each·referencing·both·a | 230 | graph·is·stored·as·a·collection·of·edges,·each·referencing·both·a |
Offset 262, 17 lines modified | Offset 262, 17 lines modified |
262 | parent·class·is·provided·with·an·<code·class="docutils·literal·notranslate"><span·class="pre">addresses</span></code>·collection | 262 | parent·class·is·provided·with·an·<code·class="docutils·literal·notranslate"><span·class="pre">addresses</span></code>·collection |
263 | which·contains·<code·class="docutils·literal·notranslate"><span·class="pre">Address</span></code>·objects.</p> | 263 | which·contains·<code·class="docutils·literal·notranslate"><span·class="pre">Address</span></code>·objects.</p> |
264 | <p>The·<a·class="reference·external"·href="../_modules/examples/generic_associations/discriminator_on_association.html">discriminator_on_association.py</a>·and·<a·class="reference·external"·href="../_modules/examples/generic_associations/generic_fk.html">generic_fk.py</a>·scripts | 264 | <p>The·<a·class="reference·external"·href="../_modules/examples/generic_associations/discriminator_on_association.html">discriminator_on_association.py</a>·and·<a·class="reference·external"·href="../_modules/examples/generic_associations/generic_fk.html">generic_fk.py</a>·scripts |
265 | are·modernized·versions·of·recipes·presented·in·the·2007·blog·post | 265 | are·modernized·versions·of·recipes·presented·in·the·2007·blog·post |
266 | <a·class="reference·external"·href="http://techspot.zzzeek.org/2007/05/29/polymorphic-associations-with-sqlalchemy/">Polymorphic·Associations·with·SQLAlchemy</a>.</p> | 266 | <a·class="reference·external"·href="http://techspot.zzzeek.org/2007/05/29/polymorphic-associations-with-sqlalchemy/">Polymorphic·Associations·with·SQLAlchemy</a>.</p> |
267 | <p>Listing·of·files:<ul·class="simple"> | 267 | <p>Listing·of·files:<ul·class="simple"> |
268 | <li><a·class="reference·external"·href="../_modules/examples/generic_associations/generic_fk.html">generic_fk.py</a></li> | 268 | <li><a·class="reference·external"·href="../_modules/examples/generic_associations/generic_fk.html">generic_fk.py</a></li> |
| 269 | <li><a·class="reference·external"·href="../_modules/examples/generic_associations/discriminator_on_association.html">discriminator_on_association.py</a></li> |
269 | <li><a·class="reference·external"·href="../_modules/examples/generic_associations/table_per_related.html">table_per_related.py</a></li> | 270 | <li><a·class="reference·external"·href="../_modules/examples/generic_associations/table_per_related.html">table_per_related.py</a></li> |
270 | <li><a·class="reference·external"·href="../_modules/examples/generic_associations/table_per_association.html">table_per_association.py</a></li> | 271 | <li><a·class="reference·external"·href="../_modules/examples/generic_associations/table_per_association.html">table_per_association.py</a></li> |
271 | <li><a·class="reference·external"·href="../_modules/examples/generic_associations/discriminator_on_association.html">discriminator_on_association.py</a></li> | |
272 | </ul> | 272 | </ul> |
273 | </p> | 273 | </p> |
274 | </div> | 274 | </div> |
275 | <div·class="section"·id="module-examples.large_collection"> | 275 | <div·class="section"·id="module-examples.large_collection"> |
276 | <span·id="large-collections"></span><h3>Large·Collections<a·class="headerlink"·href="#module-examples.large_collection"·title="Permalink·to·this·headline">¶</a></h3> | 276 | <span·id="large-collections"></span><h3>Large·Collections<a·class="headerlink"·href="#module-examples.large_collection"·title="Permalink·to·this·headline">¶</a></h3> |
277 | <p>Large·collection·example.</p> | 277 | <p>Large·collection·example.</p> |
278 | <p>Illustrates·the·options·to·use·with | 278 | <p>Illustrates·the·options·to·use·with |
Offset 357, 20 lines modified | Offset 357, 20 lines modified |
357 | <div·class="admonition·seealso"> | 357 | <div·class="admonition·seealso"> |
358 | <p·class="first·admonition-title">See·also</p> | 358 | <p·class="first·admonition-title">See·also</p> |
359 | <p·class="last"><a·class="reference·internal"·href="../faq/performance.html#faq-how-to-profile"><span·class="std·std-ref">How·can·I·profile·a·SQLAlchemy·powered·application?</span></a></p> | 359 | <p·class="last"><a·class="reference·internal"·href="../faq/performance.html#faq-how-to-profile"><span·class="std·std-ref">How·can·I·profile·a·SQLAlchemy·powered·application?</span></a></p> |
360 | </div> | 360 | </div> |
361 | <div·class="section"·id="file-listing"> | 361 | <div·class="section"·id="file-listing"> |
362 | <h4>File·Listing<a·class="headerlink"·href="#file-listing"·title="Permalink·to·this·headline">¶</a></h4> | 362 | <h4>File·Listing<a·class="headerlink"·href="#file-listing"·title="Permalink·to·this·headline">¶</a></h4> |
363 | <p>Listing·of·files:<ul·class="simple"> | 363 | <p>Listing·of·files:<ul·class="simple"> |
364 | <li><a·class="reference·external"·href="../_modules/examples/performance/bulk_inserts.html">bulk_inserts.py</a></li> | |
365 | <li><a·class="reference·external"·href="../_modules/examples/performance/__main__.html">__main__.py</a></li> | |
366 | <li><a·class="reference·external"·href="../_modules/examples/performance/large_resultsets.html">large_resultsets.py</a></li> | |
367 | <li><a·class="reference·external"·href="../_modules/examples/performance/bulk_updates.html">bulk_updates.py</a></li> | |
368 | <li><a·class="reference·external"·href="../_modules/examples/performance/single_inserts.html">single_inserts.py</a></li> | 364 | <li><a·class="reference·external"·href="../_modules/examples/performance/single_inserts.html">single_inserts.py</a></li> |
| 365 | <li><a·class="reference·external"·href="../_modules/examples/performance/bulk_updates.html">bulk_updates.py</a></li> |
369 | <li><a·class="reference·external"·href="../_modules/examples/performance/short_selects.html">short_selects.py</a></li> | 366 | <li><a·class="reference·external"·href="../_modules/examples/performance/short_selects.html">short_selects.py</a></li> |
| 367 | <li><a·class="reference·external"·href="../_modules/examples/performance/__main__.html">__main__.py</a></li> |
| 368 | <li><a·class="reference·external"·href="../_modules/examples/performance/bulk_inserts.html">bulk_inserts.py</a></li> |
| 369 | <li><a·class="reference·external"·href="../_modules/examples/performance/large_resultsets.html">large_resultsets.py</a></li> |
370 | </ul> | 370 | </ul> |
371 | </p> | 371 | </p> |
372 | </div> | 372 | </div> |
373 | <div·class="section"·id="running-all-tests-with-time"> | 373 | <div·class="section"·id="running-all-tests-with-time"> |
374 | <h4>Running·all·tests·with·time<a·class="headerlink"·href="#running-all-tests-with-time"·title="Permalink·to·this·headline">¶</a></h4> | 374 | <h4>Running·all·tests·with·time<a·class="headerlink"·href="#running-all-tests-with-time"·title="Permalink·to·this·headline">¶</a></h4> |
375 | <p>This·is·the·default·form·of·run:</p> | 375 | <p>This·is·the·default·form·of·run:</p> |
376 | <div·class="highlight-default·notranslate"><div·class="highlight"><pre><span></span>$·python·-m·examples.performance·single_inserts | 376 | <div·class="highlight-default·notranslate"><div·class="highlight"><pre><span></span>$·python·-m·examples.performance·single_inserts |
Offset 628, 17 lines modified | Offset 628, 17 lines modified |
628 | <p>Several·examples·that·illustrate·the·technique·of·intercepting·changes | 628 | <p>Several·examples·that·illustrate·the·technique·of·intercepting·changes |
629 | that·would·be·first·interpreted·as·an·UPDATE·on·a·row,·and·instead·turning | 629 | that·would·be·first·interpreted·as·an·UPDATE·on·a·row,·and·instead·turning |
630 | it·into·an·INSERT·of·a·new·row,·leaving·the·previous·row·intact·as | 630 | it·into·an·INSERT·of·a·new·row,·leaving·the·previous·row·intact·as |
631 | a·historical·version.</p> | 631 | a·historical·version.</p> |
632 | <p>Compare·to·the·<a·class="reference·internal"·href="#examples-versioned-history"><span·class="std·std-ref">Versioning·with·a·History·Table</span></a>·example·which·writes·a | 632 | <p>Compare·to·the·<a·class="reference·internal"·href="#examples-versioned-history"><span·class="std·std-ref">Versioning·with·a·History·Table</span></a>·example·which·writes·a |
633 | history·row·to·a·separate·history·table.</p> | 633 | history·row·to·a·separate·history·table.</p> |
634 | <p>Listing·of·files:<ul·class="simple"> | 634 | <p>Listing·of·files:<ul·class="simple"> |
| 635 | <li><a·class="reference·external"·href="../_modules/examples/versioned_rows/versioned_map.html">versioned_map.py</a></li> |
635 | <li><a·class="reference·external"·href="../_modules/examples/versioned_rows/versioned_rows_w_versionid.html">versioned_rows_w_versionid.py</a></li> | 636 | <li><a·class="reference·external"·href="../_modules/examples/versioned_rows/versioned_rows_w_versionid.html">versioned_rows_w_versionid.py</a></li> |
636 | <li><a·class="reference·external"·href="../_modules/examples/versioned_rows/versioned_update_old_row.html">versioned_update_old_row.py</a></li> | 637 | <li><a·class="reference·external"·href="../_modules/examples/versioned_rows/versioned_update_old_row.html">versioned_update_old_row.py</a></li> |
637 | <li><a·class="reference·external"·href="../_modules/examples/versioned_rows/versioned_map.html">versioned_map.py</a></li> | |
638 | <li><a·class="reference·external"·href="../_modules/examples/versioned_rows/versioned_rows.html">versioned_rows.py</a></li> | 638 | <li><a·class="reference·external"·href="../_modules/examples/versioned_rows/versioned_rows.html">versioned_rows.py</a></li> |
639 | </ul> | 639 | </ul> |
640 | </p> | 640 | </p> |
641 | </div> | 641 | </div> |
642 | </div> | 642 | </div> |
643 | <div·class="section"·id="module-examples.vertical"> | 643 | <div·class="section"·id="module-examples.vertical"> |
644 | <span·id="vertical-attribute-mapping"></span><span·id="examples-vertical-tables"></span><h3>Vertical·Attribute·Mapping<a·class="headerlink"·href="#module-examples.vertical"·title="Permalink·to·this·headline">¶</a></h3> | 644 | <span·id="vertical-attribute-mapping"></span><span·id="examples-vertical-tables"></span><h3>Vertical·Attribute·Mapping<a·class="headerlink"·href="#module-examples.vertical"·title="Permalink·to·this·headline">¶</a></h3> |
Offset 664, 44 lines modified | Offset 664, 44 lines modified |
664 | <span·class="n">q</span>·<span·class="o">=</span>·<span·class="p">(</span><span·class="n">session</span><span·class="o">.</span><span·class="n">query</span><span·class="p">(</span><span·class="n">Animal</span><span·class="p">)</span><span·class="o">.</span> | 664 | <span·class="n">q</span>·<span·class="o">=</span>·<span·class="p">(</span><span·class="n">session</span><span·class="o">.</span><span·class="n">query</span><span·class="p">(</span><span·class="n">Animal</span><span·class="p">)</span><span·class="o">.</span> |
665 | ·····<span·class="nb">filter</span><span·class="p">(</span><span·class="n">Animal</span><span·class="o">.</span><span·class="n">facts</span><span·class="o">.</span><span·class="n">any</span><span·class="p">(</span> | 665 | ·····<span·class="nb">filter</span><span·class="p">(</span><span·class="n">Animal</span><span·class="o">.</span><span·class="n">facts</span><span·class="o">.</span><span·class="n">any</span><span·class="p">(</span> |
666 | ·······<span·class="n">and_</span><span·class="p">(</span><span·class="n">AnimalFact</span><span·class="o">.</span><span·class="n">key</span>·<span·class="o">==</span>·<span·class="sa">u</span><span·class="s1">'weasel-like'</span><span·class="p">,</span> | 666 | ·······<span·class="n">and_</span><span·class="p">(</span><span·class="n">AnimalFact</span><span·class="o">.</span><span·class="n">key</span>·<span·class="o">==</span>·<span·class="sa">u</span><span·class="s1">'weasel-like'</span><span·class="p">,</span> |
667 | ············<span·class="n">AnimalFact</span><span·class="o">.</span><span·class="n">value</span>·<span·class="o">==</span>·<span·class="kc">True</span><span·class="p">))))</span> | 667 | ············<span·class="n">AnimalFact</span><span·class="o">.</span><span·class="n">value</span>·<span·class="o">==</span>·<span·class="kc">True</span><span·class="p">))))</span> |
668 | <span·class="nb">print</span>·<span·class="s1">'weasel-like·animals'</span><span·class="p">,</span>·<span·class="n">q</span><span·class="o">.</span><span·class="n">all</span><span·class="p">()</span></pre></div> | 668 | <span·class="nb">print</span>·<span·class="s1">'weasel-like·animals'</span><span·class="p">,</span>·<span·class="n">q</span><span·class="o">.</span><span·class="n">all</span><span·class="p">()</span></pre></div> |
669 | </div> | 669 | </div> |
670 | <p>Listing·of·files:<ul·class="simple"> | 670 | <p>Listing·of·files:<ul·class="simple"> |
671 | <li><a·class="reference·external"·href="../_modules/examples/vertical/dictlike-polymorphic.html">dictlike-polymorphic.py</a></li> | |
672 | <li><a·class="reference·external"·href="../_modules/examples/vertical/dictlike.html">dictlike.py</a></li> | 671 | <li><a·class="reference·external"·href="../_modules/examples/vertical/dictlike.html">dictlike.py</a></li> |
| 672 | <li><a·class="reference·external"·href="../_modules/examples/vertical/dictlike-polymorphic.html">dictlike-polymorphic.py</a></li> |
673 | </ul> | 673 | </ul> |
674 | </p> | 674 | </p> |
675 | </div> | 675 | </div> |
676 | </div> | 676 | </div> |
677 | <div·class="section"·id="inheritance-mapping-recipes"> | 677 | <div·class="section"·id="inheritance-mapping-recipes"> |
678 | <span·id="examples-inheritance"></span><h2>Inheritance·Mapping·Recipes<a·class="headerlink"·href="#inheritance-mapping-recipes"·title="Permalink·to·this·headline">¶</a></h2> | 678 | <span·id="examples-inheritance"></span><h2>Inheritance·Mapping·Recipes<a·class="headerlink"·href="#inheritance-mapping-recipes"·title="Permalink·to·this·headline">¶</a></h2> |
679 | <div·class="section"·id="module-examples.inheritance"> | 679 | <div·class="section"·id="module-examples.inheritance"> |
680 | <span·id="basic-inheritance-mappings"></span><h3>Basic·Inheritance·Mappings<a·class="headerlink"·href="#module-examples.inheritance"·title="Permalink·to·this·headline">¶</a></h3> | 680 | <span·id="basic-inheritance-mappings"></span><h3>Basic·Inheritance·Mappings<a·class="headerlink"·href="#module-examples.inheritance"·title="Permalink·to·this·headline">¶</a></h3> |
681 | <p>Working·examples·of·single-table,·joined-table,·and·concrete-table | 681 | <p>Working·examples·of·single-table,·joined-table,·and·concrete-table |
682 | inheritance·as·described·in·<a·class="reference·internal"·href="inheritance.html"><span·class="std·std-ref">Mapping·Class·Inheritance·Hierarchies</span></a>.</p> | 682 | inheritance·as·described·in·<a·class="reference·internal"·href="inheritance.html"><span·class="std·std-ref">Mapping·Class·Inheritance·Hierarchies</span></a>.</p> |
683 | <p>Listing·of·files:<ul·class="simple"> | 683 | <p>Listing·of·files:<ul·class="simple"> |
| 684 | <li><a·class="reference·external"·href="../_modules/examples/inheritance/concrete.html">concrete.py</a></li> |
684 | <li><a·class="reference·external"·href="../_modules/examples/inheritance/joined.html">joined.py</a></li> | 685 | <li><a·class="reference·external"·href="../_modules/examples/inheritance/joined.html">joined.py</a></li> |
685 | <li><a·class="reference·external"·href="../_modules/examples/inheritance/single.html">single.py</a></li> | 686 | <li><a·class="reference·external"·href="../_modules/examples/inheritance/single.html">single.py</a></li> |
686 | <li><a·class="reference·external"·href="../_modules/examples/inheritance/concrete.html">concrete.py</a></li> | |
687 | </ul> | 687 | </ul> |
688 | </p> | 688 | </p> |
689 | </div> | 689 | </div> |
690 | </div> | 690 | </div> |
691 | <div·class="section"·id="special-apis"> | 691 | <div·class="section"·id="special-apis"> |
692 | <h2>Special·APIs<a·class="headerlink"·href="#special-apis"·title="Permalink·to·this·headline">¶</a></h2> | 692 | <h2>Special·APIs<a·class="headerlink"·href="#special-apis"·title="Permalink·to·this·headline">¶</a></h2> |
693 | <div·class="section"·id="module-examples.custom_attributes"> | 693 | <div·class="section"·id="module-examples.custom_attributes"> |
694 | <span·id="attribute-instrumentation"></span><span·id="examples-instrumentation"></span><h3>Attribute·Instrumentation<a·class="headerlink"·href="#module-examples.custom_attributes"·title="Permalink·to·this·headline">¶</a></h3> | 694 | <span·id="attribute-instrumentation"></span><span·id="examples-instrumentation"></span><h3>Attribute·Instrumentation<a·class="headerlink"·href="#module-examples.custom_attributes"·title="Permalink·to·this·headline">¶</a></h3> |
695 | <p>Examples·illustrating·modifications·to·SQLAlchemy’s·attribute·management | 695 | <p>Examples·illustrating·modifications·to·SQLAlchemy’s·attribute·management |
696 | system.</p> | 696 | system.</p> |
697 | <p>Listing·of·files:<ul·class="simple"> | 697 | <p>Listing·of·files:<ul·class="simple"> |
| 698 | <li><a·class="reference·external"·href="../_modules/examples/custom_attributes/custom_management.html">custom_management.py</a></li> |
698 | <li><a·class="reference·external"·href="../_modules/examples/custom_attributes/active_column_defaults.html">active_column_defaults.py</a></li> | 699 | <li><a·class="reference·external"·href="../_modules/examples/custom_attributes/active_column_defaults.html">active_column_defaults.py</a></li> |
699 | <li><a·class="reference·external"·href="../_modules/examples/custom_attributes/listen_for_events.html">listen_for_events.py</a></li> | 700 | <li><a·class="reference·external"·href="../_modules/examples/custom_attributes/listen_for_events.html">listen_for_events.py</a></li> |
700 | <li><a·class="reference·external"·href="../_modules/examples/custom_attributes/custom_management.html">custom_management.py</a></li> | |
701 | </ul> | 701 | </ul> |
702 | </p> | 702 | </p> |
703 | </div> | 703 | </div> |
704 | <div·class="section"·id="module-examples.sharding"> | 704 | <div·class="section"·id="module-examples.sharding"> |
705 | <span·id="horizontal-sharding"></span><span·id="examples-sharding"></span><h3>Horizontal·Sharding<a·class="headerlink"·href="#module-examples.sharding"·title="Permalink·to·this·headline">¶</a></h3> | 705 | <span·id="horizontal-sharding"></span><span·id="examples-sharding"></span><h3>Horizontal·Sharding<a·class="headerlink"·href="#module-examples.sharding"·title="Permalink·to·this·headline">¶</a></h3> |
706 | <p>A·basic·example·of·using·the·SQLAlchemy·Sharding·API. | 706 | <p>A·basic·example·of·using·the·SQLAlchemy·Sharding·API. |
Max diff block lines reached; 0/11156 bytes (0.00%) of diff not shown.
|