Live data from Hacker News

Show HN: Prisma Python – A fully typed ORM for Python

github.com

41–50 of 91 posts

Re: Show HN: Prisma Python – A fully typed ORM for Python

#41
post #31

Earlier quoted context omitted.

Because Prisma Python currently interfaces with the Rust engine over HTTP (I am looking into changing this) and the Rust engines can be found here: https://github.com/prisma/prisma-engines

Given the state of PyPi these days and third party packages, I would just prefer to have pure python, even if it is slower. It means I don't have to worry about things breaking on cross compilation between mac/windows/linux.

No need to worry, the current behaviour will be preserved :)

The method used to interface with the internal engine will be able to be configured in the schema: https://www.prisma.io/docs/reference/api-reference/prisma-sc...

Re: Show HN: Prisma Python – A fully typed ORM for Python

#42

Earlier quoted context omitted.

I haven't written benchmarks yet but it is something I am working on. The reason that performance is mentioned in the README is that I haven't spent time on improving it yet. The biggest blockers in terms of performance are: - Communication with the internal Rust engine is performed over HTTP instead of FFI. - You cannot select a subset of fields (every scalar field in a model is selected) - You cannot skip pydantic…

What is the Rust engine doing here? How come GitHub doesn't highlight any Rust code in the project repo?

Prisma uses rust for two main reasons from what I understand. 1) to keep the engine portable and maximize code reuse, to make projects like this Python adapter possible for example 2) under the hood Primsa does not use joins. It does a waterfall of queries (but not n+1), then stitches the data together in memory, which happens in the rust engine for performance reasons

Re: Show HN: Prisma Python – A fully typed ORM for Python

#43

Earlier quoted context omitted.

Maybes mapped types are an example? https://www.typescriptlang.org/docs/handbook/2/mapped-types....

Yes mapped types is a good example, Pick is also a good example: https://www.typescriptlang.org/docs/handbook/utility-types.h...

Ah, I read "dynamic" as implying something at runtime. I agree that these are extremely useful.

Re: Show HN: Prisma Python – A fully typed ORM for Python

#44
post #27

@propbablyrobert great job on this! I hope you can get buy-in from the Prisma team for support. This would be great for their moat.

Thank you! I hope so too, it would be incredibly helpful.

This is really cool!

We (Prisma) would love to support this project in any way we can. You can find my email in bio if you are interested in a call :-)

Re: Show HN: Prisma Python – A fully typed ORM for Python

#48
post #22

Seems to solve the same problem as SQLModel. From [1]: "SQLModel is a library for interacting with SQL databases from Python code, with Python objects. It is designed to be intuitive, easy to use, highly compatible, and robust. SQLModel is based on Python type annotations, and powered by Pydantic and SQLAlchemy." [1] https://sqlmodel.tiangolo.com/

Yes it is similar to SQLModel however as SQLModel is based off of SQLAlchemy, the query API is not typed. That is the difference.

My understanding is that this is exactly what SQLModel adds on top of SQLAlchemy.

statement = select(Hero).where(Hero.age > 32).limit(3)

But I am only halfway through the tutorial so I might be wrong.

HN discussion of SQLModel here [1]

[1] https://news.ycombinator.com/item?id=28294534

Re: Show HN: Prisma Python – A fully typed ORM for Python

#49

Nice! I opened a feature request for it already and shared with our Python community.

Thank you for sharing! It is much appreciated!

Also, the ticket I opened was promptly replied to and politely closed. This is actually an issue already open under this ticket:

https://github.com/prisma/prisma/issues/2879

Re: Show HN: Prisma Python – A fully typed ORM for Python

#50
post #22

Seems to solve the same problem as SQLModel. From [1]: "SQLModel is a library for interacting with SQL databases from Python code, with Python objects. It is designed to be intuitive, easy to use, highly compatible, and robust. SQLModel is based on Python type annotations, and powered by Pydantic and SQLAlchemy." [1] https://sqlmodel.tiangolo.com/

Yes it is similar to SQLModel however as SQLModel is based off of SQLAlchemy, the query API is not typed. That is the difference.

AFAIK SQLAlchemy 2.0 (coming soon?) will use a new system for full typing.
Post reply on HN