SPS | Shootmail
Explore posts from serversDTDrizzle Team
•Created by SPS | Shootmail on 10/9/2023 in #help
Query depth issue Cloudflare D1
I am encountering
Expression tree is too large (maximum depth 20)
issue mostly with relation queries while using Cloudflare D1. As explained in this issue https://github.com/cloudflare/workers-sdk/issues/4094, this issue is because of the query depth limit set by them which they are considering increasing. My question is, if for now, I were to refactor this query, what would be the most performant way?
1. Using batch
2. Using multiple queries with Promise.all
1 replies
DTDrizzle Team
•Created by SPS | Shootmail on 9/20/2023 in #help
push:sqlite creating weird tables
When I run push:sqlite, tables like
__old_push_categories
are created and are automatically refrenced from the other tables. Now when I do a normal insert, I get this error no such table: main.__old_push_categories
8 replies
DTDrizzle Team
•Created by SPS | Shootmail on 7/1/2023 in #help
Modelling self relations
I have a table
categories
with a parent fields:
Here one category can have one parent category. But, one category can have many subcategories. I have defined my relations:
But I am getting this error:
10 replies
DTDrizzle Team
•Created by SPS | Shootmail on 6/29/2023 in #help
Can't figure out how to design relational query
I have three tables
- categories
- products
- media
I want to retrieve products that belong to a particular category, along with the product category and all images. The results should be paginated and should be filtered by category_slug, organization_id.
Relationships:
1. Many products can belong to one category (products - categories = Many-to-one)
2. Many products can have many images (products - images = Many-to-Many)
I have tried:
Problem: Cannot paginate the products using limit and offset as offset is only available for the top level relation which here is categories.
Problem: Cannot filter on the basis of category_slug since is not available inside nested
category
I guess because this is a Many-to-one relation.
How can achieve the result I want using the relation queries?9 replies
DTDrizzle Team
•Created by SPS | Shootmail on 6/19/2023 in #help
Error while push:sqlite after update
12 replies
DTDrizzle Team
•Created by SPS | Shootmail on 5/21/2023 in #help
Drizzle kit generate gives error after upgrade
I have updated drizzle-orm to 0.26.0 and drizzle-kit to 018.0. I have defined relations according to the docs, to use the relational queries. When I run
drizzle-kit generate:sqlite
, I am getting this error
19 replies
DTDrizzle Team
•Created by SPS | Shootmail on 5/19/2023 in #help
Build queries dynamically with conditions.
How to build query on the basis of if-else conditions? I have tried doing it as below
But the where conditions don't seem to add and the result is returned without them.
3 replies
DTDrizzle Team
•Created by SPS | Shootmail on 4/22/2023 in #help
Get column name in error messages
3 replies
DTDrizzle Team
•Created by SPS | Shootmail on 4/10/2023 in #help
Query for Prisma like insert in multiple joined tables
Is there a way to achieve insert in multiple tables joined by foreign keys in one query like Prisma?
Or subsequent inserts in a transaction is the way?
5 replies
DTDrizzle Team
•Created by SPS | Shootmail on 3/28/2023 in #help
Migrating from Prisma
Hi, I have an existing project already in production built using prisma and postgres (supabase). I am planning to go serverless and hence planning to migrate to drizzle + PlanetScale. Here is how I am planning it:
1. Use Prisma to generate the entire schema structure in MySQL (Planetscale)
2. Use Drizzlekit to introspect and generate types.
3. Use Drizzle ORM for querying.
Am I thinking in the right direction? Or is there a recommended way?
2 replies
DTDrizzle Team
•Created by SPS | Shootmail on 3/20/2023 in #help
require() of ES Module is not supported planetscale serverless + sveltekit
Hi, I am getting this error when I user planetscale serverless with drizzle orm
6 replies