-
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
read_model_row
does not work for schema extensions of ModelV1
#24
Comments
hmm, I guess? I am not sure, that feels kind of like trying to work around the legolas change rather than embracing it. To me it seems like either that function should be dropped and folks should add it themselves for their own schemas if it is useful*, or it should have a required schema argument to say what schema you want to deserialize. *we could have a macro to generate this function, but that seems somewhat indirect/confusing. Maybe better is to just write that function out as an example somewhere to suggest writing your own if it is useful. |
What about an optional schema argument for this, so that the existing behavior (return |
Isn't this what |
Good point. Or update
|
I think that read by design does not take a schema argument |
ah, that makes sense. |
oh yikes I missed that |
So as things currently stand, if we follow the recommendations of the readme (use |
I think we shoudl follow the legolas template of:
|
Yeah, I don't think folks should actually be using |
why though? what would those extensions be doing other than what these functions are doing, modulo the schema difference? I think it's pretty reasonable to provide these functions in a way that's generally useful. Right now they're just a footgun, since a user will see that they are used in teh examples adn exported and think they are meant for users to use, and then wonder why their code is breaking in mysterious ways when their extension columns go missing. If they're really meant just as examples/templates, we should remove them from the package and define them in-line in the README |
Yeah, that's what I was saying I should've done/should do.
Agreed, that's what I meant by interface failure.
True... OK maybe they can be useful then. In my usage we have modified them for backwards compat reasons (e.g. if we infer an old schema, we can upgrade to the new one on-the-fly), but OK I agree they can be useful except for the specific schema being hardcoded. |
Yeah, I feel like this is the class of situations where in vanilla legolas land you are encouraged to use |
Okay I'll make a PR then with my proposed changes and some tests! |
fixed by #26 |
read_model_row
always returns aModelV1
which makes it pretty useless for anything that requires fields from a schema extensions. In Legolas <0.5, this was fine because extra fields were preserved but now they are discarded.Instead, could LegolasFlux get the schema from the table metadata, use
Legolas.record_type
to get the appropriate record type, and try to construct that instead?The text was updated successfully, but these errors were encountered: