RobertCraigie / prisma-client-py

Prisma Client Python is an auto-generated and fully type-safe database client designed for ease of use
https://prisma-client-py.readthedocs.io
Apache License 2.0
1.85k stars 81 forks source link

Improve editor experience #51

Open RobertCraigie opened 3 years ago

RobertCraigie commented 3 years ago

Problem

One of the biggest reasons for using an ORM is the autocomplete value that it provides, currently all of our query arguments will not be autocompleted, this is an issue as it greatly decreases user experience.

Users can only see what arguments are required when constructing the dictionary and will have to jump to the definition to get the full list of arguments.

Suggested solution

This is a tracking issue as the solution for this can only be implemented outside of this repository.

List of language servers / editor extensions that should support this:

Alternatives

I did consider refactoring the entire client API (#7) however I've decided against this as the current API is very unique to prisma and in my opinion makes complicated queries more readable than other ORMs such as SQLAlchemy.

RobertCraigie commented 3 years ago

Another aspect that should be auto completed is literal values, for example:

posts = await client.post.find_many(
    order={
        'created_at': '.',
    },
)

Should autocomplete with ['asc', 'desc']

RobertCraigie commented 3 years ago

Created a PR for pyright!

https://github.com/microsoft/pyright/pull/2334

RobertCraigie commented 2 years ago

For reference, the pydantic pycharm plugin could be helpful when building a pycharm plugin.

matyasrichter commented 2 years ago

I'd just like to link relevant YouTrack tickets here, for visibility. I have to admit that the lack of support for TypedDict in PyCharm is pretty much a blocker for using prisma-client-py in one of our projects. Sadly, it doesn't seem to be a priority for JetBrains. If I may, I'd like to urge anyone reading this to leave a :+1: on each of the tickets.