Compare commits
No commits in common. "db-push-scores" and "main" have entirely different histories.
db-push-sc
...
main
@ -12,4 +12,3 @@ RUN ls ./
|
|||||||
|
|
||||||
# Set CMD to execute the symbolic link, making it look like block.py is the entry
|
# Set CMD to execute the symbolic link, making it look like block.py is the entry
|
||||||
CMD ["python", "/app/block_wrapper.py"]
|
CMD ["python", "/app/block_wrapper.py"]
|
||||||
|
|
||||||
|
|||||||
22
README.md
22
README.md
@ -1,21 +1 @@
|
|||||||
# Block for inserting/upserting scores into the scores table
|
**Hello world!!!**
|
||||||
|
|
||||||
This block is responsible for inserting or updating score records in the `scores` table using the same database configuration as `db_push_v1`.
|
|
||||||
|
|
||||||
## Table DDL
|
|
||||||
|
|
||||||
The following DDL illustrates the `scores` table structure (Postgres style, conceptually compatible with DuckDB for tests):
|
|
||||||
|
|
||||||
```sql
|
|
||||||
-- creating scores table
|
|
||||||
CREATE TABLE IF NOT EXISTS scores (
|
|
||||||
application_key TEXT PRIMARY KEY,
|
|
||||||
application_timestamp TIMESTAMP NOT NULL,
|
|
||||||
hd_score_m1 DOUBLE PRECISION NULL,
|
|
||||||
hd_score_m2 DOUBLE PRECISION NULL,
|
|
||||||
hd_score_iso_m2 DOUBLE PRECISION NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_scores_application_key ON scores(application_key);
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_scores_application_timestamp ON scores(application_timestamp);
|
|
||||||
```
|
|
||||||
|
|||||||
12
config.json
12
config.json
@ -1,14 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"namespace": "staging",
|
"namespace": "",
|
||||||
"connectionId": "56be80f8-7139-466f-b883-e4a695812d52"
|
"connectionId": ""
|
||||||
},
|
|
||||||
{
|
|
||||||
"namespace": "production",
|
|
||||||
"connectionId": "cf2344a8-28d3-4b38-9456-ba9e5c347bf5"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"namespace": "production-beta",
|
|
||||||
"connectionId": "cf2344a8-28d3-4b38-9456-ba9e5c347bf5"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
22
main.sql
22
main.sql
@ -1,21 +1 @@
|
|||||||
INSERT INTO public.scores (
|
Select * from dummy_table limit 10;
|
||||||
application_key,
|
|
||||||
application_timestamp,
|
|
||||||
hd_score_m1,
|
|
||||||
hd_score_m2,
|
|
||||||
hd_score_iso_m2
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
$application_key,
|
|
||||||
$application_timestamp,
|
|
||||||
$hd_score_m1,
|
|
||||||
$hd_score_m2,
|
|
||||||
$hd_score_iso_m2
|
|
||||||
)
|
|
||||||
ON CONFLICT (application_key)
|
|
||||||
DO UPDATE
|
|
||||||
SET application_timestamp = EXCLUDED.application_timestamp,
|
|
||||||
hd_score_m1 = EXCLUDED.hd_score_m1,
|
|
||||||
hd_score_m2 = EXCLUDED.hd_score_m2,
|
|
||||||
hd_score_iso_m2 = EXCLUDED.hd_score_iso_m2;
|
|
||||||
|
|
||||||
@ -1,27 +1 @@
|
|||||||
{
|
{}
|
||||||
"$schema": "http://json-schema.org/draft-07/schema",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"application_key": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"application_timestamp": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"hd_score_m1": {
|
|
||||||
"type": ["number", "null"]
|
|
||||||
},
|
|
||||||
"hd_score_m2": {
|
|
||||||
"type": ["number", "null"]
|
|
||||||
},
|
|
||||||
"hd_score_iso_m2": {
|
|
||||||
"type": ["number", "null"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"application_key",
|
|
||||||
"application_timestamp"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,20 +1 @@
|
|||||||
{
|
{}
|
||||||
"$schema": "http://json-schema.org/draft-07/schema",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"result": {
|
|
||||||
"type": [
|
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"error": {
|
|
||||||
"type": [
|
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": []
|
|
||||||
}
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user