misc/scripts/drop_external_entities.py
changeset 7398 26695dd703d8
parent 6636 dbc9cce53c11
child 7884 35d2e2f4e10a
equal deleted inserted replaced
7397:6a9e66d788b3 7398:26695dd703d8
     1 from cubicweb import UnknownEid
     1 from cubicweb import UnknownEid
     2 source, = __args__
     2 source, = __args__
     3 
     3 
     4 sql("DELETE FROM entities WHERE type='Int'")
     4 sql("DELETE FROM entities WHERE type='Int'")
     5 
     5 
     6 ecnx = session.pool.connection(source)
     6 ecnx = session.cnxset.connection(source)
     7 for e in rql('Any X WHERE X cw_source S, S name %(name)s', {'name': source}).entities():
     7 for e in rql('Any X WHERE X cw_source S, S name %(name)s', {'name': source}).entities():
     8     meta = e.cw_metainformation()
     8     meta = e.cw_metainformation()
     9     assert meta['source']['uri'] == source
     9     assert meta['source']['uri'] == source
    10     try:
    10     try:
    11         suri = ecnx.describe(meta['extid'])[1]
    11         suri = ecnx.describe(meta['extid'])[1]