3 ms·
Yes, but not every query should be a view (materialized or not) because the ORM doesnt support things like lateral join, cross join, etc.
by Exuma 5y ago
Yes, but not every query should be a view (materialized or not) because the ORM doesnt support things like lateral join, cross join, etc.
- emteycz 5y agoWhy can't you just build a special GraphQL query with the SQL query you want? I mean having something like query { myCustomQuery(...params...) { id whatever } } backed by async function resolver(ctx) { const rows = await db.query(sql`SELECT yadda as id, badda as whatever FROM dabba JOIN dada ON ...`); return rows; }
- Exuma 5y agoWell if that is possible, that's great, but when I've asked similar questions before the answer is always to use some external library like joinmonster or whatever.
- emteycz 5y agoThis is easily possible with the low-level graphql NPM package which is the base of many frameworks. Most give you an option to get through the abstraction and do it.
- szundi 5y agoHow refreshing to see something else than foo and bar