Skip to content

Are typing errors in fastapi/starlite templates normal ? #709

Answered by dantownsend
StitiFatah asked this question in Q&A
Discussion options

You must be logged in to vote

I get Cannot access member "id" for type "Type[Task]" Member "id" is unknown , Is that because id isn't manually specified on the Table ? Why does the auto completion works fine in ipython ?

If a primary key isn't manually specified then Piccolo automatically adds id.

To fix this type error, you can add this to your table class:

from piccolo.columns.column_types import Serial

class MyTable(Table):
    id: Serial
    ...

I also get Expression of type "Any | list[Table] | Table | Unknown | str | list[Unknown]" cannot be assigned to return type "List[Task]" is unknown` for tasks. Is that intended and should we use typing.cast for the moment ?

Piccolo's select query returns a list of dic…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@StitiFatah
Comment options

@dantownsend
Comment options

Answer selected by StitiFatah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants