Types and Tab Completion¶
The Piccolo codebase uses type annotations extensively. This means it has great tab completion support in tools like iPython and VSCode.
It also means it works well with type checkers like Mypy.
To learn more about how Piccolo achieves this, read this article about type annotations, and this article about descriptors.
Here are some issues you may encounter when using Mypy, or another type checker.
id column doesn’t exist¶
If you don’t explicitly declare a column on your table with
Piccolo creates a
Serial column for you called
In the following situation, the type checker might complains that
You can fix this as follows:
# tables.py from piccolo.table import Table from piccolo.columns.column_types import Serial, Varchar class Band(Table): id: Serial # Add an annotation name = Varchar()