prisma-client-py icon indicating copy to clipboard operation
prisma-client-py copied to clipboard

Generate Async and Sync client together at the same time

Open Gnosnay opened this issue 1 year ago • 2 comments

Problem

In my project, i mixed sync and async operations together, so i have to use sync and async in the same project but not in the same context.

Suggested solution

Shall we just generate sync and async clients together?

Alternatives

for now i write two generator, and generate clients to different position. but the problem here

  1. i have to commit the code along with code, which a little bit annoying
  2. partial types feature does work anymore. because it share the same context between prisma cli and generated python model.

Additional context

Gnosnay avatar Jan 18 '24 07:01 Gnosnay

hi i am willing to contribute this feature. would you mind giving me some instruction about how to involve it? thank you!

Gnosnay avatar Jan 20 '24 14:01 Gnosnay

I appreciate it @Gnosnay! Unfortunately I think this feature isn't feasible for an external contributor that is new to this codebase as it requires a deep refactor of a large part of this library.

I have started on this refactor in https://github.com/RobertCraigie/prisma-client-py/pull/873 :)

Current TODOs:

  • [ ] Figure out structure for Model.prisma()
  • [ ] Figure out structure for registering clients
  • [ ] Generate separate sync / async actions classes
  • [x] Define separate sync / async transaction managers
  • [ ] Generate separate sync / async batch actions classes

RobertCraigie avatar Jan 21 '24 15:01 RobertCraigie