| | | |
Offset 309, 40 lines modified | Offset 309, 40 lines modified |
309 | </section> | 309 | </section> |
310 | <section·id="module-examples.association"> | 310 | <section·id="module-examples.association"> |
311 | <span·id="associations"></span><span·id="examples-associations"></span><h3>Associations<a·class="headerlink"·href="#module-examples.association"·title="Permalink·to·this·heading">¶</a></h3> | 311 | <span·id="associations"></span><span·id="examples-associations"></span><h3>Associations<a·class="headerlink"·href="#module-examples.association"·title="Permalink·to·this·heading">¶</a></h3> |
312 | <p>Examples·illustrating·the·usage·of·the·“association·object”·pattern, | 312 | <p>Examples·illustrating·the·usage·of·the·“association·object”·pattern, |
313 | where·an·intermediary·class·mediates·the·relationship·between·two | 313 | where·an·intermediary·class·mediates·the·relationship·between·two |
314 | classes·that·are·associated·in·a·many-to-many·pattern.</p> | 314 | classes·that·are·associated·in·a·many-to-many·pattern.</p> |
315 | <p>Listing·of·files:<ul·class="simple"> | 315 | <p>Listing·of·files:<ul·class="simple"> |
316 | <li><p><p><a·class="reference·external"·href="../_modules/examples/association/basic_association.html">basic_association.py</a>·-·Illustrate·a·many-to-many·relationship·between·an | |
317 | “Order”·and·a·collection·of·“Item”·objects,·associating·a·purchase·price | |
318 | with·each·via·an·association·object·called·“OrderItem”</p> | |
319 | </p></li> | |
320 | <li><p><p><a·class="reference·external"·href="../_modules/examples/association/dict_of_sets_with_default.html">dict_of_sets_with_default.py</a>·-·An·advanced·association·proxy·example·which | 316 | <li><p><p><a·class="reference·external"·href="../_modules/examples/association/dict_of_sets_with_default.html">dict_of_sets_with_default.py</a>·-·An·advanced·association·proxy·example·which |
321 | illustrates·nesting·of·association·proxies·to·produce·multi-level·Python | 317 | illustrates·nesting·of·association·proxies·to·produce·multi-level·Python |
322 | collections,·in·this·case·a·dictionary·with·string·keys·and·sets·of·integers | 318 | collections,·in·this·case·a·dictionary·with·string·keys·and·sets·of·integers |
323 | as·values,·which·conceal·the·underlying·mapped·classes.</p> | 319 | as·values,·which·conceal·the·underlying·mapped·classes.</p> |
324 | </p></li> | 320 | </p></li> |
| 321 | <li><p><p><a·class="reference·external"·href="../_modules/examples/association/basic_association.html">basic_association.py</a>·-·Illustrate·a·many-to-many·relationship·between·an |
| 322 | “Order”·and·a·collection·of·“Item”·objects,·associating·a·purchase·price |
| 323 | with·each·via·an·association·object·called·“OrderItem”</p> |
| 324 | </p></li> |
325 | <li><p><p><a·class="reference·external"·href="../_modules/examples/association/proxied_association.html">proxied_association.py</a>·-·Same·example·as·basic_association,·adding·in | 325 | <li><p><p><a·class="reference·external"·href="../_modules/examples/association/proxied_association.html">proxied_association.py</a>·-·Same·example·as·basic_association,·adding·in |
326 | usage·of·<a·class="reference·internal"·href="extensions/associationproxy.html#module-sqlalchemy.ext.associationproxy"·title="sqlalchemy.ext.associationproxy"><code·class="xref·py·py-mod·docutils·literal·notranslate"><span·class="pre">sqlalchemy.ext.associationproxy</span></code></a>·to·make·explicit·references | 326 | usage·of·<a·class="reference·internal"·href="extensions/associationproxy.html#module-sqlalchemy.ext.associationproxy"·title="sqlalchemy.ext.associationproxy"><code·class="xref·py·py-mod·docutils·literal·notranslate"><span·class="pre">sqlalchemy.ext.associationproxy</span></code></a>·to·make·explicit·references |
327 | to·<code·class="docutils·literal·notranslate"><span·class="pre">OrderItem</span></code>·optional.</p> | 327 | to·<code·class="docutils·literal·notranslate"><span·class="pre">OrderItem</span></code>·optional.</p> |
328 | </p></li> | 328 | </p></li> |
329 | </ul> | 329 | </ul> |
330 | </p> | 330 | </p> |
331 | </section> | 331 | </section> |
332 | <section·id="module-examples.asyncio"> | 332 | <section·id="module-examples.asyncio"> |
333 | <span·id="asyncio-integration"></span><span·id="examples-asyncio"></span><h3>Asyncio·Integration<a·class="headerlink"·href="#module-examples.asyncio"·title="Permalink·to·this·heading">¶</a></h3> | 333 | <span·id="asyncio-integration"></span><span·id="examples-asyncio"></span><h3>Asyncio·Integration<a·class="headerlink"·href="#module-examples.asyncio"·title="Permalink·to·this·heading">¶</a></h3> |
334 | <p>Examples·illustrating·the·asyncio·engine·feature·of·SQLAlchemy.</p> | 334 | <p>Examples·illustrating·the·asyncio·engine·feature·of·SQLAlchemy.</p> |
335 | <p>Listing·of·files:<ul·class="simple"> | 335 | <p>Listing·of·files:<ul·class="simple"> |
336 | <li><p><p><a·class="reference·external"·href="../_modules/examples/asyncio/async_orm.html">async_orm.py</a>·-·Illustrates·use·of·the·sqlalchemy.ext.asyncio.AsyncSession·object | |
337 | for·asynchronous·ORM·use.</p> | |
338 | </p></li> | |
339 | <li><p><p><a·class="reference·external"·href="../_modules/examples/asyncio/greenlet_orm.html">greenlet_orm.py</a>·-·Illustrates·use·of·the·sqlalchemy.ext.asyncio.AsyncSession·object | 336 | <li><p><p><a·class="reference·external"·href="../_modules/examples/asyncio/greenlet_orm.html">greenlet_orm.py</a>·-·Illustrates·use·of·the·sqlalchemy.ext.asyncio.AsyncSession·object |
340 | for·asynchronous·ORM·use,·including·the·optional·run_sync()·method.</p> | 337 | for·asynchronous·ORM·use,·including·the·optional·run_sync()·method.</p> |
341 | </p></li> | 338 | </p></li> |
| 339 | <li><p><p><a·class="reference·external"·href="../_modules/examples/asyncio/async_orm.html">async_orm.py</a>·-·Illustrates·use·of·the·sqlalchemy.ext.asyncio.AsyncSession·object |
| 340 | for·asynchronous·ORM·use.</p> |
| 341 | </p></li> |
342 | <li><p><p><a·class="reference·external"·href="../_modules/examples/asyncio/basic.html">basic.py</a>·-·Illustrates·the·asyncio·engine·/·connection·interface.</p> | 342 | <li><p><p><a·class="reference·external"·href="../_modules/examples/asyncio/basic.html">basic.py</a>·-·Illustrates·the·asyncio·engine·/·connection·interface.</p> |
343 | </p></li> | 343 | </p></li> |
344 | <li><p><p><a·class="reference·external"·href="../_modules/examples/asyncio/gather_orm_statements.html">gather_orm_statements.py</a>·-·Illustrates·how·to·run·many·statements·concurrently·using·<code·class="docutils·literal·notranslate"><span·class="pre">asyncio.gather()</span></code> | 344 | <li><p><p><a·class="reference·external"·href="../_modules/examples/asyncio/gather_orm_statements.html">gather_orm_statements.py</a>·-·Illustrates·how·to·run·many·statements·concurrently·using·<code·class="docutils·literal·notranslate"><span·class="pre">asyncio.gather()</span></code> |
345 | along·many·asyncio·database·connections,·merging·ORM·results·into·a·single | 345 | along·many·asyncio·database·connections,·merging·ORM·results·into·a·single |
346 | <code·class="docutils·literal·notranslate"><span·class="pre">AsyncSession</span></code>.</p> | 346 | <code·class="docutils·literal·notranslate"><span·class="pre">AsyncSession</span></code>.</p> |
347 | </p></li> | 347 | </p></li> |
348 | </ul> | 348 | </ul> |
Offset 392, 29 lines modified | Offset 392, 29 lines modified |
392 | <li><p><p><a·class="reference·external"·href="../_modules/examples/generic_associations/discriminator_on_association.html">discriminator_on_association.py</a>·-·Illustrates·a·mixin·which·provides·a·generic·association | 392 | <li><p><p><a·class="reference·external"·href="../_modules/examples/generic_associations/discriminator_on_association.html">discriminator_on_association.py</a>·-·Illustrates·a·mixin·which·provides·a·generic·association |
393 | using·a·single·target·table·and·a·single·association·table, | 393 | using·a·single·target·table·and·a·single·association·table, |
394 | referred·to·by·all·parent·tables.··The·association·table | 394 | referred·to·by·all·parent·tables.··The·association·table |
395 | contains·a·“discriminator”·column·which·determines·what·type·of | 395 | contains·a·“discriminator”·column·which·determines·what·type·of |
396 | parent·object·associates·to·each·particular·row·in·the·association | 396 | parent·object·associates·to·each·particular·row·in·the·association |
397 | table.</p> | 397 | table.</p> |
398 | </p></li> | 398 | </p></li> |
399 | <li><p><p><a·class="reference·external"·href="../_modules/examples/generic_associations/table_per_related.html">table_per_related.py</a>·-·Illustrates·a·generic·association·which·persists·association | |
400 | objects·within·individual·tables,·each·one·generated·to·persist | |
401 | those·objects·on·behalf·of·a·particular·parent·class.</p> | 399 | <li><p><p><a·class="reference·external"·href="../_modules/examples/generic_associations/table_per_association.html">table_per_association.py</a>·-·Illustrates·a·mixin·which·provides·a·generic·association |
| 400 | via·a·individually·generated·association·tables·for·each·parent·class. |
| 401 | The·associated·objects·themselves·are·persisted·in·a·single·table |
| 402 | shared·among·all·parents.</p> |
402 | </p></li> | 403 | </p></li> |
403 | <li><p><p><a·class="reference·external"·href="../_modules/examples/generic_associations/generic_fk.html">generic_fk.py</a>·-·Illustrates·a·so-called·“generic·foreign·key”,·in·a·similar·fashion | 404 | <li><p><p><a·class="reference·external"·href="../_modules/examples/generic_associations/generic_fk.html">generic_fk.py</a>·-·Illustrates·a·so-called·“generic·foreign·key”,·in·a·similar·fashion |
404 | to·that·of·popular·frameworks·such·as·Django,·ROR,·etc.··This | 405 | to·that·of·popular·frameworks·such·as·Django,·ROR,·etc.··This |
405 | approach·bypasses·standard·referential·integrity | 406 | approach·bypasses·standard·referential·integrity |
406 | practices,·in·that·the·“foreign·key”·column·is·not·actually | 407 | practices,·in·that·the·“foreign·key”·column·is·not·actually |
407 | constrained·to·refer·to·any·particular·table;·instead, | 408 | constrained·to·refer·to·any·particular·table;·instead, |
408 | in-application·logic·is·used·to·determine·which·table·is·referenced.</p> | 409 | in-application·logic·is·used·to·determine·which·table·is·referenced.</p> |
409 | </p></li> | 410 | </p></li> |
410 | <li><p><p><a·class="reference·external"·href="../_modules/examples/generic_associations/table_per_association.html">table_per_association.py</a>·-·Illustrates·a·mixin·which·provides·a·generic·association | 411 | <li><p><p><a·class="reference·external"·href="../_modules/examples/generic_associations/table_per_related.html">table_per_related.py</a>·-·Illustrates·a·generic·association·which·persists·association |
| 412 | objects·within·individual·tables,·each·one·generated·to·persist |
| 413 | those·objects·on·behalf·of·a·particular·parent·class.</p> |
411 | via·a·individually·generated·association·tables·for·each·parent·class. | |
412 | The·associated·objects·themselves·are·persisted·in·a·single·table | |
413 | shared·among·all·parents.</p> | |
414 | </p></li> | 414 | </p></li> |
415 | </ul> | 415 | </ul> |
416 | </p> | 416 | </p> |
417 | </section> | 417 | </section> |
418 | <section·id="module-examples.large_collection"> | 418 | <section·id="module-examples.large_collection"> |
419 | <span·id="large-collections"></span><h3>Large·Collections<a·class="headerlink"·href="#module-examples.large_collection"·title="Permalink·to·this·heading">¶</a></h3> | 419 | <span·id="large-collections"></span><h3>Large·Collections<a·class="headerlink"·href="#module-examples.large_collection"·title="Permalink·to·this·heading">¶</a></h3> |
420 | <p>Large·collection·example.</p> | 420 | <p>Large·collection·example.</p> |
Offset 501, 23 lines modified | Offset 501, 23 lines modified |
501 | <div·class="admonition·seealso"> | 501 | <div·class="admonition·seealso"> |
502 | <p·class="admonition-title">See·also</p> | 502 | <p·class="admonition-title">See·also</p> |
503 | <p><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> | 503 | <p><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> |
504 | </div> | 504 | </div> |
505 | <section·id="file-listing"> | 505 | <section·id="file-listing"> |
506 | <h4>File·Listing<a·class="headerlink"·href="#file-listing"·title="Permalink·to·this·heading">¶</a></h4> | 506 | <h4>File·Listing<a·class="headerlink"·href="#file-listing"·title="Permalink·to·this·heading">¶</a></h4> |
507 | <p>Listing·of·files:<ul·class="simple"> | 507 | <p>Listing·of·files:<ul·class="simple"> |
| 508 | <li><p><p><a·class="reference·external"·href="../_modules/examples/performance/__main__.html">__main__.py</a>·-·Allows·the·examples/performance·package·to·be·run·as·a·script.</p> |
508 | <li><p><p><a·class="reference·external"·href="../_modules/examples/performance/single_inserts.html">single_inserts.py</a>·-·In·this·series·of·tests,·we’re·looking·at·a·method·that·inserts·a·row | |
509 | within·a·distinct·transaction,·and·afterwards·returns·to·essentially·a | |
510 | “closed”·state.···This·would·be·analogous·to·an·API·call·that·starts·up | |
511 | a·database·connection,·inserts·the·row,·commits·and·closes.</p> | |
512 | </p></li> | 509 | </p></li> |
513 | <li><p><p><a·class="reference·external"·href="../_modules/examples/performance/short_selects.html">short_selects.py</a>·-·This·series·of·tests·illustrates·different·ways·to·SELECT·a·single | 510 | <li><p><p><a·class="reference·external"·href="../_modules/examples/performance/short_selects.html">short_selects.py</a>·-·This·series·of·tests·illustrates·different·ways·to·SELECT·a·single |
514 | record·by·primary·key</p> | 511 | record·by·primary·key</p> |
515 | </p></li> | 512 | </p></li> |
516 | <li><p><p><a·class="reference·external"·href="../_modules/examples/performance/__main__.html">__main__.py</a>·-·Allows·the·examples/performance·package·to·be·run·as·a·script.</p> | 513 | <li><p><p><a·class="reference·external"·href="../_modules/examples/performance/single_inserts.html">single_inserts.py</a>·-·In·this·series·of·tests,·we’re·looking·at·a·method·that·inserts·a·row |
| 514 | within·a·distinct·transaction,·and·afterwards·returns·to·essentially·a |
| 515 | “closed”·state.···This·would·be·analogous·to·an·API·call·that·starts·up |
| 516 | a·database·connection,·inserts·the·row,·commits·and·closes.</p> |
517 | </p></li> | 517 | </p></li> |
518 | <li><p><p><a·class="reference·external"·href="../_modules/examples/performance/bulk_inserts.html">bulk_inserts.py</a>·-·This·series·of·tests·illustrates·different·ways·to·INSERT·a·large·number | 518 | <li><p><p><a·class="reference·external"·href="../_modules/examples/performance/bulk_inserts.html">bulk_inserts.py</a>·-·This·series·of·tests·illustrates·different·ways·to·INSERT·a·large·number |
519 | of·rows·in·bulk.</p> | 519 | of·rows·in·bulk.</p> |
520 | </p></li> | 520 | </p></li> |
521 | <li><p><p><a·class="reference·external"·href="../_modules/examples/performance/large_resultsets.html">large_resultsets.py</a>·-·In·this·series·of·tests,·we·are·looking·at·time·to·load·a·large·number | 521 | <li><p><p><a·class="reference·external"·href="../_modules/examples/performance/large_resultsets.html">large_resultsets.py</a>·-·In·this·series·of·tests,·we·are·looking·at·time·to·load·a·large·number |
522 | of·very·small·and·simple·rows.</p> | 522 | of·very·small·and·simple·rows.</p> |
523 | </p></li> | 523 | </p></li> |
Offset 669, 22 lines modified | Offset 669, 22 lines modified |
669 | </section> | 669 | </section> |
670 | <section·id="module-examples.join_conditions"> | 670 | <section·id="module-examples.join_conditions"> |
671 | <span·id="relationship-join-conditions"></span><span·id="examples-relationships"></span><h3>Relationship·Join·Conditions<a·class="headerlink"·href="#module-examples.join_conditions"·title="Permalink·to·this·heading">¶</a></h3> | 671 | <span·id="relationship-join-conditions"></span><span·id="examples-relationships"></span><h3>Relationship·Join·Conditions<a·class="headerlink"·href="#module-examples.join_conditions"·title="Permalink·to·this·heading">¶</a></h3> |
672 | <p>Examples·of·various·<a·class="reference·internal"·href="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>·configurations, | 672 | <p>Examples·of·various·<a·class="reference·internal"·href="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>·configurations, |
673 | which·make·use·of·the·<code·class="docutils·literal·notranslate"><span·class="pre">primaryjoin</span></code>·argument·to·compose·special·types | 673 | which·make·use·of·the·<code·class="docutils·literal·notranslate"><span·class="pre">primaryjoin</span></code>·argument·to·compose·special·types |
674 | of·join·conditions.</p> | 674 | of·join·conditions.</p> |
675 | <p>Listing·of·files:<ul·class="simple"> | 675 | <p>Listing·of·files:<ul·class="simple"> |
676 | <li><p><p><a·class="reference·external"·href="../_modules/examples/join_conditions/threeway.html">threeway.py</a>·-·Illustrate·a·“three·way·join”·-·where·a·primary·table·joins·to·a·remote | |
677 | table·via·an·association·table,·but·then·the·primary·table·also·needs | |
678 | to·refer·to·some·columns·in·the·remote·table·directly.</p> | |
679 | </p></li> | |
680 | <li><p><p><a·class="reference·external"·href="../_modules/examples/join_conditions/cast.html">cast.py</a>·-·Illustrate·a·<a·class="reference·internal"·href="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>·that·joins·two·columns·where·those | 676 | <li><p><p><a·class="reference·external"·href="../_modules/examples/join_conditions/cast.html">cast.py</a>·-·Illustrate·a·<a·class="reference·internal"·href="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>·that·joins·two·columns·where·those |
681 | columns·are·not·of·the·same·type,·and·a·CAST·must·be·used·on·the·SQL | 677 | columns·are·not·of·the·same·type,·and·a·CAST·must·be·used·on·the·SQL |
682 | side·in·order·to·match·them.</p> | 678 | side·in·order·to·match·them.</p> |
683 | </p></li> | 679 | </p></li> |
| 680 | <li><p><p><a·class="reference·external"·href="../_modules/examples/join_conditions/threeway.html">threeway.py</a>·-·Illustrate·a·“three·way·join”·-·where·a·primary·table·joins·to·a·remote |
Max diff block lines reached; 14018/24967 bytes (56.15%) of diff not shown.
|