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

refactor(pairing): move CQEx select queries to exandra #1082

Merged

Conversation

davidebriani
Copy link
Collaborator

What this PR does / why we need it:

Pairing runs queries through CQEx, which is deprecated, and we need to rework the project interaction with the database.

This change moves the SELECT queries to Ecto with Exandra.

Does this PR introduce a user-facing change?
  • Yes
  • No

Use Ecto to compose and run the query.

Signed-off-by: Davide Briani <[email protected]>
@davidebriani davidebriani added app:pairing This issue or pull request is about astarte_pairing application internals This issue or pull request is about implementation details labels Feb 24, 2025
Copy link

codecov bot commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.08%. Comparing base (9fd101b) to head (1a31faf).
Report is 12 commits behind head on release-1.2.

Additional details and impacted files
@@               Coverage Diff               @@
##           release-1.2    #1082      +/-   ##
===============================================
+ Coverage        67.03%   67.08%   +0.04%     
===============================================
  Files              265      315      +50     
  Lines             7084     7635     +551     
===============================================
+ Hits              4749     5122     +373     
- Misses            2335     2513     +178     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davidebriani davidebriani force-pushed the pairing-ecto-queries branch 2 times, most recently from 2220395 to 5130cf0 Compare February 25, 2025 09:41
@davidebriani davidebriani marked this pull request as ready for review February 25, 2025 09:53
# Consider a failing database as a negative answer
_ =
Logger.warning(
"Failed to verify if unconfirmed device #{Device.encode_device_id(device_id)} exists, reason: #{inspect(reason)}",
"Failed to verify if unconfirmed device #{Device.encode_device_id(device_id)} exists, reason: #{inspect(err)}",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since err is always a Xandra error (Xandra.Error or Xandra.ConnectionError) we can use Exception.message(err) instead of inspect(err).

Use Ecto to compose and run the query.

Signed-off-by: Davide Briani <[email protected]>
Use Ecto to compose and run the query.

Signed-off-by: Davide Briani <[email protected]>
Use Ecto to compose and run the query.

Signed-off-by: Davide Briani <[email protected]>
Use Ecto to compose and run the query.

Signed-off-by: Davide Briani <[email protected]>
Use Ecto to compose and run the query.

Signed-off-by: Davide Briani <[email protected]>
Use Ecto to compose and run the query.

Signed-off-by: Davide Briani <[email protected]>
Use Ecto to compose and run the query.

Signed-off-by: Davide Briani <[email protected]>
Use Ecto to compose and run the query.

Signed-off-by: Davide Briani <[email protected]>
@Annopaolo Annopaolo merged commit 1e8147f into astarte-platform:release-1.2 Feb 25, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:pairing This issue or pull request is about astarte_pairing application internals This issue or pull request is about implementation details
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants