Comments (2)
prisma/schema.prisma
generator client {
provider = "prisma-client-py"
interface = "asyncio"
recursive_type_depth = "5"
partial_type_generator = "prisma/partial_types.py"
}
model User {
id Int @id @default(autoincrement())
name String @db.VarChar(30)
age Float
password String
country String
}
Run prisma generate
prisma/partial_types.py
from prisma.models import User
User.create_partial('UserWithName', include={'name'})
db.py or any where prisma client is intialize
import prisma
from prisma import Prisma
prisma_client: Prisma = Prisma()
prisma.register(prisma_client)
Run prisma generate
# Use of Partial Type
from prisma.partials import UserWithName
user = await UserWithName.prisma().find_first(
where={
'country': 'Scotland',
},
)
print(user.name)
print(user.id) # error `id` does not exist on the `UserWithName` type
Partial Types - Prisma Client Python (prisma-client-py.readthedocs.io)
Selecting Fields - Prisma Client Python (prisma-client-py.readthedocs.io)
from prisma-client-py.
I know you have to use the partial type for this, but I suggest making it less abstract by adding the select
which only exists on the Prisma JS library, by dint of which I was a bit disgusted not to have the select and preferred to code directly with the prismaJS library.
from prisma-client-py.
Related Issues (20)
- When generator client output is set, `prisma db push` fails with Permission Denied
- Is there a way to override use_enum_values?
- `prisma db push` does not work
- v0.13.0 - ImportError: cannot import name 'AbstractEngine' from 'prisma.engine' HOT 4
- Oracle Database not support like alchemy HOT 1
- Oracle not support HOT 1
- httpx.ConnectError: [Errno 111] Connection refused HOT 3
- RuntimeError('Event loop is closed') HOT 2
- schema.prisma on custom path HOT 3
- Bump Prisma version to latest 5.12.1
- Client extension support HOT 2
- Not working with non-ASCII paths in Windows HOT 3
- prisma generate on binary in venv generates js client instead? HOT 2
- Error: spawn prisma-client-py ENOENT}
- Allow to use Pydantic aliases for column names that shadow BaseModel attributes
- prisma.errors.FieldNotFoundError Error when creating item with nested item.
- Add support for a create_many_and_return method
- Audit Logs ? What is the best way to implement them
- feat(prisma): upgrade to v5.15.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prisma-client-py.