DT
Drizzle Team•14mo ago
cobite

Transforming SELECT from case to camelCase via sql with execute

I am getting some values for example
comments.created_at,
comments.created_at,
I wish to transform this with the AS keyword:
comments.created_at AS createdAt,
comments.created_at AS createdAt,
The issue is that it just returns as:
createdat
createdat
It does not follow the camelCase that was defined, it just goes lower case for some reason.
3 Replies
cobite
cobite•14mo ago
What i'm doing at the comment is this after the execute:
const transformedResults: Comment[] = results.map((row) => ({
id: row.id,
createdAt: row.created_at,
}));
const transformedResults: Comment[] = results.map((row) => ({
id: row.id,
createdAt: row.created_at,
}));
Angelelz
Angelelz•14mo ago
You wouldn't believe how easy this one is: Just do comments.created_at AS "createdAt" The qoutes should do the trick
cobite
cobite•14mo ago
😂 so simple!
Want results from more Discord servers?
Add your server