in legacy databases, you should manually create a field called id for
each table and set it to be a primary key
you need in your model db.py , to set migrate=False for every table
definition

On Jun 3, 11:17 am, hywang <[email protected]> wrote:
> there is a legacy datatable named 'test'
> +-------+--------------+------+-----+---------+-------+
> | Field | Type         | Null | Key | Default | Extra |
> +-------+--------------+------+-----+---------+-------+
> | jtk   | varchar(255) | YES  |     | NULL    |       |
> | age   | int(11)      | YES  |     | 0       |       |
> | dt    | datetime     | YES  |     | NULL    |       |
> +-------+--------------+------+-----+---------+-------+
>
> when select using db().select(db.test.ALL), error occurs :
> OperationalError: (1054, "Unknown column 'test.id' in 'field list'")

Reply via email to