Ian
06/24/2021, 10:00 AMAhmar Suhail
06/24/2021, 10:40 AMTimed out fetching a new connection from the connection pool
. I have a couple of q’s around this:
• Is this error only thrown when prisma client tries to get a connection from the pool to run a query? Or is also thrown when the DB has reached it’s max connection limit and the prisma client isn’t able to reserve connections to create a connection pool?
• If it’s only thrown in the first case, what could be the possible reasons for it to be thrown when all queries are executed sequentially and connection pool size is 5?
• We get a prisma client by doing ->
const getClient = async () => {
// get connection string stored in AWS parameter store
return new PrismaClient()
}
And then we call getClient
in our handler. So basically anytime a handler is called a new prisma client is initialised. What does this mean in terms of the connection pool? Will prisma create a new pool every time we do new PrismaClient()
?Daniell
06/24/2021, 1:50 PMAriel Flesler
06/24/2021, 3:07 PMNick Fix
06/24/2021, 5:44 PMvalues
{
"test": 10
}
and i trying to grab it this way:
const entries = await this.prismaClient.accountEntity.findMany({
where: {
values: {
path: ["test"],
gt: 5,
},
},
});
but it doesn't return anything. I would expect it to return all rows above 5.
I have the following preview features: previewFeatures = ["orderByRelation", "filterJson"]
I have tried to upgrade to version 2.25.0 but still no luck.
Please let me know if im doing anything wrongMichael
06/24/2021, 7:22 PMPurchases
like this:
id product price date
1 1 10 2014-01-01
2 1 20 2014-02-17
3 1 5 2014-03-28
4 2 25 2014-01-05
5 2 12 2014-02-08
6 2 30 2014-03-12
And I want to get a result that contains only the record/row that has the max date, by product
. Thus I want to get a result that is like this:
product price date
1 5 2014-03-28
2 30 2014-03-12
(because above for product
id 1 the most recent date is 2014-03-23 and for product
2 the most recent date is 2014-03-12.
Could anyone help me with constructing a query in Prisma to do this (is it even possible?). I assume I'll be issuing a groupBy
? Thank you.Nikhil Goyal
06/25/2021, 8:23 AMTraky Richard
06/25/2021, 8:40 AMStephen
06/25/2021, 8:55 AMJohn McElreavey
06/25/2021, 9:22 AMAlexander Braunreuther
06/25/2021, 10:04 AMSimão Cruz
06/25/2021, 12:20 PMError: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
I already made "prisma generate" command successfully in my dockerfile. How I can solve this? Thanksjasci
06/25/2021, 3:56 PMprisma migrate dev --createOnly
than manually modify it to set cascading deletes, kind of like the variant #1 but that way I save it and can apply later to any db (test, staging, prod, etc)
Can you please suggest what would be the optimal solution ?
Thank you.Ariel Flesler
06/25/2021, 5:28 PM.graphql
file out of the schema, similar to what you got from Prisma 1?
Also, is it possible (and somewhat recommended) to expose Prisma directly to the frontend (handling permissions and whatnot ofc)?Halvor
06/25/2021, 9:26 PMHalvor
06/25/2021, 9:26 PMChip Clark
06/25/2021, 10:54 PMprisma.person.findUnique()
invocation
Invalid `prisma.person.findUnique()` invocation:
{
where: {
PKPersonID: {
PKPersonID: 7
}
~~~~~~~~~~~~~~~
I have two functions that are nearly identical. One fails with the above error, the other works fine.
This works:
personByID(id: any) {
const personID = this.prisma.person.findUnique({
where: {
PKPersonID: id
},
include: defaultIncludeQuery
})
return personID;
}
This gives an error:
personWContacts(id: any) {
const personContacts = this.prisma.person.findUnique({
where: { PKPersonID: id },
include: contactsIncludeQuery
})
return personContacts;
}
I can switch the includes but the error remains with the personWContacts function.Chip Clark
06/25/2021, 11:01 PM@Get(`${Route}/:id`)
byId(@Param('id', ParseIntPipe) PKPersonID: number) {
return this.personService.person({
PKPersonID,
});
}
@Get(`${Route}/contacts/:id`)
contacts(@Param('id', ParseIntPipe) PKPersonID: number) {
return this.personService.personWContacts({
PKPersonID,
});
}
Filippo Sarzana
06/25/2021, 11:04 PMid
🤔Filippo Sarzana
06/25/2021, 11:05 PMinclude
paramsChip Clark
06/26/2021, 12:07 AMChristian Villamin
06/26/2021, 12:28 PMHalvor
06/26/2021, 1:46 PMBrian mwangi
06/26/2021, 2:33 PMHalvor
06/26/2021, 3:01 PMHalvor
06/26/2021, 3:10 PMHalvor
06/26/2021, 3:26 PMTom
06/26/2021, 8:19 PMSatont
06/26/2021, 10:43 PMconst qb: QueryBuilder<UserModel> = (orm.em.fork() as any).createQueryBuilder(UserModel, 'user');
const result: Array<{ id: number; username: string; value: number }> = await orm.em
.fork()
.getConnection()
.execute(
qb
.select(['user.id', 'user.username'])
.where({ username: { $nin: ignored } })
.join('user.tips', 'tips')
.addSelect('COALESCE(SUM("tips"."inMainCurrencyAmount"), 0) as "value"')
.offset(offset)
.limit(limit)
.groupBy('id')
.getKnexQuery()
.orderBy('value', 'desc')
.toQuery(),
);
Ramesh
06/27/2021, 9:09 AM