Live data from Hacker News

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

github.com

31–40 of 91 posts

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

#31

Earlier quoted context omitted.

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

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.

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

#32

Earlier quoted context omitted.

Exactly, it’a brilliant that they designed a system where the annotations themselves can be dynamic and read at runtime, it has so much potential for interesting things. But MyPy completely hobbles it by preventing all the dynamic potential, even if MyPy had an escape hatch to say ignore anything derived from this type as it’s not possible to describe statically that would be better than nothing. It unfortunately lea…

There is actually an escape hatch you can use, although it is a bit clunky: ```py from typing import TYPE_CHECKING if TYPE_CHECKING: Foo = "expression that mypy can understand" else: Foo = "dynamic expression" ```

Somehow in all my searching the other day I missed that, thanks!

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

#33
A comment from a previous Prisma post

> under the hood @prisma/client was spinning up it's own GraphQL server that it would send requests to in order to generate SQL to send to postgres[1]

So is this the same approach you are taking with the HTTP API?

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

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

#34
I use Prisma typescript daily and love it. It's fast to write complex queries and readable joins. The type hints are well documented and custom generated for your models and relationships.

It would be great if Prisma could support yet more languages! It's a great product.

That said, I would not have two backends sharing the same database, even if one is the master that runs migrations. A component should only have one reason to change.

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

#36
I use Prisma and it’s far from perfect but what I love about it is you can introspect a legacy database and generate a Prisma schema, and use the database as the source of truth. You’re not tied to a 1:1 relationship between classes and tables, and the correctness of the types do not depend on tediously annotating code correctly. Excited to see more languages supported!

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

#37

A comment from a previous Prisma post > under the hood @prisma/client was spinning up it's own GraphQL server that it would send requests to in order to generate SQL to send to postgres[1] So is this the same approach you are taking with the HTTP API? [1] https://news.ycombinator.com/item?id=26889543

Yes I am using the same approach however I am working on using native FFI bindings which is what the TypeScript client is using now.

https://github.com/RobertCraigie/prisma-client-py/pull/165

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

#38

Earlier quoted context omitted.

Yes it is rather unfortunate, Python's typing system doesn't support dynamically creating types like you can in TypeScript :/

> dynamically creating types Could you explain what you mean by this? I'm not clear on what typescript behavior this describes.

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

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

#39

I use Prisma typescript daily and love it. It's fast to write complex queries and readable joins. The type hints are well documented and custom generated for your models and relationships. It would be great if Prisma could support yet more languages! It's a great product. That said, I would not have two backends sharing the same database, even if one is the master that runs migrations. A component should only have on…

Yeah, sharing the same database between two backends would not be a good idea. That said you do not have to use the TypeScript client at the same time as the Python client, they are independent of each other.

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

#40

Earlier quoted context omitted.

> dynamically creating types Could you explain what you mean by this? I'm not clear on what typescript behavior this describes.

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...

Post reply on HN