Skip to content

Instantly share code, notes, and snippets.

@sorsaffari
Created September 14, 2018 10:45
Show Gist options
  • Save sorsaffari/b57395a4cae644439ac5d0e573d0e49b to your computer and use it in GitHub Desktop.
Save sorsaffari/b57395a4cae644439ac5d0e573d0e49b to your computer and use it in GitHub Desktop.
Phone Calls | Loading Data: construct insert query, execute and commit
async function loadDataIntoGrakn(input, session) {
const items = await parseDataToObjects(input);
for (item of items) {
const tx = await session.transaction(Grakn.txType.WRITE);
const graqlInsertQuery = input.template(item);
await tx.query(graqlInsertQuery);
await tx.commit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment