-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only select required columns from sql databases #15169
base: master
Are you sure you want to change the base?
Only select required columns from sql databases #15169
Conversation
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
4fb5f8c
to
da92c3b
Compare
2bfcb11
to
7f3b73f
Compare
@@ -86,7 +89,7 @@ export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) { | |||
// The id might have been changed, so the refetching would fail. Recalculating the id just in case | |||
const updatedId = | |||
generateIdForRow({ ...beforeRow, ...dataToUpdate }, table) || _id | |||
const row = await sdk.rows.external.getRow(table._id!, updatedId, { | |||
const row = await sdk.rows.external.getRow(sourceId, updatedId, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find!
fields = extractRealFields(table) | ||
} | ||
|
||
if (!isView || !helpers.views.isCalculationView(source)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For calculation views, I assume this ends up just leaving the fields empty (since its up to the SQL layer to generate the select statements for these)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - the sqlQueryJson
test cases are a bit of a nightmare to maintain - if they are being problematic we could consider getting rid of them - they circumvent the API which makes them a lot harder to keep up to date.
Description
Edit the SQL generation (for both external and sqs) in order to not include
select *
. Instead, pull only the required fields. This applies both on the requested table rows plus the linked relationships. This change will increase performance, not pulling non-needed data.There is an exception for this when there is a formula field on the requested fields. Given that this formula might use other columns, we need to pull it all in order to compute them.
Launchcontrol
Smarter SQL select, requesting only the required data.