Database validation before entry – JSON

1 points by californiacream ↗ HN
Hi all, is it possible to set up real database json validation without entering data into a dB? Sort of like a rolled back entry (perhaps in real-time, or close to it) whilst data entry is occuring?

For example, the moment a data entered row has been completed (or earlier, perhaps?), send a rest API (pseudo)-post request just to see if data can get into database in its complete form - that is passing all primary and foreign key constraints, as well as triggers/constraints.

If data is no good, present the user an enumerated list of issues in real-time (Error: Please ensure that item X exists in library Y - would you like to quickly add X to Y?).

If all validations pass, and data is truly valid, allow option to do the post request for real.

I'm sure this is not novel, but don't know the search term to find info on it.

Any ideas? I am ideally using this with Postgres, JSON, FastAPI, and pydantic etc.

0 comments

[ 4.3 ms ] story [ 11.6 ms ] thread

No comments yet.