<commit_before>#!/usr/bin/env python

from storage import Storage

NEW_REPORT = {'foo': 'bar', 'boo': 'baz'}
REPORTS = {
   "/tmp/example.log": {"MD5": "53f43f9591749b8cae536ff13e48d6de", "SHA256": "815d310bdbc8684c1163b62f583dbaffb2df74b9104e2aadabf8f8491bafab66", "libmagic": "ASCII text"},
   "/opt/other_file": {"MD5": "96b47da202ddba8d7a6b91fecbf89a41", "SHA256": "26d11f0ea5cc77a59b6e47deee859440f26d2d14440beb712dbac8550d35ef1f", "libmagic": "a /bin/python script text executable"},
}

def populate_es():
    db_store = Storage.get_storage()

    return db_store.store(REPORTS)


def main():
    db_store = Storage.get_storage()
    '''
    for key, value in db_store.__dict__.iteritems():
        print '%s: %s' % (key, value)
    print '\n'
    '''

    report_ids = populate_es()

    print db_store.get_report(report_ids[0])
    print db_store.get_report(3)

    db_store.delete(report_ids[0])
    print db_store.delete(2)

    print db_store.get_report(report_ids[0])



if __name__ == '__main__':
    main()<commit_msg>Add code for updating sql db<commit_after>#!/usr/bin/env python

from storage import Storage
from sqlite_driver import Database

NEW_REPORT = {'foo': 'bar', 'boo': 'baz'}
REPORTS = {
   "/tmp/example.log": {"MD5": "53f43f9591749b8cae536ff13e48d6de", "SHA256": "815d310bdbc8684c1163b62f583dbaffb2df74b9104e2aadabf8f8491bafab66", "libmagic": "ASCII text"},
   "/opt/other_file": {"MD5": "96b47da202ddba8d7a6b91fecbf89a41", "SHA256": "26d11f0ea5cc77a59b6e47deee859440f26d2d14440beb712dbac8550d35ef1f", "libmagic": "a /bin/python script text executable"},
}

def populate_es():
    db_store = Storage.get_storage()

    return db_store.store(REPORTS)


def main():
    db_store = Storage.get_storage()
    sql_db = Database()
    sql_db.init_sqlite_db()
    '''
    for key, value in db_store.__dict__.iteritems():
        print '%s: %s' % (key, value)
    print '\n'
    '''
    task_id = sql_db.add_task()
    print sql_db.get_task(task_id)

    report_ids = populate_es()
    sql_db.update_record(
        task_id=task_id,
        task_status='Complete',
        report_id=report_ids
    )
    print sql_db.get_task(task_id)

    print db_store.get_report(report_ids[0])

    # print db_store.get_report(3)

    # db_store.delete(report_ids[0])
    # print db_store.delete(2)

    # print db_store.get_report(report_ids[0])



if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.13778705636743216, 'fraction_numerical': 0.10020876826722339, 'mean_word_length': 4.300884955752212, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4974591', 'n_tokens_mistral': 1104, 'n_tokens_neox': 965, 'n_words': 157}