Aaroned
DTDrizzle Team
•Created by Titan on 4/8/2024 in #help
Insert returning api to match select columns
@Titan Here is a possible conversion function
8 replies
DTDrizzle Team
•Created by AuroPick on 4/7/2024 in #help
Query API relation null type
Yes chat media relations is correct
4 replies
DTDrizzle Team
•Created by Titan on 4/8/2024 in #help
Insert returning api to match select columns
I think you will need to write an automatic mapping function
SelectColumnsToReturningColumns
, but I think you should be able to get the values needed for returning columns from getTableColumns
8 replies
DTDrizzle Team
•Created by Titan on 4/8/2024 in #help
Insert returning api to match select columns
@Titan you could possibly create a conversion function that utilises both
getTableColumns(table)
(https://orm.drizzle.team/docs/goodies#get-typed-table-columns) and maybe also InferSelectModel<typeof table>
(https://orm.drizzle.team/docs/goodies#type-api)8 replies
DTDrizzle Team
•Created by Martin Carlsson on 4/9/2024 in #help
Is relationships only for .findMany() and .findFirst()
@Martin Carlsson yes that's correct
3 replies
DTDrizzle Team
•Created by DiamondDragon on 4/7/2024 in #help
Missing nested where clause
@DiamondDragon https://www.sqlite.org/optoverview.html this is a good page for understanding SQLite (ie. Turso libsql) query optimization and indexes.
SQLite does NOT automatically create indexes on foreign keys, so if you are not sure, that is generally a good place to start.
Another helpful tool for optimisation is
EXPLAIN QUERY PLAN
https://www.sqlite.org/eqp.html this can be run through the Turso CLI db shell command. (You will need to first obtain the SQL of the Drizzle query by using .toSQL()
at the end of the query)
You really want to avoid TABLE SCANS
as each row is read in a table scan and counts to the Turso Rows Read quota. By adding appropriate indexes that SQLite can use for your query, the query engine will use INDEX SCANS
and avoid TABLE SCANS
.
See also https://turso.tech/blog/tips-for-maximizing-your-turso-billing-allowances-48a0fca163e923 replies
DTDrizzle Team
•Created by B33fb0n3 on 4/8/2024 in #help
No overload matches this call
you can use
serial
if you want an autoincrementing integer, or uuid
with .defaultRandom()
for a string uuid15 replies
DTDrizzle Team
•Created by B33fb0n3 on 4/8/2024 in #help
No overload matches this call
because you are not using serial (ie. autoincrement integer), but rather a string, yes you need to supply a value or a defaultFn
15 replies
DTDrizzle Team
•Created by B33fb0n3 on 4/8/2024 in #help
No overload matches this call
actually there is two error messages there, I think the first is the issue... you are using a string (varchar) as primary key.... are you supplying a value?
15 replies
DTDrizzle Team
•Created by B33fb0n3 on 4/8/2024 in #help
No overload matches this call
what is the type of newMediaId?
15 replies
DTDrizzle Team
•Created by B33fb0n3 on 4/8/2024 in #help
No overload matches this call
@B33fb0n3 can you share your
exclusiveItems
schema?15 replies
DTDrizzle Team
•Created by andreas_444 on 4/4/2024 in #help
Object literal may only specify known properties, and photo does not exist in type
That's fair enough. But if you want you are welcome to define Drizzle ORM level relations (and hence use relation queries) without having to define database level foreign keys 😊
17 replies
DTDrizzle Team
•Created by andreas_444 on 4/4/2024 in #help
Object literal may only specify known properties, and photo does not exist in type
FYI I just noticed this comment here https://orm.drizzle.team/docs/rqb#foreign-keys
What this means is relations and foreign keys can be used together, but they are not dependent on each other. You can define relations without using foreign keys (and vice versa), which allows them to be used with databases that do not support foreign keys.
17 replies
DTDrizzle Team
•Created by DiamondDragon on 4/7/2024 in #help
Missing nested where clause
yes the 1st parameter
fields
is the table you are querying, and the 2nd parameter operators
is just a shorthand to using operators without needing imports23 replies
DTDrizzle Team
•Created by DiamondDragon on 4/7/2024 in #help
Missing nested where clause
sorry @DiamondDragon I just realised it's likely not a bug, you probably just need to use the callback syntax:
23 replies
DTDrizzle Team
•Created by DiamondDragon on 4/7/2024 in #help
Missing nested where clause
yeah left join will work well 👍
23 replies
DTDrizzle Team
•Created by DiamondDragon on 4/7/2024 in #help
Missing nested where clause
In the mean time, if you want to return the first rawCard that doesn't have a rawDetail, then yes you can use left join and test for null
23 replies