Torbjørn
Torbjørn
Explore posts from servers
DTDrizzle Team
Created by Torbjørn on 9/15/2024 in #help
How do I use the with statement when inserting with select?
How can I get this insert built with drizzle? Insert only has "values", and I am not sure how to construct this in drizzle
WITH "add_favorite_cte" AS (
SELECT
"id" as favorite_list_id,
'my product id' as product_id
FROM
"favorite_lists"
WHERE
"favorite_lists"."user_id" = 'my user id'
)
INSERT INTO favorite_list_item (id, createdAt, favorite_list_id, product_id)
SELECT
(SELECT MAX(id) + 1 FROM favorite_list_item), -- I the $default here preferably
(SELECT (strftime('%Y-%m-%dT%H:%M:%f', 'now') || 'Z')), -- I the $default here preferably
"favorite_list_id",
"product_id"
FROM
"add_favorite_cte"
WITH "add_favorite_cte" AS (
SELECT
"id" as favorite_list_id,
'my product id' as product_id
FROM
"favorite_lists"
WHERE
"favorite_lists"."user_id" = 'my user id'
)
INSERT INTO favorite_list_item (id, createdAt, favorite_list_id, product_id)
SELECT
(SELECT MAX(id) + 1 FROM favorite_list_item), -- I the $default here preferably
(SELECT (strftime('%Y-%m-%dT%H:%M:%f', 'now') || 'Z')), -- I the $default here preferably
"favorite_list_id",
"product_id"
FROM
"add_favorite_cte"
2 replies
CDCloudflare Developers
Created by Torbjørn on 9/2/2024 in #workers-help
Suggested xml parsing and building packages
Hi! We have a few XML APIs that we have to maintain in Workers, and I am interested in hearing experiences from other users of Workers! What do you use for parsing? What do you use for building? And what are your experiences with the choices you have made? We use htmlparser2 for XML parsing and a custom system for building. We are looking to replace the custom system, and I am also curious as to what other Workers' users are doing.
1 replies