Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
probablyrobert
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
7 ms
·
31.
▲
by
probablyrobert
5y ago
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.
32.
▲
by
probablyrobert
5y ago
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
33.
▲
by
probablyrobert
5y ago
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 = "
34.
▲
by
probablyrobert
5y ago
Thank you! I hope so too, it would be incredibly helpful.
35.
▲
by
probablyrobert
5y ago
Yes it is rather unfortunate, Python's typing system doesn't support dynamically creating types like you can in TypeScript :/
36.
▲
by
probablyrobert
5y ago
Yes it is similar to SQLModel however as SQLModel is based off of SQLAlchemy, the query API is not typed. That is the difference.
37.
▲
by
probablyrobert
5y ago
Yes it is fully typed because of TypedDicts, https://docs.python.org/3/library/typing.html#typing.TypedDi... SQLAlchemy on the other hand provides very little (if any) type hints for their query API.
38.
▲
by
probablyrobert
5y ago
You are correct, we use code generation to define the query API types.
39.
▲
by
probablyrobert
5y ago
Thanks for the feedback, I will add that. > Prisma Python I originally decided to go with Prisma Client Python however I found this to be too verbose and have recently used Prisma Python. I do need to decide on one and stick with that. T
40.
▲
by
probablyrobert
5y ago
Thanks :) Yeah that is understandable, it is being successfully used in production but it is safer to use a more stable ORM for mission critical products. If you don't want to have to duplicate your model definitions you could write a
41.
▲
by
probablyrobert
5y ago
ORM stands for Object Relational Mapper and is essentially a wrapper over raw SQL queries to provide an easier to use interface.
42.
▲
by
probablyrobert
5y ago
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
43.
▲
by
probablyrobert
5y ago
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: - Com
44.
▲
by
probablyrobert
5y ago
Good point, I'll update it, thanks!
45.
▲
Show HN: Prisma Python – A fully typed ORM for Python
(github.com)
130 points
by
probablyrobert
5y ago
|
87 comments
46.
▲
by
probablyrobert
5y ago
Full disclosure, I am the creator of this project. Happy to answer any questions!
47.
▲
Type safe database access for Python – Prisma Client Python
(github.com)
4 points
by
probablyrobert
5y ago
|
1 comments
48.
▲
by
probablyrobert
5y ago
Full disclosure - I am also the creator of this package. Happy to answer any questions!
49.
▲
Type safe ORM for Python – Prisma Client
(github.com)
3 points
by
probablyrobert
5y ago
|
1 comments