[dataimport] make it possible to insert 'empty' (i.e. no-attrs) entities
In such cases (e.g. ternary relations), generated RQL must be
'INSERT MyEntityType' instead of 'INSERT MyEntityType:'
--- a/dataimport.py Mon Feb 14 09:37:17 2011 +0100
+++ b/dataimport.py Mon Feb 14 16:46:49 2011 +0100
@@ -453,8 +453,10 @@
return entity
def _put(self, type, item):
- query = ('INSERT %s X: ' % type) + ', '.join('X %s %%(%s)s' % (k, k)
- for k in item)
+ query = 'INSERT %s X' % type
+ if item:
+ query += ': ' + ', '.join('X %s %%(%s)s' % (k, k)
+ for k in item)
return self.rql(query, item)[0][0]
def relate(self, eid_from, rtype, eid_to, inlined=False):