Fix sqs views

This commit is contained in:
Adria Navarro 2024-12-13 11:21:24 +01:00
parent e93a207127
commit 583fb7505e
1 changed files with 11 additions and 0 deletions

View File

@ -234,6 +234,17 @@ async function runSqlQuery(
json.operation = Operation.COUNT
}
const processSQLQuery = async (json: EnrichedQueryJson) => {
const fields = json.resource?.fields
if (fields) {
const tableId = json.tableAliases?.[json.table._id!] ?? json.table._id!
for (const key of ["_id", "_rev", "tableId"]) {
const field = `${tableId}.${key}`
if (fields.includes(field)) {
continue
}
fields.push(field)
}
}
const query = builder._query(json, {
disableReturning: true,
})