I am writing some code to query Dynamo with a certain filter and I'm using the expression
package in the Go sdk:
The variable project
that is referred to is defined in another section of the code. Its string properties owner
and name
are not nil/empty.
dynamo := dynamodb.New(sess)
filt := expression.Name("projectOwner").Equal(
expression.Value(project.owner),
).And(
expression.Name("projectName").Equal(
expression.Value(project.name),
),
)
expr, err := expression.NewBuilder().WithFilter(filt).Build()
if err != nil {
panic(err)
}
queryInput := dynamodb.QueryInput{
KeyConditionExpression: expr.KeyCondition(),
ProjectionExpression: expr.Projection(),
ExpressionAttributeNames: expr.Names(),
ExpressionAttributeValues: expr.Values(),
TableName: aws.String("projects"),
}
out, err := dynamo.Query(&queryInput)
if err != nil {
panic(err)
}
I get this error:
panic: ValidationException: ExpressionAttributeNames can only be specified when using expressions
I don't know where it's from or what it means: I am using expressions.
I'm not a Go programmer but I wonder if verbose logging the wire traffic might give you insights on what your code is causing to be sent: https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/logging/