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

add Aurora serverless (data api) driver #866

Closed
wants to merge 15 commits into from

Conversation

tarkah
Copy link

@tarkah tarkah commented Dec 1, 2020

Hey! I chimed in the other day on Discord about an Aurora serverless driver. I've mostly got my head around how things are done in core, so I took a stab at making it. This is using the rusoto_rds_data library under the hood and so it works fundamentally different to the other drivers and is pretty lightweight in comparison.

I've tested what I've got so far and it works with query_as. I've only implemented Encode / Decode on string types so far, but the others should be easy to add. Figured I'd post a draft as soon as possible to get any feedback.

A few things I'm unsure how to tackle or haven't finished yet:

  1. Not exactly sure how to implement prepare and describe on the Exectuor for this connection. This is the one thing I really don't have my head around, along with caching the statements.
  2. Need to patch AuroraArugments before submitting with the appropriate named arguments from the query.
  3. I'm storing the transaction id's generated via TransactionManager and think I'm pushing / popping them correctly. What I don't know is if the way I'm referencing the last stored id in AuroraConnection::run is correct in conjunction with people begining transactions, executing, etc.
  4. Unsure how multiple statements are handled with the data api and the ExecuteStatementRequest
  5. Unsure when to use BatchExecuteStatementRequest with the data api when array parameters are bound to the query. For things like UPDATE statements.
  6. Unsure how to impose a LIMIT for fetch_one with this data api
  7. There is a type_hint returned by the data API to better decode String into DATE, DATETIME, TIME and DECIMAL. I still need to implement this (with feature gates for chrono).
  8. How does pool work in conjunction to using the data api under the hood?
  9. What format should the connection string look like for this? Region, resource_arn and secret_arn are required.

I hope this is somewhat on the right track! Would love any feedback or directional changes needed to better accommodate the fact we are using this "rds data api" under the hood and it's limitations.

Comment on lines +50 to +51
_tls-native-tls = [ "rusoto_core/native-tls", "rusoto_rds_data/native-tls" ]
_tls-rustls = [ "rustls", "webpki", "webpki-roots", "rusoto_core/rustls", "rusoto_rds_data/rustls" ]
Copy link
Author

@tarkah tarkah Dec 1, 2020

Choose a reason for hiding this comment

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

It seems like this causes the deps to be included, even if "aurora" isn't. It seems there is a rustlang tracking issue for weak dependencies that could solve this, but isn't ready yet. Is there another workaround so we don't have 2 feature gates for aurora... "aurora-native-tls" / "aurora-rustls"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Cross-reference: rust-lang/cargo#8818

@tarkah
Copy link
Author

tarkah commented Dec 1, 2020

relates to #177

@mehcode
Copy link
Member

mehcode commented Dec 19, 2020

@tarkah, As we discussed on Discord, I'm going to close this for now. I definitely appreciate the effort here though. When we're ready to accept these kinds of drivers as part of 0.5+, I'll reach out to you.

@mehcode mehcode closed this Dec 19, 2020
@tarkah
Copy link
Author

tarkah commented Dec 19, 2020

Sounds good!

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