dataimport/stores.py
changeset 10794 0b4d6beec132
parent 10662 10942ed172de
child 10809 359cbdf3a515
equal deleted inserted replaced
10793:8316fdad9987 10794:0b4d6beec132
    19 Stores are responsible to insert properly formatted entities and relations into the database. They
    19 Stores are responsible to insert properly formatted entities and relations into the database. They
    20 have the following API::
    20 have the following API::
    21 
    21 
    22     >>> user_eid = store.prepare_insert_entity('CWUser', login=u'johndoe')
    22     >>> user_eid = store.prepare_insert_entity('CWUser', login=u'johndoe')
    23     >>> group_eid = store.prepare_insert_entity('CWUser', name=u'unknown')
    23     >>> group_eid = store.prepare_insert_entity('CWUser', name=u'unknown')
    24     >>> store.relate(user_eid, 'in_group', group_eid)
    24     >>> store.prepare_insert_relation(user_eid, 'in_group', group_eid)
    25     >>> store.flush()
    25     >>> store.flush()
    26     >>> store.commit()
    26     >>> store.commit()
    27     >>> store.finish()
    27     >>> store.finish()
    28 
    28 
    29 Some store **requires a flush** to copy data in the database, so if you want to have store
    29 Some store **requires a flush** to copy data in the database, so if you want to have store