Live data from Hacker News

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

github.com

61–70 of 91 posts

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

#61

Earlier quoted context omitted.

You can create Python types at runtime, and Python’s runtime type checking features predate it's static analyzers. Unfortunately, the additional kinds of objects used for typechecking in the static analyzers (beyond those which are also runtime types) don’t work with runtime type checking, nor do static type declarations (even using types that are also runtime types.) (And, obviously, AOT static analyzers can’t make…

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…

Python also offers structural typing, which is both dynamic and mypy-compatible.

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

#62

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

That's great.

I think it makes it such an easy onramp to integrate with something by having HTTP based APIs (or really, gRPC, even) even if it is lower performance compared to native libraries.

Looking forward to trying this.

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

#64

How is this DSL acceptable? posts = await client.post.find_many( where={ 'OR': [ {'title': {'contains': 'prisma'}}, {'content': {'contains': 'prisma'}}, ] } ) SQL for comparison: ... where title like '%prisma%' or content like '%prisma%'

Now try filtering on a relation!

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

#65

How is this DSL acceptable? posts = await client.post.find_many( where={ 'OR': [ {'title': {'contains': 'prisma'}}, {'content': {'contains': 'prisma'}}, ] } ) SQL for comparison: ... where title like '%prisma%' or content like '%prisma%'

How do you suggest to improve it?

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

#66

How is this DSL acceptable? posts = await client.post.find_many( where={ 'OR': [ {'title': {'contains': 'prisma'}}, {'content': {'contains': 'prisma'}}, ] } ) SQL for comparison: ... where title like '%prisma%' or content like '%prisma%'

Now try filtering on a relation!

I find the relational API very easy and intuitive to work with. What do you not like about it?

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

#67

How is this DSL acceptable? posts = await client.post.find_many( where={ 'OR': [ {'title': {'contains': 'prisma'}}, {'content': {'contains': 'prisma'}}, ] } ) SQL for comparison: ... where title like '%prisma%' or content like '%prisma%'

How do you suggest to improve it?

I think the parent is saying that the SQL example is simpler and easier to read.

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

#68

Earlier quoted context omitted.

Now try filtering on a relation!

I find the relational API very easy and intuitive to work with. What do you not like about it?

So do I - the parent is choosing to compare the most basic example which didn't show the benefits of using an orm over raw sql

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

#69

Earlier quoted context omitted.

I find the relational API very easy and intuitive to work with. What do you not like about it?

So do I - the parent is choosing to compare the most basic example which didn't show the benefits of using an orm over raw sql

Ah sorry I misread your comment, I thought you were agreeing and saying that filtering by a relational field is also unacceptable DSL.

Thank you :)

Post reply on HN