File tree Expand file tree Collapse file tree 1 file changed +5
-20
lines changed
Expand file tree Collapse file tree 1 file changed +5
-20
lines changed Original file line number Diff line number Diff line change @@ -24,12 +24,13 @@ For a full list of columns, see :ref:`ColumnTypes`.
2424-------------------------------------------------------------------------------
2525
2626Primary Key
27- ---------------
27+ -----------
2828
29- You can specify your ``PrimaryKey `` with any column type by passing ``primary_key `` to the ``Column ``.
29+ Piccolo tables are automatically given a primary key column called ``id ``,
30+ which is an auto incrementing integer.
3031
31- It is used to uniquely identify a row, and is referenced by `` ForeignKey ``
32- columns on other tables.
32+ There is currently experimental support for specifying a custom primary key
33+ column. For example:
3334
3435.. code-block :: python
3536
@@ -42,22 +43,6 @@ columns on other tables.
4243 id = UUID(primary_key = True )
4344 name = Varchar(length = 100 )
4445
45- If you don't specify a ``PrimaryKey ``, the table is automatically given a ``PrimaryKey `` column called ``id ``, which
46- is an auto incrementing integer.
47-
48- This is equivalent to:
49-
50- .. code-block :: python
51-
52- # tables.py
53- from piccolo.table import Table
54- from piccolo.columns import Serial, Varchar
55-
56-
57- class Band (Table ):
58- id = Serial(primary_key = True )
59- name = Varchar(length = 100 )
60-
6146-------------------------------------------------------------------------------
6247
6348Tablename
You can’t perform that action at this time.
0 commit comments