Skip to content

Commit 31a3878

Browse files
committed
add docs
1 parent cf73072 commit 31a3878

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/schema.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,19 @@ more declarative. Instead of ``users.c.name``, you can now access the column by
197197
available at ``User.__table__`` and ``Address.__table__``. You can use anything
198198
that works in GINO core here.
199199

200+
.. note::
201+
202+
Column names can be different as a class property and database column.
203+
For example, name can be declared as
204+
``nickname = db.Column('name', db.Unicode(), default='noname')``. In this
205+
example, ``User.nickname`` is used to access the column, while in database,
206+
the column name is ``name``.
207+
208+
What's worth mentioning is where raw SQL statements are used, or
209+
``TableClause`` is involved, like ``User.insert()``, the original name is
210+
required to be used, because in this case, GINO has no knowledge about the
211+
mappings.
212+
200213
.. tip::
201214

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

0 commit comments

Comments
 (0)