jeremydaly / data-api-client

A "DocumentClient" for the Amazon Aurora Serverless Data API
MIT License
439 stars 61 forks source link

How to handle null / undefined values when inserting / updating data rows? #50

Closed the-smart-home-maker closed 4 years ago

the-smart-home-maker commented 4 years ago

Dear data-api-client supporters,

I have a simple question: How to handle null / undefined values when inserting / updating data rows? No matter if I leave parameters as undefined or explicitly set them as null, I always receive an error message either saying 'field_x' is an invalid type (when passing the parameter as undefined) or Unknown column 'field_x' in 'field list' (when passing the parameter as null). How can I explicitly set a field as NULL in the database?

Thanks a lot and best regards The Smart Home Maker

the-smart-home-maker commented 4 years ago

I got it working - was a problem with my setup so we can close this issue

martinpllu commented 3 years ago

Hi @the-smart-home-maker, I'm facing the same issue - can I ask how you resolved it please?

the-smart-home-maker commented 3 years ago

Hi @the-smart-home-maker, I'm facing the same issue - can I ask how you resolved it please?

Hi @martinpllu,

I figured you need to make sure to explicitly set missing values to null, not undefined. That should do the trick.

martinpllu commented 3 years ago

Thanks @the-smart-home-maker https://github.com/the-smart-home-maker, much appreciated!

On Sun, 27 Sep 2020 at 11:36, The Smart Home Maker notifications@github.com wrote:

Hi @the-smart-home-maker https://github.com/the-smart-home-maker, I'm facing the same issue - can I ask how you resolved it please?

Hi @martinpllu https://github.com/martinpllu,

I figured you need to make sure to explicitly set missing values to null, not undefined. That should do the trick.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jeremydaly/data-api-client/issues/50#issuecomment-699617451, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF7LVUTYLO7T5YZWL3LBD3SH4IRDANCNFSM4OM73SVA .