Skip to content

Commit

Permalink
fix: broken sample code on 'SQLAlchemy Repository Tutorial' (#3405)
Browse files Browse the repository at this point in the history
fix: broken sample code.
  • Loading branch information
maintain0404 authored Apr 19, 2024
1 parent 7ac2bef commit c2bd634
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/tutorials/repository-tutorial/01-modeling-and-features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ to make working with models easier.

.. tip:: The full code for this tutorial can be found below in the :ref:`Full Code <01-repo-full-code>` section.

.. literalinclude:: /examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py
:language: python
:caption: app.py
:lines: 9,18,19,20
:linenos:

Modeling
--------

Expand All @@ -21,6 +15,12 @@ We'll start by creating the ``Author`` table, utilizing the
:class:`UUIDBase <advanced_alchemy.base.UUIDBase>` class. To keep things
simple, our first model will encompass only three fields: ``id``, ``name``, and ``dob``.

.. literalinclude:: /examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py
:language: python
:caption: app.py
:lines: 9,11,18,19,20
:linenos:

The book entity is not considered a "strong" entity and therefore always requires an
author to be created. We need to configure our SQLAlchemy classes so that it is aware
of this relationship. We will extend the ``Author`` model by incorporating a ``Book``
Expand All @@ -31,7 +31,7 @@ key constraints when using the ``author_id`` field in each ``Book`` record.
.. literalinclude:: /examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py
:language: python
:caption: app.py
:lines: 9,21,27,28,29,30
:lines: 9,11,18,19,20,21,22,27,28,29,30
:linenos:

By using the audit model, we can automatically record the time a record was created and
Expand Down

0 comments on commit c2bd634

Please sign in to comment.