You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since according to the documentation field types are hinted to specific Python objects, it would be great to be able to type hint the result of queries as a specific model with the right types for each property.
user_1: User=db(db.User.id==1).select().first()
# user_2 could automatically be hinted to Useruser_2=db.User(id=2)
group_1.name# currently a Field unless I define `name: str = Field()`
Of course, assigning to Field() can't figure out the right type, but maybe doing name = Field.string() can provide this behavior?
Possibly, this could interfere with Query creation but it would be a really nice feature to have IntelliSense for database rows.
It's just a suggestion, for now I will just use my own subclass of Field:
Since according to the documentation field types are hinted to specific Python objects, it would be great to be able to type hint the result of queries as a specific model with the right types for each property.
Of course, assigning to
Field()
can't figure out the right type, but maybe doingname = Field.string()
can provide this behavior?Possibly, this could interfere with Query creation but it would be a really nice feature to have IntelliSense for database rows.
It's just a suggestion, for now I will just use my own subclass of Field:
The text was updated successfully, but these errors were encountered: