MCPcopy Create free account
hub / github.com/diffgram/diffgram / get

Method get

shared/database/external/external.py:143–216  ·  view source on GitHub ↗

(session,
            external_id=None,
            connection_id=None,
            job_id=None,
            task_id=None,
            file_id=None,
            diffgram_class_string: str = None,
            type: str = None,
            attribute_template_id: int = None,
            attribute_template_group_id: int = None,
            limit=100,
            return_kind="first",  # [first, all, count]
            date_to=None,
            date_from=None
            )

Source from the content-addressed store, hash-verified

141
142 @staticmethod
143 def get(session,
144 external_id=None,
145 connection_id=None,
146 job_id=None,
147 task_id=None,
148 file_id=None,
149 diffgram_class_string: str = None,
150 type: str = None,
151 attribute_template_id: int = None,
152 attribute_template_group_id: int = None,
153 limit=100,
154 return_kind="first", # [first, all, count]
155 date_to=None,
156 date_from=None
157 ):
158 """
159 """
160 query = session.query(ExternalMap)
161
162 if external_id:
163 query = query.filter(ExternalMap.external_id == external_id)
164
165 if connection_id:
166 query = query.filter(ExternalMap.connection_id == connection_id)
167
168 if job_id:
169 query = query.filter(ExternalMap.job_id == job_id)
170
171 if task_id:
172 query = query.filter(ExternalMap.task_id == task_id)
173
174 if attribute_template_id:
175 query = query.filter(ExternalMap.attribute_template_id == attribute_template_id)
176
177 if attribute_template_group_id:
178 query = query.filter(ExternalMap.attribute_template_group_id == attribute_template_group_id)
179
180 if file_id:
181 if isinstance(file_id, collections.Iterable):
182 query = query.filter(ExternalMap.file_id.in_(file_id))
183 else:
184 query = query.filter(ExternalMap.file_id == file_id)
185 if diffgram_class_string:
186 query = query.filter(ExternalMap.diffgram_class_string == diffgram_class_string)
187
188 if type:
189 query = query.filter(ExternalMap.type == type)
190
191 # TODO would like from this point on to be more abstract mixin, since it's used often
192 if date_to or date_from:
193 datetime_property = ExternalMap.time_created
194
195 if date_from and date_to:
196 query = query.filter(
197 datetime_property >= date_from,
198 datetime_property <= date_to)
199 else:
200 if date_from:

Callers 2

__new_event_threadedMethod · 0.45

Calls 1

countMethod · 0.45

Tested by

no test coverage detected