getmoto / moto

A library that allows you to easily mock out tests based on AWS infrastructure.
http://docs.getmoto.org/en/latest/
Apache License 2.0
7.65k stars 2.05k forks source link

Does moto have support in rds-data? #2968

Closed noahgrad closed 1 year ago

noahgrad commented 4 years ago

asking a question

Hi,

Does moto have support in rds-data? or more specifically at execute_statement? In the documentation, I saw that there is no support but I wanted to make sure because it is essential for me.

Thanks

bblommers commented 4 years ago

Hi @noahgrad, rds-data is not supported at all at the moment. Will mark it as an enhancement.

PR's are always welcome if you want to contribute!

michaelhelmick commented 2 years ago

Hey all, any good ideas for implementation of this? I've found some libs like local-data-api that mocks an entire service, not sure if there's a more streamlined way of doing this?

bblommers commented 2 years ago

Hi @michaelhelmick, the local-data-api seems quite heavy for Moto's purpose - the implementation should be as lightweight as possible, so that rules out any Docker/Kotlin/Postgres dependencies.

There are a few operations in AWS where the user can query data, but none of them have been implemented in Moto yet, so there is no existing formula that we can follow here.

Some architectural solutions that I can think of out the top of my head: 1) Use SQLite, and use the query provided by the user Pros: in-memory, light-weight Cons: SQL dialect is different between PostGres/Aurora/etc, so only trivial queries would work 2) Hardcoded responses Pros: low-maintenance, lightweight Cons: Only usuable for a subset of users 3) Configurable responses - let the user supply the exact response for each query Pros: complete flexibility Cons: Unusual (un-moto-like) mechanism, needs user training, makes mocking much more of a pain 4) ..?

(Disclaimer: I don't have a preference for any of them at the moment - just braindumping to get some feedback.)

@bpandola Do you have any ideas/suggestions on how we could approach this?

michaelhelmick commented 2 years ago

Right, I didn't think local-data-api was a proper solution either. Will try to brainstorm some things and review your ideas too!

aczire commented 1 year ago

Any traction on this one?

May be a fourth option be, Configurable connector - let the user supply the exact connector to the db Pros: complete flexibility Cons: Unusual (un-moto-like) mechanism, needs user training, makes mocking much more of a pain

bblommers commented 1 year ago

The execute_statement is now part of moto >= 4.1.7.dev26.

By default, this will not return any records, but it is possible to configure exactly the response that you'd expect. See the documentation here: http://docs.getmoto.org/en/latest/docs/services/rds-data.html