Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

A couple issues creating a Postgresql wrapper connection for Amazon Aurora DSQL #4421

Closed
1 of 4 tasks
txase opened this issue Jan 6, 2025 · 0 comments
Closed
1 of 4 tasks
Labels

Comments

@txase
Copy link

txase commented Jan 6, 2025

Setup

Versions

Feature Flags

  • diesel: postgres, i-implement-a-third-party-backend-and-opt-into-breaking-changes

Problem Description

I hit a couple annoying API issues with the diesel Connection traits while creating a wrapper for DSQL around the built-in Postgresql connection type. I'm raising these concerns together as a single issue, but I'm happy to fork them to separate issues if the maintainers find them to be valid and want to deal with them separately. None of these are show-stoppers, they just made it "annoying" to implement.

I may also be implementing this at the wrong layer of the stack. If so, please provide guidance and I'll happily close this issue!

What are you trying to accomplish?

I wanted to play with DSQL for a side project that already uses Postgresql. FWIW, after removing foreign key constraints, Diesel seemed to "just work" once I got my connection driver working. I added this code directly to my side project, but I assume a production-ready version should exist as a separate crate.

What issues were found?

  • Connection::establish is synchronous, but we need to do some async stuff for DSQL to generate temporary auth tokens. I made it work by spawning and blocking on threads as needed, but it feels like this method should be async.
  • ConnectionError doesn't implement the Clone Trait, which makes error handling onerous.
  • It feels like a wrapper connection, like this is, shouldn't need to forward so many traits and opt into the i-implement-a-third-party-backend-and-opt-into-breaking-changes feature flag. All this does is transform one connection string into a postgresql connection string. The breaking-changes feature flag concerns me most.

Steps to reproduce

You can find my code at this gist. See line 96 for annoyance in handling ConnectionError without Clone. Search for thread to find the two places we need to perform asynchronous processing to generate a postgres connection string.

Checklist

@txase txase added the bug label Jan 6, 2025
@diesel-rs diesel-rs locked and limited conversation to collaborators Jan 6, 2025
@weiznich weiznich converted this issue into discussion #4422 Jan 6, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

1 participant