-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Kpi values are not string but specific classes #25
Conversation
d78e6a4
to
f6814a7
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #25 +/- ##
==========================================
+ Coverage 97.77% 97.88% +0.10%
==========================================
Files 24 24
Lines 763 802 +39
Branches 168 170 +2
==========================================
+ Hits 746 785 +39
Misses 12 12
Partials 5 5
☔ View full report in Codecov by Sentry. |
f5a48fd
to
f5498ee
Compare
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.
Ah it's a lot more satisfying now. A few inline comments. I think alembic should be next to the migrations folder.
class KpiValueType(types.TypeDecorator[KpiValue]): | ||
"""Handle KpiValue serialization/deserialization in a transparent way.""" | ||
|
||
impl = types.String |
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.
Is this a pydanctic metadata?
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.
This is SQLAlchemy metadata (linked to the types.TypeDecorator
class) indicating which type will be sent to / received from the DB. I should probably have mentioned https://docs.sqlalchemy.org/en/20/core/custom_types.html in the PR, I just added it.
@@ -55,7 +55,7 @@ def call_alembic(ctx: Context, cmd: str, *, test_db: bool = False): | |||
# this won't be needed once https://github.com/pyinvoke/invoke/issues/170 will be | |||
# implemented and we will be able to call alembic task from other related tasks | |||
|
|||
with ctx.cd("src"): | |||
with ctx.cd("src/offspot_metrics_backend"): |
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.
ugh. I think alembic.ini is misplaced and should be in src/
. WDYT?
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.
This change is very intentional.
It is not the "usual" location but is needed for us so that this ini file is embedded in the Python package at build, installed with pip install, and available for migration execution / checks when the process starts.
I find it cleaner that customizing the build to include this file, since it means we will also need to specify target location and stuff like that which make it complex for little added value from my PoV. But I'm very open to suggestion on this, I do not have much experience.
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.
Well that's rude. I opened this comment and your gave your opinion without changing the code. It is understood that I'd be resolving the conversation.
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.
I'm very sorry about that. I really don't get the approval / resolve conversation PR process. It is very blurry / not understandable for me when to resolve or not the conversations, and also frustrating to not know how to do a good job. Maybe it is understood for you that you'll be resolving the conversation, not for me, sorry.
I've opened an issue to discuss openly about this: openzim/overview#22
Please, feel free to reply to any pending conversations on this PR, I've re-opened unresolved conversation and will take them into account
cfd70e6
to
fee52f3
Compare
Rationale
Fix #16
Changes