equal
deleted
inserted
replaced
133 if uri == 'admin': |
133 if uri == 'admin': |
134 # not an actual source |
134 # not an actual source |
135 continue |
135 continue |
136 source = self.get_source(uri, source_config) |
136 source = self.get_source(uri, source_config) |
137 self.sources_by_uri[uri] = source |
137 self.sources_by_uri[uri] = source |
138 self.sources.append(source) |
138 if config.source_enabled(uri): |
|
139 self.sources.append(source) |
139 self.system_source = self.sources_by_uri['system'] |
140 self.system_source = self.sources_by_uri['system'] |
140 # ensure system source is the first one |
141 # ensure system source is the first one |
141 self.sources.remove(self.system_source) |
142 self.sources.remove(self.system_source) |
142 self.sources.insert(0, self.system_source) |
143 self.sources.insert(0, self.system_source) |
143 # cache eid -> type / source |
144 # cache eid -> type / source |
198 # internal session, which is not possible until pools have been |
199 # internal session, which is not possible until pools have been |
199 # initialized) |
200 # initialized) |
200 for source in self.sources: |
201 for source in self.sources: |
201 source.init() |
202 source.init() |
202 else: |
203 else: |
203 # call init_creating so for instance native source can configurate |
204 # call init_creating so that for instance native source can |
204 # tsearch according to postgres version |
205 # configurate tsearch according to postgres version |
205 for source in self.sources: |
206 for source in self.sources: |
206 source.init_creating() |
207 source.init_creating() |
207 # close initialization pool and reopen fresh ones for proper |
208 # close initialization pool and reopen fresh ones for proper |
208 # initialization now that we know cubes |
209 # initialization now that we know cubes |
209 self._get_pool().close(True) |
210 self._get_pool().close(True) |
232 # trigger full reload of all appobjects |
233 # trigger full reload of all appobjects |
233 self.vreg.set_schema(schema) |
234 self.vreg.set_schema(schema) |
234 else: |
235 else: |
235 self.vreg._set_schema(schema) |
236 self.vreg._set_schema(schema) |
236 self.querier.set_schema(schema) |
237 self.querier.set_schema(schema) |
237 for source in self.sources: |
238 # don't use self.sources, we may want to give schema even to disabled |
|
239 # sources |
|
240 for source in self.sources_by_uri.values(): |
238 source.set_schema(schema) |
241 source.set_schema(schema) |
239 self.schema = schema |
242 self.schema = schema |
240 |
243 |
241 def fill_schema(self): |
244 def fill_schema(self): |
242 """lod schema from the repository""" |
245 """lod schema from the repository""" |
1243 |
1246 |
1244 # multi-sources planner helpers ########################################### |
1247 # multi-sources planner helpers ########################################### |
1245 |
1248 |
1246 @cached |
1249 @cached |
1247 def rel_type_sources(self, rtype): |
1250 def rel_type_sources(self, rtype): |
1248 return [source for source in self.sources |
1251 return tuple([source for source in self.sources |
1249 if source.support_relation(rtype) |
1252 if source.support_relation(rtype) |
1250 or rtype in source.dont_cross_relations] |
1253 or rtype in source.dont_cross_relations]) |
1251 |
1254 |
1252 @cached |
1255 @cached |
1253 def can_cross_relation(self, rtype): |
1256 def can_cross_relation(self, rtype): |
1254 return [source for source in self.sources |
1257 return tuple([source for source in self.sources |
1255 if source.support_relation(rtype) |
1258 if source.support_relation(rtype) |
1256 and rtype in source.cross_relations] |
1259 and rtype in source.cross_relations]) |
1257 |
1260 |
1258 @cached |
1261 @cached |
1259 def is_multi_sources_relation(self, rtype): |
1262 def is_multi_sources_relation(self, rtype): |
1260 return any(source for source in self.sources |
1263 return any(source for source in self.sources |
1261 if not source is self.system_source |
1264 if not source is self.system_source |