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

FAI-10363: Remove superfluous FKs from incremental queries #245

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

ted-faros
Copy link
Contributor

@ted-faros ted-faros commented Apr 2, 2024

Description

Add scalarsOnly option to exclude FKs queried as nested fragments. They aren't needed for some use cases.

Prior behavior produced extra FKs like pullRequestFk in below:

query paginatedQuery($id: String, $limit: Int, $from: timestamptz!, $to: timestamptz!) {
  vcs_PullRequestComment(
    where: {_and: [{refreshedAt: {_gte: $from, _lt: $to}}, {id: {_gt: $id}}]}
    order_by: {id: asc}
    limit: $limit
  ) {
    _id: id
    id
    author {
      authorFk: id
    }
    authorId
    comment
    createdAt
    isPhantom
    number
    origin
    pullRequest {
      pullRequestFk: id
    }
    pullRequestId
    refreshedAt
    updatedAt
  }
} 

With scalarsOnly set to true, the output will be:

query paginatedQuery($id: String, $limit: Int, $from: timestamptz!, $to: timestamptz!) {
  vcs_PullRequestComment(
    where: {_and: [{refreshedAt: {_gte: $from, _lt: $to}}, {id: {_gt: $id}}]}
    order_by: {id: asc}
    limit: $limit
  ) {
    _id: id
    id
    authorId
    comment
    createdAt
    isPhantom
    number
    origin
    pullRequestId
    refreshedAt
    updatedAt
  }
} 

Type of change

  • Bug fix
  • New feature
  • Breaking change

1) add option to exclude nested FKs
@ted-faros ted-faros requested a review from ypc-faros April 2, 2024 18:46
Copy link

sonarcloud bot commented Apr 2, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ted-faros ted-faros requested review from tovbinm, chalenge and eskrm and removed request for ypc-faros April 2, 2024 18:47
@tovbinm tovbinm merged commit c5eb845 into main Apr 2, 2024
3 checks passed
@tovbinm tovbinm deleted the tt/extra-fks branch April 2, 2024 19:00
@github-actions github-actions bot locked and limited conversation to collaborators Apr 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants