Coverage for toardb/stationmeta/models_aux.py: 100%

34 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""" 

5class StationMetaAux (Base) 

6=========================== 

7 

8class StationMetaAuxURL (Base) 

9------------------------------ 

10 

11class StationMetaAuxDoc (Base) 

12------------------------------ 

13 

14class StationMetaAuxImage (Base) 

15-------------------------------- 

16""" 

17from sqlalchemy import CheckConstraint, Column, DateTime, ForeignKey, Integer, String, Text, Sequence 

18from sqlalchemy.orm import relationship 

19from .models_core import StationmetaCore 

20from toardb.base import Base 

21 

22 

23STATIONMETA_AUX_DOC_ID_SEQ = Sequence('stationmeta_aux_doc_id_seq') #define sequence explicitly 

24class StationmetaAuxDoc(Base): 

25 """ 

26 Table "public.stationmeta_aux_doc" 

27 

28 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

29 | Column | Type | Collation | Nullable | Default | 

30 +======================+==========================+===========+==========+=================================================+ 

31 | id | integer | | not null | nextval('stationmeta_aux_doc_id_seq'::regclass) | 

32 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

33 | resource_description | text | | not null | | 

34 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

35 | date_added | timestamp with time zone | | not null | | 

36 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

37 | resource | character varying(100) | | not null | | 

38 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

39 | station_id | integer | | | | 

40 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

41 

42 Indexes: 

43 "stationmeta_aux_doc_pkey" PRIMARY KEY, btree (id) 

44 "stationmeta_aux_doc_station_id_17bdb5f2" btree (station_id) 

45 Foreign-key constraints: 

46 "stationmeta_aux_doc_station_id_17bdb5f2_fk_stationmeta_core_id" FOREIGN KEY (station_id) REFERENCES stationmeta_core(id) DEFERRABLE INITIALLY DEFERRED 

47 """ 

48 

49 __tablename__ = 'stationmeta_aux_doc' 

50 

51 id = Column(Integer, STATIONMETA_AUX_DOC_ID_SEQ, primary_key=True, server_default=STATIONMETA_AUX_DOC_ID_SEQ.next_value()) 

52 resource_description = Column(Text, nullable=False) 

53 date_added = Column(DateTime(True), nullable=False) 

54 resource = Column(String(100), nullable=False) 

55 station_id = Column(ForeignKey(StationmetaCore.id, deferrable=True, initially='DEFERRED'), index=True) 

56 

57 station = relationship('StationmetaCore') 

58 

59 

60STATIONMETA_AUX_IMAGE_ID_SEQ = Sequence('stationmeta_aux_image_id_seq') #define sequence explicitly 

61class StationmetaAuxImage(Base): 

62 """ 

63 Table "public.stationmeta_aux_image" 

64 

65 +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ 

66 | Column | Type | Collation | Nullable | Default | 

67 +======================+==========================+===========+==========+===================================================+ 

68 | id | integer | | not null | nextval('stationmeta_aux_image_id_seq'::regclass) | 

69 +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ 

70 | resource_description | text | | not null | | 

71 +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ 

72 | date_added | timestamp with time zone | | not null | | 

73 +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ 

74 | resource | character varying(100) | | not null | | 

75 +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ 

76 | image_height | integer | | not null | | 

77 +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ 

78 | image_width | integer | | not null | | 

79 +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ 

80 | station_id | integer | | | | 

81 +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ 

82 

83 Indexes: 

84 "stationmeta_aux_image_pkey" PRIMARY KEY, btree (id) 

85 "stationmeta_aux_image_station_id_fbfbdb29" btree (station_id) 

86 Check constraints: 

87 "stationmeta_aux_image_image_height_check" CHECK (image_height >= 0) 

88 "stationmeta_aux_image_image_width_check" CHECK (image_width >= 0) 

89 Foreign-key constraints: 

90 "stationmeta_aux_imag_station_id_fbfbdb29_fk_stationme" FOREIGN KEY (station_id) REFERENCES stationmeta_core(id) DEFERRABLE INITIALLY DEFERRED 

91 """ 

92 

93 __tablename__ = 'stationmeta_aux_image' 

94 __table_args__ = ( 

95 CheckConstraint('image_height >= 0'), 

96 CheckConstraint('image_width >= 0') 

97 ) 

98 

99 id = Column(Integer, STATIONMETA_AUX_IMAGE_ID_SEQ, primary_key=True, server_default=STATIONMETA_AUX_IMAGE_ID_SEQ.next_value()) 

100 resource_description = Column(Text, nullable=False) 

101 date_added = Column(DateTime(True), nullable=False) 

102 resource = Column(String(100), nullable=False) 

103 image_height = Column(Integer, nullable=False) 

104 image_width = Column(Integer, nullable=False) 

105 station_id = Column(ForeignKey(StationmetaCore.id, deferrable=True, initially='DEFERRED'), index=True) 

106 

107 station = relationship('StationmetaCore') 

108 

109 

110STATIONMETA_AUX_URL_ID_SEQ = Sequence('stationmeta_aux_url_id_seq') #define sequence explicitly 

111class StationmetaAuxUrl(Base): 

112 """ 

113 Table "public.stationmeta_aux_url" 

114 

115 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

116 | Column | Type | Collation | Nullable | Default | 

117 +======================+==========================+===========+==========+=================================================+ 

118 | id | integer | | not null | nextval('stationmeta_aux_url_id_seq'::regclass) | 

119 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

120 | resource_description | text | | not null | | 

121 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

122 | date_added | timestamp with time zone | | not null | | 

123 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

124 | resource | character varying(200) | | not null | | 

125 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

126 | station_id | integer | | | | 

127 +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ 

128 

129 Indexes: 

130 "stationmeta_aux_url_pkey" PRIMARY KEY, btree (id) 

131 "stationmeta_aux_url_station_id_727571bd" btree (station_id) 

132 Foreign-key constraints: 

133 "stationmeta_aux_url_station_id_727571bd_fk_stationmeta_core_id" FOREIGN KEY (station_id) REFERENCES stationmeta_core(id) DEFERRABLE INITIALLY DEFERRED 

134 """ 

135 

136 __tablename__ = 'stationmeta_aux_url' 

137 

138 id = Column(Integer, STATIONMETA_AUX_URL_ID_SEQ, primary_key=True, server_default=STATIONMETA_AUX_URL_ID_SEQ.next_value()) 

139 resource_description = Column(Text, nullable=False) 

140 date_added = Column(DateTime(True), nullable=False) 

141 resource = Column(String(200), nullable=False) 

142 station_id = Column(ForeignKey(StationmetaCore.id, deferrable=True, initially='DEFERRED'), index=True) 

143 

144 station = relationship('StationmetaCore') 

145