aws / aws-sdk-go-v2

AWS SDK for the Go programming language.
https://aws.github.io/aws-sdk-go-v2/docs/
Apache License 2.0
2.5k stars 602 forks source link

How to set a field to NULL using the Redshift Data API? #2621

Closed JoseAngel1196 closed 2 months ago

JoseAngel1196 commented 2 months ago

Describe the issue

AWS indicates that you cannot set a value to NULL nor can you set a zero-length value. Is there a way to handle this using the Redshift Data API?

My code:

if value == "" {
                paramValue = "null"
            } else {
                paramValue = fmt.Sprintf("%v", value)
            }
            parameters = append(parameters, types.SqlParameter{
                Name:  aws.String(paramName),
                Value: aws.String(paramValue),
            })

As you can see, if the value is empty, we're using a literal string 'null' and would prefer to store it as NULL. How can I achieve this?

Links

https://docs.aws.amazon.com/redshift/latest/mgmt/data-api.html

AWS Go SDK V2 Module Versions Used

No response

lucix-aws commented 2 months ago

https://github.com/aws/aws-sdk-go-v2/discussions/2619

github-actions[bot] commented 2 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.