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

Parsing a UDT with a field not present in a struct results in a BadCqlType error #432

Closed
merlleu opened this issue Apr 14, 2022 · 3 comments
Assignees
Labels
area/deserialization area/proc-macros Related to procedural macros
Milestone

Comments

@merlleu
Copy link
Contributor

merlleu commented Apr 14, 2022

Hello,

I've been using this driver for a few months in production but I have a little problem:
Some of our services need to read data from scylla but their cql schema is not up-to-date, so when a field is added to an UDT, any column containing this UDT would no longer be readable using this driver.

The cause behind this is this piece of code:

 if fields_iter.next().is_some() {
    return Err(FromCqlValError::BadCqlType);
}

That is why we're using our own version of scylla-macros, but I think it would be better letting the user choose if they want to allow this kind of behavior.

I think there could be two solutions:

  1. The easiest would be just to duplicate this derive macro with a different name with the check disabled and a different name.
  • Pros:
    • Easier
  • Cons:
    • Duplicate Code
    • Less user-friendly
  1. Add a #[scylla(non_exhaustive)] derive macro attribute at the struct level for FromUserType.
  • Pros:
    • Easier to use
    • Cleaner code
  • Cons:
    • A little bit harder to implement

What do you think of these two approaches ?
Do you think it would be worth adding them to this crate ?

@merlleu
Copy link
Contributor Author

merlleu commented Jun 16, 2022

For those who have similar needs, you can use https://github.com/merlleu/scylla-macros-flex.

@piodul piodul added the area/proc-macros Related to procedural macros label Oct 26, 2023
@piodul piodul added this to the 1.0.0 milestone Nov 2, 2023
@Lorak-mmk Lorak-mmk self-assigned this Nov 15, 2023
@wprzytula
Copy link
Collaborator

Ref: #962

@wprzytula
Copy link
Collaborator

The PR with new deserialization macros has been merged (#1024), but the new deserialization API they generate implementation for is not yet available in the driver. For tracking it, see #462.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deserialization area/proc-macros Related to procedural macros
Projects
None yet
Development

No branches or pull requests

5 participants