DT
Drizzle Team•16mo 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
cobiteOP•16mo 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•16mo ago
You wouldn't believe how easy this one is: Just do comments.created_at AS "createdAt" The qoutes should do the trick
cobite
cobiteOP•16mo ago
😂 so simple!
Want results from more Discord servers?
Add your server