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

examples: replace query_unpaged for SELECT queries #1069

Merged
merged 6 commits into from
Aug 29, 2024

Conversation

muzarski
Copy link
Contributor

@muzarski muzarski commented Aug 28, 2024

Follow-up of #1068

In this PR we replace query_unpaged occurrences for SELECTs with either query_iter.

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • [ ] I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • [ ] I have provided docstrings for the public items that I want to introduce.
  • [ ] I have adjusted the documentation in ./docs/source/.
  • [ ] I added appropriate Fixes: annotations to PR description.

Copy link

github-actions bot commented Aug 28, 2024

cargo semver-checks found no API-breaking changes in this PR! 🎉🥳
Checked commit: 18bdbd1

@muzarski muzarski force-pushed the replace-query-unpaged-in-examples branch from f940879 to 5e78c02 Compare August 28, 2024 12:27
@muzarski muzarski added this to the 0.14.0 milestone Aug 28, 2024
@muzarski muzarski self-assigned this Aug 28, 2024
@muzarski muzarski force-pushed the replace-query-unpaged-in-examples branch from 5e78c02 to 74fcecf Compare August 28, 2024 12:33
Replaced query_unpaged usages for SELECTs with query_iter
in cql-time-types.rs example.
There were a lot of unwraps in this example, which are
not encouraged and introduce some noise.

Let's return a Result from main and propagate the errors.
@muzarski muzarski force-pushed the replace-query-unpaged-in-examples branch from 74fcecf to 18bdbd1 Compare August 28, 2024 12:48
Comment on lines -10 to -12
let session: Session = SessionBuilder::new().known_node(uri).build().await.unwrap();
let session: Session = SessionBuilder::new().known_node(uri).build().await?;

session.query_unpaged("CREATE KEYSPACE IF NOT EXISTS examples_ks WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1}", &[]).await.unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wow, the fact that unwraps were here surprised me.

@wprzytula wprzytula merged commit 47e9864 into scylladb:main Aug 29, 2024
11 checks passed
@muzarski muzarski deleted the replace-query-unpaged-in-examples branch December 19, 2024 16:35
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.

3 participants