We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
or maybe a flag like SkipIfExists, UpdateIfExists to try to match the input
The text was updated successfully, but these errors were encountered:
I have this small piece of code that does that, with the aws sdk, if it helps:
package database import ( "context" "log" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/dynamodb" "github.com/aws/aws-sdk-go-v2/service/sns/types" "github.com/pkg/errors" ) func TableExists(tableName string) (bool, error) { log.Printf("Validating table existence: %s", tableName) exists := true _, err := DbClient.DescribeTable( context.TODO(), &dynamodb.DescribeTableInput{TableName: aws.String(tableName)}, ) if err != nil { var notFoundEx *types.ResourceNotFoundException if errors.As(err, ¬FoundEx) { log.Printf("Table %v does not exist.\n", tableName) err = nil } else { log.Printf("Couldn't determine existence of table %v. Here's why: %v\n", tableName, err) } exists = false } if exists { log.Printf("Table already exists. skipping...") } return exists, err }
Sorry, something went wrong.
No branches or pull requests
or maybe a flag like SkipIfExists, UpdateIfExists to try to match the input
The text was updated successfully, but these errors were encountered: