diff options
| author | jonathan vanasco <jonathan@2xlp.com> | 2021-08-23 16:25:21 -0400 |
|---|---|---|
| committer | jonathan vanasco <jonathan@2xlp.com> | 2021-08-23 16:25:21 -0400 |
| commit | 369edbbd674c2dcdc121072a20b3f9d259f9ee91 (patch) | |
| tree | 92c8f145ce641e8170a48e900c54e2eac22be42d /doc/build/tutorial | |
| parent | 207ec35c2e175f5fcf68e886d5e61a0678c2d6fc (diff) | |
| download | sqlalchemy-369edbbd674c2dcdc121072a20b3f9d259f9ee91.tar.gz | |
standardizing docs #6821
(redo of 2999/I5609025feee8cfdecc09b55bfbf1bd13fa2e6602)
This PR is designed to bring more clarity within the docs by renaming object
instances that may be consfusingly similar to class, method, and attribute names.
For example, instances of the class `MetaData` are available on some objects as
`.metadata` property, and had appeared within the docs as both `meta` and
`metadata` which has confused some users in the past. By this PR, the docs now
utilize the following naming convention:
* MetaData - SQLAlchemy class
* .metadata - SQLAlchemy API attributes
* metadata_obj - developer instantiated metadata objects or references
Detailed Changes:
* standardized `meta` and `metadata` instances to `metadata_obj`. note: the docs were evenly split between 'meta' and 'metadata'.
* standardized 'cursor' to 'cursor_obj' to avoid confusion with the method.
* standardized a 'scalar_subquery = ' to 'scalar_subq' to avoid confusion with the method.
* standardized a 'cte = ' to 'cte_obj' to avoid confusion with the method
Change-Id: I79c98aee16c5fc6649289b2dd7d6dfc368222fb4
Diffstat (limited to 'doc/build/tutorial')
| -rw-r--r-- | doc/build/tutorial/data_insert.rst | 4 | ||||
| -rw-r--r-- | doc/build/tutorial/data_select.rst | 4 | ||||
| -rw-r--r-- | doc/build/tutorial/metadata.rst | 10 |
3 files changed, 9 insertions, 9 deletions
diff --git a/doc/build/tutorial/data_insert.rst b/doc/build/tutorial/data_insert.rst index 1fba351b8..14d7237fb 100644 --- a/doc/build/tutorial/data_insert.rst +++ b/doc/build/tutorial/data_insert.rst @@ -165,7 +165,7 @@ construct automatically. .. sourcecode:: pycon+sql >>> from sqlalchemy import select, bindparam - >>> scalar_subquery = ( + >>> scalar_subq = ( ... select(user_table.c.id). ... where(user_table.c.name==bindparam('username')). ... scalar_subquery() @@ -173,7 +173,7 @@ construct automatically. >>> with engine.connect() as conn: ... result = conn.execute( - ... insert(address_table).values(user_id=scalar_subquery), + ... insert(address_table).values(user_id=scalar_subq), ... [ ... {"username": 'spongebob', "email_address": "spongebob@sqlalchemy.org"}, ... {"username": 'sandy', "email_address": "sandy@sqlalchemy.org"}, diff --git a/doc/build/tutorial/data_select.rst b/doc/build/tutorial/data_select.rst index bcd533cc6..6ff47087c 100644 --- a/doc/build/tutorial/data_select.rst +++ b/doc/build/tutorial/data_select.rst @@ -903,8 +903,8 @@ Another example follows, which is exactly the same except it makes use of the .. sourcecode:: python+sql - >>> cte = select(Address).where(~Address.email_address.like('%@aol.com')).cte() - >>> address_cte = aliased(Address, cte) + >>> cte_obj = select(Address).where(~Address.email_address.like('%@aol.com')).cte() + >>> address_cte = aliased(Address, cte_obj) >>> stmt = select(User, address_cte).join_from(User, address_cte).order_by(User.id, address_cte.id) >>> with Session(engine) as session: ... for user, address in session.execute(stmt): diff --git a/doc/build/tutorial/metadata.rst b/doc/build/tutorial/metadata.rst index 8dc63bdea..24284c4aa 100644 --- a/doc/build/tutorial/metadata.rst +++ b/doc/build/tutorial/metadata.rst @@ -54,7 +54,7 @@ that stores a series of :class:`_schema.Table` objects keyed to their string name. Constructing this object looks like:: >>> from sqlalchemy import MetaData - >>> metadata = MetaData() + >>> metadata_obj = MetaData() Having a single :class:`_schema.MetaData` object for an entire application is the most common case, represented as a module-level variable in a single place @@ -75,7 +75,7 @@ that will be how we will refer to the table in application code:: >>> from sqlalchemy import Table, Column, Integer, String >>> user_table = Table( ... "user_account", - ... metadata, + ... metadata_obj, ... Column('id', Integer, primary_key=True), ... Column('name', String(30)), ... Column('fullname', String) @@ -150,7 +150,7 @@ table:: >>> from sqlalchemy import ForeignKey >>> address_table = Table( ... "address", - ... metadata, + ... metadata_obj, ... Column('id', Integer, primary_key=True), ... Column('user_id', ForeignKey('user_account.id'), nullable=False), ... Column('email_address', String, nullable=False) @@ -193,7 +193,7 @@ sending it the :class:`_future.Engine` that refers to the target database: .. sourcecode:: pycon+sql - >>> metadata.create_all(engine) + >>> metadata_obj.create_all(engine) {opensql}BEGIN (implicit) PRAGMA main.table_...info("user_account") ... @@ -499,7 +499,7 @@ using the :paramref:`_schema.Table.autoload_with` parameter: .. sourcecode:: pycon+sql - >>> some_table = Table("some_table", metadata, autoload_with=engine) + >>> some_table = Table("some_table", metadata_obj, autoload_with=engine) {opensql}BEGIN (implicit) PRAGMA main.table_...info("some_table") [raw sql] () |
