[datafeed] simplify SQL query used to retrieve information about entities from an external source
no need to join on cw_source
--- a/cubicweb/server/sources/datafeed.py Wed Jul 01 08:42:44 2015 +0200
+++ b/cubicweb/server/sources/datafeed.py Wed Jul 01 08:45:29 2015 +0200
@@ -289,11 +289,9 @@
eidfrom=entity.eid, rtype=attr, eidto=value)
def source_uris(self, cnx):
- sql = ('SELECT extid, eid, type FROM entities, cw_source_relation '
- 'WHERE entities.eid=cw_source_relation.eid_from '
- 'AND cw_source_relation.eid_to=%s' % self.eid)
+ sql = 'SELECT extid, eid, type FROM entities WHERE asource=%(source)s'
return dict((self.decode_extid(uri), (eid, type))
- for uri, eid, type in cnx.system_sql(sql).fetchall())
+ for uri, eid, type in cnx.system_sql(sql, {'source': self.uri}).fetchall())
def init_import_log(self, cnx, import_log_eid=None, **kwargs):
if import_log_eid is None: