potatoxchip
11/03/2021, 9:57 AMpotatoxchip
11/03/2021, 9:58 AMpotatoxchip
11/03/2021, 9:59 AMAmit Goldfarb
11/03/2021, 10:13 AMPrismaClientKnownRequestError: Timed out fetching a new connection from the connection pool. (More info: <http://pris.ly/d/connection-pool>, Current connection limit: 1)
This happened multiple times to different node processes on the same container. After closing and restarting the container this issue doesn’t reoccur.n
11/03/2021, 10:28 AMGelo
11/03/2021, 10:33 AMut dev
11/03/2021, 11:49 AMpleblancq
11/03/2021, 2:46 PMpleblancq
11/03/2021, 2:51 PM...
var consumeSQL = new Promise((resolve) => {
decompressFile.on("data", async (chunk: Buffer) => {
decompressFile.pause();
partSql += chunk.toString("utf8");
var sql = partSql.split("\n");
let incompleteSql = "";
for (var i = 0; i < sql.length; i++) {
if (sql[i].endsWith(";")) {
try {
...
await prisma.$executeRaw(sql[i]));
...
} catch (err) {
console.log(err);
process.exit(1);
}
} else {
incompleteSql += sql[i];
}
}
partSql = incompleteSql;
decompressFile.resume();
});
decompressFile.on("end", async () => {
resolve("ended");
connection.end();
});
});
...user
11/03/2021, 3:30 PMOleg Yarin
11/03/2021, 3:58 PMlog: ['query']
but somewhat see only this output in my cli:
query {
findManyStatement(where: {
contextId: "id"
}) {
id
content
}
}
Dev__
11/03/2021, 3:59 PMJson
. One if the properties I try to insert is of type Decimal
but seems the schema type Json
doesnt accept that which I find strange since Decimal
is a part of prisma. any other way?Tim Griffin
11/03/2021, 5:21 PMAndrew Valleteau
11/03/2021, 7:58 PMprisma.$queryRaw<boolan>("SELECT my_function($1, $2, $3, $4)", param_1, param_2, param_3, Prisma.join(myArrayOfString));
However, this doesn't work. What is the proper way to convert my array of string into his {"value1","value2"}
equivalent ?Dan Borstelmann
11/03/2021, 9:46 PMNick Zhang
11/04/2021, 6:53 AMKharann
11/04/2021, 12:14 PMLaurence Davies
11/04/2021, 1:19 PMJsonValue
. Is there anyway to explicitly type a json column in the prisma schema?kyler
11/04/2021, 3:49 PMTypeError: import__.PrismaClient is not a constructor
Raif Harik
11/04/2021, 10:47 PMAmos Bastian
11/04/2021, 11:12 PMRyan Rhodes
11/05/2021, 2:45 AMError: Failed to create a new migration directory.
0: migration_core::api::CreateMigration
with migration_name="init" draft=false
at migration-engine/core/src/api.rs:94
joao.santos
11/05/2021, 10:14 AMshahrukh ahmed
11/05/2021, 10:51 AMOleg Yarin
11/05/2021, 12:35 PMmodel User {
id Int @id @default(autoincrement())
username String? @unique
contexts Context[]
}
model Context {
id Int @id @default(autoincrement())
contextName String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId Int
}
I want to get all of the contexts belonging to the user.
If I write in the way prisma suggest me to write:
const userContextsSample = await this.prisma.user.findUnique({
where: {
id: userId,
},
include: {
contexts: true,
},
});
I see that prisma generates two SQL queries:
prisma:query SELECT "public"."User"."id", "public"."User"."username" FROM "public"."User" WHERE "public"."User"."id" = $1 LIMIT $2 OFFSET $3
prisma:query SELECT "public"."Context"."id", "public"."Context"."contextName", "public"."Context"."userId", "public"."Context"."createdAt" FROM "public"."Context" WHERE "public"."Context"."userId" IN ($1) OFFSET $2
This looks quite suboptimal to me. As I have already the userId
in place I would expect just one single SQL query:
SELECT "public"."Context"."id", "public"."Context"."contextName", "public"."Context"."userId", "public"."Context"."createdAt" FROM "public"."Context" WHERE "public"."Context"."userId" IN ($myOriginalUserId)
Is there a way prisma can achieve that?
Many thanks in advance!Blakelock Brown
11/05/2021, 6:35 PMBlakelock Brown
11/05/2021, 6:37 PMGabe O'Leary
11/05/2021, 7:49 PM{
clientVersion: "3.3.0"
}
Also I can't repro it locally, it only happen in our production environment which makes it even more difficult to debug...
This happens when I execute a raw query that looks like this:
const query = Prisma.sql`
select url, count(*) as count
from (
select distinct "Status"."userIdStr", "Status".url
from "Status"
where "Status"."createdAt" > (to_timestamp(${startDate.getTime()} / 1000.0))
and "Status".url is not null
) as distinct_user_url_statuses
group by url
having distinct_user_url_statuses.count > 1
order by count desc
limit ${limit}
`;
const data = await prisma.$queryRaw<{ url: string; count: number }[]>(query);
Richard Prins
11/05/2021, 11:36 PMOmar
11/06/2021, 4:05 PM