One to Many =========== The one to many relationship is similar to the may to one relationship except that the role of the child and parent is swapped. .. seealso:: :ref:`one-to-many` OpenAlchemy documentation for one to many relationships. `SQLAlchemy One to Many `_ SQLAlchemy documentation for one to many relationships. The following example defines a one to many relationship between *Employee* and *Division*: .. literalinclude:: ../../../../examples/relationship/one_to_many/example-spec.yml :language: yaml :linenos: The following file uses OpenAlchemy to generate the SQLAlchemy models: .. literalinclude:: ../../../../examples/relationship/one_to_many/models.py :language: python :linenos: The SQLAlchemy models generated by OpenAlchemy are equivalent to the following traditional models file: .. literalinclude:: ../../../../examples/relationship/one_to_many/models_traditional.py :language: python :linenos: OpenAlchemy will generate the following typed models: .. literalinclude:: ../../../../examples/relationship/one_to_many/models_auto.py :language: python :linenos: