djMax
djMax
KKysely
Created by djMax on 3/11/2024 in #help
Multiple calls to values in insert statement?
or, at runtime, it should scream bloody murder rather than dropping data on the floor and acting like everything is just fine
7 replies
KKysely
Created by djMax on 3/11/2024 in #help
Multiple calls to values in insert statement?
And I would argue it's pretty easy to fix in that the values method should just return a type that omits the values method, no?
7 replies
KKysely
Created by djMax on 3/11/2024 in #help
Multiple calls to values in insert statement?
typescript is intended to give some dev-time information about your conformance to expectations, and in this case it does not do that.
7 replies
KKysely
Created by djMax on 2/14/2024 in #help
How can I get total row count without blowing up types?
I guess maybe this works?
.select(['some_id', (eb) => eb.fn.count('some_id').over().as('total')])
.select(['some_id', (eb) => eb.fn.count('some_id').over().as('total')])
4 replies
KKysely
Created by djMax on 1/6/2024 in #help
Generic function to stream a table
This is where I ended up: https://github.com/sesamecare/to-clickhouse/blob/main/src/dbs/kysely.ts#L21 The most important goal was to get autocomplete on the parameters, and that seems to be working, but as you say there have to be some non-type-safe things inside the function to maintain sanity.
5 replies
KKysely
Created by djMax on 9/16/2023 in #help
How do you formulate a custom type argument?
Not much there because kysely doesn't explicitly generate anything for functions or records, but I put the sql. I want to call that function. I made it work by changing the param to json and then doing
WITH cte AS (
SELECT x
FROM json_populate_recordset(NULL::identifier_detail, _jsonIdentifiers) AS x
)
WITH cte AS (
SELECT x
FROM json_populate_recordset(NULL::identifier_detail, _jsonIdentifiers) AS x
)
in the function, but... ewww.
4 replies
KKysely
Created by djMax on 9/16/2023 in #help
How do you formulate a custom type argument?
4 replies
KKysely
Created by djMax on 9/15/2023 in #help
How do I type the arguments to a function?
Actually I think the problem is more subtle than I thought. I'm passing an object in those params and expecting it to be json in pg, but perhaps this needs JSON encoding on the client side first?
3 replies
KKysely
Created by djMax on 9/15/2023 in #help
InsertInto with all default values?
perfect, thanks.
5 replies
KKysely
Created by djMax on 5/17/2023 in #help
insert into with mix of static and table values
Yes, like that! I thought it was kysely.val (as did GPT), but didn't see the sql one. Also weird that it needs the alias, but doable.
7 replies