Skip to content
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

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
544302a
Request only needed fields
adrinr Dec 2, 2024
0e0b647
Generate proper select
adrinr Dec 11, 2024
191b632
Dry
adrinr Dec 11, 2024
a415095
Lint
adrinr Dec 11, 2024
74e1bbc
Require only visible fields on views
adrinr Dec 12, 2024
e3c9156
Trim selected fields
adrinr Dec 12, 2024
00557e5
Don't include unnecessary joins
adrinr Dec 12, 2024
910faa6
Fix getting relations
adrinr Dec 12, 2024
be00741
Request relation only when required
adrinr Dec 12, 2024
112b7c7
Fix sqs views
adrinr Dec 13, 2024
bbb60af
Relations, select only required fields
adrinr Dec 13, 2024
80dcc51
Fix sql alias tests
adrinr Dec 16, 2024
f92fcea
Include * when having formulas
adrinr Dec 16, 2024
f8ece82
Fix formulas on internal
adrinr Dec 16, 2024
e6a27ad
Ensure required fields are included
adrinr Dec 16, 2024
2d771c9
Fix wrong relationship select
adrinr Dec 16, 2024
14b5a42
Fix patch issues
adrinr Dec 16, 2024
d60cc7a
Fix encoding
adrinr Dec 16, 2024
0ef4a15
Prevent repeated fields on select
adrinr Dec 16, 2024
fc22db3
Add back cte
adrinr Dec 16, 2024
aa28896
Fix tests back
adrinr Dec 16, 2024
eb7fcd0
Don't select * on relationships
adrinr Dec 16, 2024
df62845
Fix encodings
adrinr Dec 16, 2024
740069e
Use table for get before row
adrinr Dec 16, 2024
7cd412b
Add basic sql alias test
adrinr Dec 16, 2024
fc75728
Add more tests
adrinr Dec 16, 2024
7932ee7
Fix sqs calculations
adrinr Dec 17, 2024
499d3f2
Fix sql calculations
adrinr Dec 17, 2024
51ba1f0
Add required fields on table search as well
adrinr Dec 17, 2024
c398412
Fix pg money
adrinr Dec 17, 2024
95f7eea
Don't add breaking changes
adrinr Dec 17, 2024
8765a28
Move responsability to sql utils
adrinr Dec 17, 2024
8eb82d3
Fix mysql formula test
adrinr Dec 17, 2024
23531e1
Fix sqs formula
adrinr Dec 17, 2024
bcc9bba
Fix test
adrinr Dec 17, 2024
b05b523
Fix issues with display names not being sql tables
adrinr Dec 17, 2024
7d8cfeb
Merge branch 'master' into BUDI-8885/only-select-required-columns-fro…
adrinr Dec 18, 2024
3de0795
Merge branch 'chore/guard-display-column-in-the-api' into BUDI-8885/o…
adrinr Dec 18, 2024
27d1929
Add basic sqlUtils test
adrinr Dec 18, 2024
875319e
Relationship tests
adrinr Dec 18, 2024
96bddbb
More relationship tests
adrinr Dec 18, 2024
e23753a
Add describe
adrinr Dec 18, 2024
14da902
Regenerate table before each test
adrinr Dec 18, 2024
8da96ab
Add initial view tests
adrinr Dec 18, 2024
460b5fd
More tests
adrinr Dec 18, 2024
9396292
Create table test builder
adrinr Dec 18, 2024
92e791f
Add calculation tests
adrinr Dec 19, 2024
8891976
Comment to explain the behaviour of the junction document select.
mike12345567 Dec 19, 2024
0ee432d
Always use tableid prefix for sqs
adrinr Dec 19, 2024
5a9ed4f
Include hidden fields for formulas
adrinr Dec 19, 2024
7cc03b1
Create sql tests for sqs
adrinr Dec 19, 2024
16fb865
Fix tests
adrinr Dec 19, 2024
8905f9d
Fix tests
adrinr Dec 19, 2024
3168b42
Merge branch 'master' into BUDI-8885/only-select-required-columns-fro…
mike12345567 Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Prevent repeated fields on select
  • Loading branch information
adrinr committed Dec 17, 2024
commit 0ef4a154ef9b98b41eed2fcfdf424ff6ba3a4724
14 changes: 8 additions & 6 deletions packages/server/src/api/controllers/row/utils/sqlUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,6 @@ export async function buildSqlFieldList(

const isView = sdk.views.isView(source)

if (isView) {
fields = Object.keys(helpers.views.basicFields(source))
} else {
fields = extractRealFields(source)
}

let table: Table
if (isView) {
table = await sdk.views.getTable(source.id)
Expand All @@ -172,6 +166,14 @@ export async function buildSqlFieldList(
table = source
}

if (isView) {
fields = Object.keys(helpers.views.basicFields(source)).map(
c => `${table.name}.${c}`
)
} else {
fields = extractRealFields(source)
}

fields.push(
...getRequiredFields(
{
Expand Down