Coverage for toardb/variables/schemas.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-11-03 20:32 +0000

1# SPDX-FileCopyrightText: 2021 Forschungszentrum Jülich GmbH 

2# SPDX-License-Identifier: MIT 

3 

4""" 

5Pydantic schemas for TOAR database 

6 

7""" 

8 

9from pydantic import BaseModel, Field 

10 

11 

12class VariableBase(BaseModel): 

13 name: str = Field( 

14 None, description="Name. Short variable-like name of the variable" 

15 ) 

16 longname: str = Field( 

17 None, description="Longname. Long (explicit) name of the variable" 

18 ) 

19 displayname: str = Field( 

20 None, description="Displayname. Display name of the variable" 

21 ) 

22 cf_standardname: str = Field( 

23 None, description="Cf standardname. " 

24 + "CF standard name of the variable if defined" 

25 ) 

26 units: str = Field(None, description="Units. Physical units of variable") 

27 chemical_formula: str = Field( 

28 None, 

29 description="Chemical formula. " 

30 + "Chemical formula of variable(if applicable)", 

31 ) 

32 

33 

34class VariableCreate(VariableBase): 

35 pass 

36 

37 

38class Variable(VariableBase): 

39 id: int = None 

40 

41 class Config: 

42 orm_mode = True