Single_inserts.py - In this series of tests, we’re looking at a method that inserts a row Short_selects.py - This series of tests illustrates different ways to SELECT a single Large_resultsets.py - In this series of tests, we are looking at time to load a large numberīulk_inserts.py - This series of tests illustrates different ways to INSERT a large number Of rows in bulk (under construction! there’s just one test at the moment) How can I profile a SQLAlchemy powered application? File Listing ¶īulk_updates.py - This series of tests will illustrate different ways to UPDATE a large number Greatest to least (these two things generally correspond perfectly).Ī command line tool is presented at the package level which allows To greatest, inversely based on amount of functionality provided by SQLAlchemy, Individual inserts, with or without transactionsĪll suites include a variety of use patterns illustrating both CoreĪnd ORM use, and are generally sorted in order of performance from worst Nested_sets.py - Celko’s “Nested Sets” Tree Structure.Ī performance profiling suite for a variety of SQLAlchemy use cases.Įach suite focuses on a specific use case with a particular performance Pattern for hierarchical data using the SQLAlchemy ORM. Illustrates a rudimentary way to implement the “nested sets” Materialized_paths.py - Illustrates the “materialized paths” pattern. Illustrates the “materialized paths” pattern for hierarchical data using the In-application logic is used to determine which table is referenced. Practices, in that the “foreign key” column is not actuallyĬonstrained to refer to any particular table instead, ThisĪpproach bypasses standard referential integrity To that of popular frameworks such as Django, ROR, etc. Generic_fk.py - Illustrates a so-called “generic foreign key”, in a similar fashion Parent object associates to each particular row in the association The association tableĬontains a “discriminator” column which determines what type of Using a single target table and a single association table, Those objects on behalf of a particular parent class.ĭiscriminator_on_association.py - Illustrates a mixin which provides a generic association Objects within individual tables, each one generated to persist Table_per_related.py - Illustrates a generic association which persists association The associated objects themselves are persisted in a single table Via a individually generated association tables for each parent class. Table_per_association.py - Illustrates a mixin which provides a generic association Polymorphic Associations with SQLAlchemy. The discriminator_on_association.py and generic_fk.py scriptsĪre modernized versions of recipes presented in the 2007 blog post Parent class is provided with an addresses collection Subclassing the HasAddresses mixin, which ensures that the Each one presents the identical useĬase at the end - two classes, Customer and Supplier, both The examples all use the declarative extension along withĭeclarative mixins. Illustrates various methods of associating multiple types of String keys) can operate upon a large collection without loading the “dynamic” relation, so that dictionary operations (assuming simple Illustrates how to place a dictionary-like facade on top of a Basic persistenceĪnd querying for lower- and upper- neighbors are illustrated: “lower” and an “upper” node in a table of nodes. Graph is stored as a collection of edges, each referencing both a Greenlet_orm.py - Illustrates use of the objectįor asynchronous ORM use, including the optional run_sync() method.Īn example of persistence for a directed graph structure. Gather_orm_statements.py - Illustrates how to run many statements concurrently using asyncio.gather()Īlong many asyncio database connections, merging ORM results into a singleīasic.py - Illustrates the asyncio engine / connection interface. Illustrates nesting of association proxies to produce multi-level PythonĬollections, in this case a dictionary with string keys and sets of integersĪs values, which conceal the underlying mapped classes.Įxamples illustrating the asyncio engine feature of SQLAlchemy.Īsync_orm.py - Illustrates use of the objectĪsync_orm_writeonly.py - Illustrates using write only relationships for simpler handling With each via an association object called “OrderItem”ĭict_of_sets_with_default.py - An advanced association proxy example which “Order” and a collection of “Item” objects, associating a purchase price Usage of to make explicit referencesīasic_association.py - Illustrate a many-to-many relationship between an Proxied_association.py - Same example as basic_association, adding in Where an intermediary class mediates the relationship between twoĬlasses that are associated in a many-to-many pattern. commit () dump_tree ( node )Įxamples illustrating the usage of the “association object” pattern,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |