Chris Grimm
Chris Grimm
PPrisma
Created by Chris Grimm on 5/19/2024 in #help-and-questions
Question about explicit many to many table
super noob question. i'm using the python client and have the following table setup: model annotators { id Int @id @default(autoincrement()) username String @unique @db.VarChar(150) experiments_annotators experiments_annotators[] } model experiments { id Int @id @default(autoincrement()) name String @unique @db.VarChar(128) experiments_annotators experiments_annotators[] } model experiments_annotators { experiments_id Int experiments experiments @relation(fields: [experiments_id], references: [id]) annotators_id Int annotators annotators @relation(fields: [annotators_id], references: [id]) @@id([experiments_id, annotators_id]) } i'm trying to grab an annotator with a particular username and, in the same query, get the experiment with a particular name. i'm running the following query: result = await client.annotators.find_first_or_raise( where={ 'username': username, 'password': password, }, include={ 'experiments_annotators': { 'include': { 'experiments': { 'where': { 'name': 'test-experiment' } } } but i'm getting a type error when i try to query the name of the experiments. am i doing something wrong?
4 replies