Like Arun says, I was interested in solving this (or at least a critical subset of this) at the level of dataclasses/attrs since I figure those can be used downstream.

Since the discussion sprung back to life somehow, a progress update: I've started a PR to the attrs plugin with the necessary updates: https://github.com/python/mypy/pull/10467. David Euresti has volunteered to provide feedback while I polish it up and fix the tests. I'm very new to the Mypy codebase so it might be a while though.

On Tue, May 18, 2021 at 4:28 PM Guido van Rossum <guido@python.org> wrote:
If you want that to happen you should probably lobby specific web frameworks (e.g. by starting a discussion in their issue tracker).

On Tue, May 18, 2021 at 06:32 Arun Sharma <arun@sharma-home.net> wrote:

Thank you for bringing this up! I hope popular web frameworks start adopting dataclasses for representing their models and use type safe method chaining APIs to interface with business logic.

On Fri, Apr 23, 2021 at 10:18 AM Tin Tvrtković <tinchester@gmail.com> wrote:


```
from dataclasses import fields

user_projection: tuple[str] = await fetch_projection(User, id=1, fields(User)[1])
```

In fquery [1], this would be spelled as:

UserQuery([1]).project(["username"]).to_json().send()

My request is to consider that some of the implementations may not be presenting a flat result set. For example this query:

       resp = (
            UserQuery([1])
            .edge("friends")
            .edge("friends")
            .project(["name", ":id"])
            .take(3)
            .to_json()
            .send()
        )

Without the "to_json()" it produces a graph of similarly nested python objects.

Type checkers that can understand these queries and provide type safety to consumers of the result set would be a great reason for web frameworks to adopt this vs the status quo where the internals of a relational database are exposed via a python API.

 -Arun
_______________________________________________
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mailman3/lists/typing-sig.python.org/
Member address: guido@python.org
--
--Guido (mobile)