Hayato
Hayato
DTDrizzle Team
Created by Hayato on 6/8/2023 in #help
Relational queries (PlanetScale)
Hi, does drizzle-orm/mysql2 support relational queries? I am currently using PlanetScale, but I haven't been able to find any information about relational queries in the following documents: - https://orm.drizzle.team/docs/rqb - https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/mysql-core/README.md - https://github.com/planetscale/database-js Ideally, I would like a developer-friendly response like this:
[
id: 10,
name: "Dan",
posts: [
{
id: 1,
content: "SQL is awesome",
authorId: 10,
},
{
id: 2,
content: "But check relational queries",
authorId: 10,
}
]
[
id: 10,
name: "Dan",
posts: [
{
id: 1,
content: "SQL is awesome",
authorId: 10,
},
{
id: 2,
content: "But check relational queries",
authorId: 10,
}
]
...as opposed to a response like this:
[
{
id: 10,
name: "Dan",
posts: {
id: 1,
content: "SQL is awesome",
authorId: 10,
}
},
{
id: 10,
name: "Dan",
posts: {
id: 2,
content: "But check relational queries",
authorId: 10,
}
}
]
[
{
id: 10,
name: "Dan",
posts: {
id: 1,
content: "SQL is awesome",
authorId: 10,
}
},
{
id: 10,
name: "Dan",
posts: {
id: 2,
content: "But check relational queries",
authorId: 10,
}
}
]
If there is any workaround for this situation, without having to use relational queries, I would greatly appreciate it if you could let me know. Thank you for your time.
9 replies