Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwjfy committed Aug 26, 2018
1 parent cf73072 commit 31a3878
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/schema.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,19 @@ more declarative. Instead of ``users.c.name``, you can now access the column by
available at ``User.__table__`` and ``Address.__table__``. You can use anything
that works in GINO core here.

.. note::

Column names can be different as a class property and database column.
For example, name can be declared as
``nickname = db.Column('name', db.Unicode(), default='noname')``. In this
example, ``User.nickname`` is used to access the column, while in database,
the column name is ``name``.

What's worth mentioning is where raw SQL statements are used, or
``TableClause`` is involved, like ``User.insert()``, the original name is
required to be used, because in this case, GINO has no knowledge about the
mappings.

.. tip::

``db.Model`` is a dynamically created parent class for your models. It is
Expand Down

0 comments on commit 31a3878

Please sign in to comment.