Skip to content

Instantly share code, notes, and snippets.

View gajus's full-sized avatar

Gajus Kuizinas gajus

View GitHub Profile
const prompt = multiline`
Convert all underscore-containing column names in \`SELECT\` expressions of \`SELECT\` statements to camelCase by adding aliases.
- Use PostgreSQL compatible syntax.
- Only update top-level SELECT statements and their column references.
- Only update queries defined using sql.unsafe\`\` or sql.type()\`\`.
- Only update columns that contain underscores (e.g. \`sp1.llm_generated_title\`).
**Example**: \`SELECT sp1.llm_generated_title\` becomes \`SELECT sp1.llm_generated_title "llmGeneratedTitle"\`.
- If a column already has an alias and the alias contains an underscore (e.g. \`SELECT sp1.llm_generated_title generated_title\`), change it to camelCase.
**Example**: \`SELECT sp1.llm_generated_title generated_title\` becomes \`SELECT sp1.llm_generated_title "generatedTitle"\`.
Hello, World!
Limit (cost=0.44..1207.85 rows=100 width=20) (actual time=4773.131..4776.546 rows=100 loops=1)
Output: id, start_time, last_event_seating_asked_at
Buffers: shared hit=293806 read=2825
-> Index Only Scan using current_event_last_event_seating_asked_at_start_time_venue_id_i on public.current_event ce1 (cost=0.44..1207385.77 rows=99998 width=20) (actual time=4773.130..4776.531 rows=100 loops=1)
Output: id, start_time, last_event_seating_asked_at
Index Cond: ((ce1.last_event_seating_asked_at < (now() - '03:00:00'::interval)) AND (ce1.start_time >= now()) AND (ce1.start_time <= (now() + '7 days'::interval)))
Filter: (ce1.venue_id <> ALL ('{52531,52532,52551,52552,52554,52595,52596,52597,52598,52599,52600,52601,52602,52603,52604,52605,52606,52607,52608,52609,52610,52611,52612,52613,52614,52615,52616,52617,52618,52619,52620,52621,52622,52623,52624,52626,52627,52628,52629,52630,52631,52632,52633,52634,52635,52636,52637,52638,52639,52640,52641,52642,52643,52644,52645,52646,52647,52648,
EXPLAIN ANALYZE
SELECT
hrp1.id
FROM http_request_plan hrp1
LEFT JOIN LATERAL (
SELECT
count(*) request_count,
CASE
WHEN count(*) = 0
THEN NULL

`test`

(node:73239) UnhandledPromiseRejectionWarning: Error: Client was closed and is not queryable
at process.nextTick (/Users/gajus/Documents/dev/gajus/slonik/node_modules/pg/lib/client.js:471:25)
at process.internalTickCallback (internal/process/next_tick.js:70:11)
(node:73239) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:73239) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
error TypeError: cancellableConnectionRoutine(...).resolve is not a function
at resolve (/Users/gajus/Documents/dev/gajus/slonik/src/.sandbox/test.js:33:12)
at new Promise (<anonymous>)
at pool.connect (/Users/gajus/Documents/dev/gajus/slonik/src/.sandbox/test.js:19:14)
at process.in
SELECT
?ROTEN_TOMATOES_ID
?METACRITIC_ID
WHERE
{
?item wdt:P345 "${movieRecord.imdbId}" .
OPTIONAL {
?item wdt:P1258 ?ROTEN_TOMATOES_ID .
?item wdt:P1712 ?METACRITIC_ID .
}
{
"data": {
"events": {
"__typename": "EventsConnection",
"edges": [
{
"__typename": "EventsEdge",
"node": {
"__typename": "Event",
"attributes": [
This file has been truncated, but you can view the full file.
{
"data": {
"events": {
"__typename": "EventsConnection",
"edges": [
{
"__typename": "EventsEdge",
"node": {
"__typename": "Event",
"attributes": [