diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-04-23 13:22:02 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-04-23 13:22:35 -0400 |
commit | a7d1fd197c02a3d7101db98070926e0b096882d3 (patch) | |
tree | ae24c0aaf7ce4fc7ac5a273ec25b341eef41a1ae /doc/build/tutorial | |
parent | 5347efa35e3e80c8092501b4adfe1278260d67f5 (diff) | |
download | sqlalchemy-sphinx_mini_build.tar.gz |
remove theme altogethersphinx_mini_build
Change-Id: Iaa5d1ac26007451c09d6982c06d8ad6ed22d30bc
Diffstat (limited to 'doc/build/tutorial')
-rw-r--r-- | doc/build/tutorial/data_insert.rst | 58 | ||||
-rw-r--r-- | doc/build/tutorial/index.rst | 4 | ||||
-rw-r--r-- | doc/build/tutorial/tutorial_nav_include.rst | 3 |
3 files changed, 1 insertions, 64 deletions
diff --git a/doc/build/tutorial/data_insert.rst b/doc/build/tutorial/data_insert.rst index d0f6b236d..651455e73 100644 --- a/doc/build/tutorial/data_insert.rst +++ b/doc/build/tutorial/data_insert.rst @@ -1,4 +1,4 @@ -.. highlight:: pycon+sql + highlight:: pycon+sql .. |prev| replace:: :doc:`data` .. |next| replace:: :doc:`data_select` @@ -157,62 +157,6 @@ method in conjunction with the :class:`_sql.Insert` construct, the will be expressed in the VALUES clause of the :class:`_sql.Insert` construct automatically. -.. deepalchemy:: - - Hi, welcome to the first edition of **Deep Alchemy**. The person on the - left is known as **The Alchemist**, and you'll note they are **not** a wizard, - as the pointy hat is not sticking upwards. The Alchemist comes around to - describe things that are generally **more advanced and/or tricky** and - additionally **not usually needed**, but for whatever reason they feel you - should know about this thing that SQLAlchemy can do. - - In this edition, towards the goal of having some interesting data in the - ``address_table`` as well, below is a more advanced example illustrating - how the :meth:`_sql.Insert.values` method may be used explicitly while at - the same time including for additional VALUES generated from the - parameters. A :term:`scalar subquery` is constructed, making use of the - :func:`_sql.select` construct introduced in the next section, and the - parameters used in the subquery are set up using an explicit bound - parameter name, established using the :func:`_sql.bindparam` construct. - - This is some slightly **deeper** alchemy just so that we can add related - rows without fetching the primary key identifiers from the ``user_table`` - operation into the application. Most Alchemists will simply use the ORM - which takes care of things like this for us. - - .. sourcecode:: pycon+sql - - >>> from sqlalchemy import select, bindparam - >>> scalar_subq = ( - ... select(user_table.c.id) - ... .where(user_table.c.name == bindparam("username")) - ... .scalar_subquery() - ... ) - - >>> with engine.connect() as conn: - ... result = conn.execute( - ... insert(address_table).values(user_id=scalar_subq), - ... [ - ... { - ... "username": "spongebob", - ... "email_address": "spongebob@sqlalchemy.org", - ... }, - ... {"username": "sandy", "email_address": "sandy@sqlalchemy.org"}, - ... {"username": "sandy", "email_address": "sandy@squirrelpower.org"}, - ... ], - ... ) - ... conn.commit() - {execsql}BEGIN (implicit) - INSERT INTO address (user_id, email_address) VALUES ((SELECT user_account.id - FROM user_account - WHERE user_account.name = ?), ?) - [...] [('spongebob', 'spongebob@sqlalchemy.org'), ('sandy', 'sandy@sqlalchemy.org'), - ('sandy', 'sandy@squirrelpower.org')] - COMMIT{stop} - - With that, we have some more interesting data in our tables that we will - make use of in the upcoming sections. - .. tip:: A true "empty" INSERT that inserts only the "defaults" for a table without including any explicit values at all is generated if we indicate :meth:`_sql.Insert.values` with no arguments; not every database backend diff --git a/doc/build/tutorial/index.rst b/doc/build/tutorial/index.rst index ef4bb7634..e9477528f 100644 --- a/doc/build/tutorial/index.rst +++ b/doc/build/tutorial/index.rst @@ -1,10 +1,6 @@ .. |tutorial_title| replace:: SQLAlchemy Unified Tutorial .. |next| replace:: :doc:`engine` -.. footer_topic:: |tutorial_title| - - Next Section: |next| - .. _unified_tutorial: .. rst-class:: orm_core diff --git a/doc/build/tutorial/tutorial_nav_include.rst b/doc/build/tutorial/tutorial_nav_include.rst index c4ee772a8..a6128595a 100644 --- a/doc/build/tutorial/tutorial_nav_include.rst +++ b/doc/build/tutorial/tutorial_nav_include.rst @@ -8,7 +8,4 @@ Previous: |prev| | Next: |next| -.. footer_topic:: |tutorial_title| - - Next Tutorial Section: |next| |