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

dynamodb: Ability to override the table name #2935

Open
1 task
moznion opened this issue Dec 22, 2021 · 6 comments
Open
1 task

dynamodb: Ability to override the table name #2935

moznion opened this issue Dec 22, 2021 · 6 comments
Labels
dynamodb-enhanced feature-request A feature should be added or improved. p2 This is a standard priority issue

Comments

@moznion
Copy link

moznion commented Dec 22, 2021

Describe the feature

Currently, it seems there are no features to override the DynamoDB table name, like an equivalent to the V1 SDK's
DynamoDBMapperConfig.Builder#withTableNameOverride() and DynamoDBMapperConfig.TableNameOverride.withTableNamePrefix() .

This feature is useful to configure the DynamoDBs' table names dynamically. I'd like to use the equivalent function on V2 SDK as well.

Is your Feature Request related to a problem?

This is one of the blockers to upgrade the SDK to v2 from v1 for us.

Proposed Solution

No response

Describe alternatives you've considered

No response

Acknowledge

  • I may be able to implement this feature request

AWS Java SDK version used

2.17.102

JDK version used

openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment Corretto-11.0.11.9.1 (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.11.9.1 (build 11.0.11+9-LTS, mixed mode)

Operating System and version

Ubuntu 20.04

@moznion moznion added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Dec 22, 2021
@debora-ito
Copy link
Member

Thank you for reaching out @moznion, marking as a feature request.

@debora-ito debora-ito removed the needs-triage This issue or PR still needs to be triaged. label Jan 13, 2022
@3Fish
Copy link

3Fish commented Apr 13, 2022

Hi, I need this feature too. How is the progress of this feature request? Is this planned to come in some release in the future?

@yasminetalby yasminetalby added the p2 This is a standard priority issue label Nov 28, 2022
@pefischerhro
Copy link

Hi, I'm currently migrating the SDK from v1 to v2 and just noticed that this feature is missing. This could be a blocker.

@dmadroja
Copy link

I am migrating the SDK from v1 to v2 and this could be blocker.

@wenzhang0220
Copy link

same. this feature is a blocker for us.

@diep-it-dn
Copy link

Follow this doc, I could custom the table name as below sample code:

Create a CustomDynamoDbTableNameResolver:

import io.awspring.cloud.dynamodb.DynamoDbTableNameResolver;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value;

import java.util.Map;

public class CustomDynamoDbTableNameResolver implements DynamoDbTableNameResolver {

    @Value("${tables.table1}")
    private String table1;
    @Value("${tables.table2}")
    private String table2;

    @NotNull
    @Override
    public <T> String resolve(@NotNull Class<T> clazz) {
        return classTableNameMap().get(clazz);
    }

    private Map<Class<?>, String> classTableNameMap() {
        return Map.of(Table1.class, table1, Table2.class, table2);
    }
}

Then declare a bean of type DynamoDbTableSchemaResolver by using CustomDynamoDbTableNameResolver:

@Bean
public DynamoDbTableNameResolver dynamoDbTableNameResolver() {
    return new CustomDynamoDbTableNameResolver();
}

Hope this helps!

aws-sdk-java-automation added a commit that referenced this issue Mar 26, 2024
…157247b7d

Pull request: release <- staging/2da2f53b-4db9-41c8-b6c6-48b157247b7d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dynamodb-enhanced feature-request A feature should be added or improved. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

8 participants