You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AI answers suggested this code to created a dynamic query:
To construct an optional where clause in Drizzle with optional "and" fields, including a condition only if you have specific search criteria for that field, you can utilize the dynamic query building feature of Drizzle. This feature allows you to build queries dynamically, adjusting the conditions based on the input data you have.
What version of
drizzle-orm
are you using?0.30.10
What version of
drizzle-kit
are you using?0.21.1
Describe the Bug
Dynamic query building does not work as indicated here: https://orm.drizzle.team/docs/dynamic-query-building
AI answers suggested this code to created a dynamic query:
To construct an optional where clause in Drizzle with optional "and" fields, including a condition only if you have specific search criteria for that field, you can utilize the dynamic query building feature of Drizzle. This feature allows you to build queries dynamically, adjusting the conditions based on the input data you have.
Run it as follows:
The log printed out is this:
Expected behavior
the expected code should be
note that the "where tenant = 'xxx" has gone missing.
Environment & setup
Testing this in sveltelkit project running on cloudflare.
Referring to this page: https://orm.drizzle.team/docs/dynamic-query-building
The documentation starts with this problem:
but never really address this problem of adding optional where based on the input matching fields.
It goes into adding joins, and limits etc, where it should also address the optional where fields which is classic in searching sql dbs.
The text was updated successfully, but these errors were encountered: