From 8471f32690834bf4ec8ba17c765cfc34ef4d8b55 Mon Sep 17 00:00:00 2001 From: admin user Date: Wed, 12 Mar 2025 16:18:21 +0000 Subject: [PATCH] Push to db block --- README.md | 2 +- config.json | 8 ++++++-- main.sql | 30 +++++++++++++++++++++++++++++- request_schema.json | 39 ++++++++++++++++++++++++++++++++++++++- response_schema.json | 14 +++++++++++++- 5 files changed, 87 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 59a3efc..67982be 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -**Hello world!!!** +# Block for DB operations like lookup, insert, update etc. \ No newline at end of file diff --git a/config.json b/config.json index 41f8111..9ce74cd 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,10 @@ [ { - "namespace": "", - "connectionId": "" + "namespace": "staging", + "connectionId": "e0f62962-1268-4bcf-b336-72ebfbe43578" + }, + { + "namespace": "default", + "connectionId": "default" } ] \ No newline at end of file diff --git a/main.sql b/main.sql index f0129ba..a3b7fac 100644 --- a/main.sql +++ b/main.sql @@ -1 +1,29 @@ -Select * from dummy_table limit 10; \ No newline at end of file +INSERT INTO public.applications ( + application_key, + application_timestamp, + application_ssn, + application_email_address, + application_bank_account_number, + application_is_rejected, + application_date_of_birth, + application_customer_type +) +VALUES ( + $application_key, + $application_timestamp, + $application_ssn, + $application_email_address, + $application_bank_account_number, + $application_is_rejected, + $application_date_of_birth, + $application_customer_type +) +ON CONFLICT (application_key) +DO UPDATE + SET application_timestamp = EXCLUDED.application_timestamp, + application_ssn = EXCLUDED.application_ssn, + application_email_address = EXCLUDED.application_email_address, + application_bank_account_number = EXCLUDED.application_bank_account_number, + application_is_rejected = EXCLUDED.application_is_rejected, + application_date_of_birth = EXCLUDED.application_date_of_birth, + application_customer_type = EXCLUDED.application_customer_type; \ No newline at end of file diff --git a/request_schema.json b/request_schema.json index 9e26dfe..bdfe45e 100644 --- a/request_schema.json +++ b/request_schema.json @@ -1 +1,38 @@ -{} \ No newline at end of file +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "object", + "properties": { + "application_key": { + "type": "string" + }, + "application_timestamp": { + "type": "string", + "format": "date-time" + }, + "application_ssn": { + "type": ["string", "null"] + }, + "application_email_address": { + "type": ["string", "null"], + "format": "email" + }, + "application_bank_account_number": { + "type": ["string", "null"] + }, + "application_is_rejected": { + "type": ["boolean", "null"], + "default": false + }, + "application_date_of_birth": { + "type": ["string", "null"], + "format": "date" + }, + "application_customer_type": { + "type": ["string", "null"] + } + }, + "required": [ + "application_key", + "application_timestamp" + ] +} diff --git a/response_schema.json b/response_schema.json index 9e26dfe..fbddbc6 100644 --- a/response_schema.json +++ b/response_schema.json @@ -1 +1,13 @@ -{} \ No newline at end of file +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "object", + "properties": { + "result": { + "type": ["string", "null"] + }, + "error": { + "type": ["string", "null"] + } + }, + "required": [] +} \ No newline at end of file