Giter Club home page Giter Club logo

Comments (4)

RobertCraigie avatar RobertCraigie commented on May 22, 2024

As the internal query engine is asynchronous I do not know how this feature would be properly implemented for the synchronous client.

The naive solution is to simply use something like loop.run_until_complete() however I don't know what side effects this could cause or it's limitations.

from prisma-client-py.

RobertCraigie avatar RobertCraigie commented on May 22, 2024

One possible solution for the synchronous client could be to create a future and use polling. However I don't know if this would work as AFAIK asyncio requires a running event loop for any futures to be completed, however as we would be running the coroutines in a tokio event loop, this might actually be possible.

More research is needed.

Pseudo code:

def connect(self) -> None:
    future = engine.connect()
    if isinstance(future, asyncio.Future):
        while not future.done():
            time.sleep(0.001)

        exc = future.exception()
        if exc is not None:
            raise exc

EDIT: this does not work, there needs to be a running loop on the asyncio side

from prisma-client-py.

RobertCraigie avatar RobertCraigie commented on May 22, 2024

Found a good solution, implement synchronous rust functions that call the asynchronous rust functions.

from prisma-client-py.

RobertCraigie avatar RobertCraigie commented on May 22, 2024

Maybe worth looking into: https://github.com/axodotdev/cargo-dist for building binaries

from prisma-client-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.