Coverage for /pythoncovmergedfiles/medio/medio/src/airflow/airflow/serialization/pydantic/dataset.py: 100%

40 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 06:35 +0000

1# Licensed to the Apache Software Foundation (ASF) under one 

2# or more contributor license agreements. See the NOTICE file 

3# distributed with this work for additional information 

4# regarding copyright ownership. The ASF licenses this file 

5# to you under the Apache License, Version 2.0 (the 

6# "License"); you may not use this file except in compliance 

7# with the License. You may obtain a copy of the License at 

8# 

9# http://www.apache.org/licenses/LICENSE-2.0 

10# 

11# Unless required by applicable law or agreed to in writing, 

12# software distributed under the License is distributed on an 

13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 

14# KIND, either express or implied. See the License for the 

15# specific language governing permissions and limitations 

16# under the License. 

17from datetime import datetime 

18from typing import List, Optional 

19 

20from pydantic import BaseModel as BaseModelPydantic 

21 

22 

23class DagScheduleDatasetReferencePydantic(BaseModelPydantic): 

24 """ 

25 Serializable representation of the DagScheduleDatasetReference 

26 ORM SqlAlchemyModel used by internal API. 

27 """ 

28 

29 dataset_id: int 

30 dag_id: str 

31 created_at: datetime 

32 updated_at: datetime 

33 

34 class Config: 

35 """Make sure it deals automatically with SQLAlchemy ORM classes.""" 

36 

37 orm_mode = True 

38 

39 

40class TaskOutletDatasetReferencePydantic(BaseModelPydantic): 

41 """ 

42 Serializable representation of the 

43 TaskOutletDatasetReference ORM SqlAlchemyModel used by internal API. 

44 """ 

45 

46 dataset_id: int 

47 dag_id = str 

48 task_id = str 

49 created_at = datetime 

50 updated_at = datetime 

51 

52 class Config: 

53 """Make sure it deals automatically with SQLAlchemy ORM classes.""" 

54 

55 orm_mode = True 

56 

57 

58class DatasetPydantic(BaseModelPydantic): 

59 """Serializable representation of the Dataset ORM SqlAlchemyModel used by internal API.""" 

60 

61 id: int 

62 uri: str 

63 extra: Optional[dict] 

64 created_at: datetime 

65 updated_at: datetime 

66 is_orphaned: bool 

67 

68 consuming_dags: List[DagScheduleDatasetReferencePydantic] 

69 producing_tasks: List[TaskOutletDatasetReferencePydantic] 

70 

71 class Config: 

72 """Make sure it deals automatically with SQLAlchemy ORM classes.""" 

73 

74 orm_mode = True 

75 

76 

77class DatasetEventPydantic(BaseModelPydantic): 

78 """Serializable representation of the DatasetEvent ORM SqlAlchemyModel used by internal API.""" 

79 

80 id: int 

81 source_task_id: Optional[str] 

82 source_dag_id: Optional[str] 

83 source_run_id: Optional[str] 

84 extra: Optional[dict] 

85 source_map_index: int 

86 timestamp: datetime 

87 dataset: DatasetPydantic 

88 

89 class Config: 

90 """Make sure it deals automatically with SQLAlchemy ORM classes.""" 

91 

92 orm_mode = True