-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAWStest.py
More file actions
51 lines (35 loc) · 1.09 KB
/
Copy pathAWStest.py
File metadata and controls
51 lines (35 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import boto3
from boto3.dynamodb.conditions import Attr, Key
from typing import Optional
from pydantic import BaseModel, validator
class PydanticBase(BaseModel):
@validator("*")
def check_sum(cls, v):
if v == "":
raise ValueError("Value cannot be an empty string")
return v
class Config:
orm_mode = True
arbitrary_types_allowed = True
class ModelDetails(PydanticBase):
records_processed: str
status: str
test: Optional[str]
class Test(PydanticBase):
ground_truth_records_processed: int
model_version_name: str
execution_id: str
created: str
is_adhoc: bool
job_id: str
model_details: Optional[ModelDetails]
modified: str
dynamodb = boto3.resource('dynamodb', region_name="eu-west-2")
table = dynamodb.Table("job_details")
scan_kwargs = {"FilterExpression": Attr("model_version_name").eq("risk_auto_sum_1.0.1")}
response = table.scan(**scan_kwargs)
result = response["Items"]
results = result[0]
snapshot_obj = Test(**results)
print(snapshot_obj.model_details.test)
assert snapshot_obj.model_details.test