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

feat(sqla-repo): Support InstrumentedAttribute #2054

Merged
merged 1 commit into from Jul 28, 2023

Conversation

provinzkraut
Copy link
Member

Pull Request Checklist

  • New code has 100% test coverage
  • (If applicable) The prose documentation has been updated to reflect the changes introduced by this PR
  • (If applicable) The reference documentation has been updated to reflect the changes introduced by this PR

Description

Close Issue(s)

Copy link
Member

@cofin cofin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@provinzkraut
Copy link
Member Author

I think it would be nice to support InstrumentedAttribute in all the methods that currently support filtering with kwargs as well. That would require passing in a dict instead of **kwargs directly, so the keys could be str | InstrumentedAttribute.

We could either:

  • Add an additional parameter for this though (e.g. attrs) that accepts a Mapping[str | InstrumentedAttribute, Any]
  • Replace the **kwargs with a parameter (e.g. attrs that accepts a Mapping[str | InstrumentedAttribute, Any]

I'm not particularly fond of either option to be honest. 1) feels clunky and 2) would be a breaking change, and take away the ease of being able to do something=<filter_value.

A completely different option would be to accept a list of expressions, e.g.

filters=[Model.attribute == "foo", Model.other_attribute == "bar"] to be applied to the statement.

@provinzkraut provinzkraut marked this pull request as ready for review July 28, 2023 11:03
@provinzkraut provinzkraut requested review from a team as code owners July 28, 2023 11:03
@provinzkraut
Copy link
Member Author

Okay, let's get this one merged and address these things later in a separate PR.

@sonarcloud
Copy link

sonarcloud bot commented Jul 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

93.6% 93.6% Coverage
0.0% 0.0% Duplication

@github-actions
Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/2054

@provinzkraut provinzkraut merged commit 6b08a1e into main Jul 28, 2023
19 checks passed
@provinzkraut provinzkraut deleted the sqla-repo-instrumented-attr branch July 28, 2023 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants