<commit_before>from pprint import pprint
import config
import re
import sys
import io
sys.path.append("lib")
from models import PeeWeeEvent, PeeWeeSuperblock, PeeWeeProposal, PeeWeeGovernanceObject
#from datetime import datetime, date, time
from time import time

# e = PeeWeeEvent()
# e.governance_object_id = 7
# print e.get_dict()

# check if object with name 'helloworld6' exists
#
#PeeWeeGovernanceObject
#object_name: helloworld6

#on = 'helloworld6'
#count = PeeWeeGovernanceObject.select().where(PeeWeeGovernanceObject.object_name == on).count()
#print "count = %d" % count

#print PeeWeeGovernanceObject.object_with_name_exists(on)

# select count(*) from governance_object
# where governance_object.object_name = %s

#print PeeWeeEvent.delete().execute()
#print PeeWeeSuperblock.delete().execute()
#print PeeWeeProposal.delete().execute()
#print PeeWeeGovernanceObject.delete().execute()


#pw = PeeWeeEvent.get(PeeWeeEvent.id == 9)
#print pw.governance_object_id

# epoch = int(time())

# SELECT t1`.`id`, `t1`.`governance_object_id`, `t1`.`start_time`, `t1`.`prepare_time`, `t1`.`submit_time`, `t1`.`error_time`, `t1`.`error_message` FROM `event` AS t1 WHERE (((`t1`.`start_time` < %s) AND (`t1`.`error_time` = %s)) AND (`t1`.`prepare_time` = %s))', [1471728359, 0, 0])
#
#e = PeeWeeEvent.get(
#    (PeeWeeEvent.start_time < epoch ) &
#    (PeeWeeEvent.error_time == 0) &
#    (PeeWeeEvent.prepare_time == 0)
#)
#print(e.id)


gobj = PeeWeeGovernanceObject.get()
print gobj.object_name

gobj.__setattr__( 'object_name' , '123456' )
gobj.save()
print gobj.object_name
<commit_msg>UTIL/TOOL: dbtest<commit_after>from pprint import pprint
import config
import re
import sys
import io
sys.path.append("lib")

from models import PeeWeeEvent, PeeWeeSuperblock, PeeWeeProposal, PeeWeeGovernanceObject
from time import time

# e = PeeWeeEvent()
# e.governance_object_id = 7
# print e.get_dict()

# check if object with name 'helloworld6' exists
#
#PeeWeeGovernanceObject
#object_name: helloworld6

#on = 'helloworld6'
#count = PeeWeeGovernanceObject.select().where(PeeWeeGovernanceObject.object_name == on).count()
#print "count = %d" % count

#print PeeWeeGovernanceObject.object_with_name_exists(on)

# select count(*) from governance_object
# where governance_object.object_name = %s

#print PeeWeeEvent.delete().execute()
#print PeeWeeSuperblock.delete().execute()
#print PeeWeeProposal.delete().execute()
#print PeeWeeGovernanceObject.delete().execute()


#pw = PeeWeeEvent.get(PeeWeeEvent.id == 9)
#print pw.governance_object_id

# epoch = int(time())

# SELECT t1`.`id`, `t1`.`governance_object_id`, `t1`.`start_time`, `t1`.`prepare_time`, `t1`.`submit_time`, `t1`.`error_time`, `t1`.`error_message` FROM `event` AS t1 WHERE (((`t1`.`start_time` < %s) AND (`t1`.`error_time` = %s)) AND (`t1`.`prepare_time` = %s))', [1471728359, 0, 0])
#
#e = PeeWeeEvent.get(
#    (PeeWeeEvent.start_time < epoch ) &
#    (PeeWeeEvent.error_time == 0) &
#    (PeeWeeEvent.prepare_time == 0)
#)
#print(e.id)

#gobj = PeeWeeGovernanceObject.get()
#print gobj.object_name

#gobj.__setattr__( 'object_name' , '123456' )
#gobj.save()
#print gobj.object_name


e = PeeWeeEvent.get()
print e.start_time

e.start_time = 1471751122
e.save()

# PeeWeeEvent._meta.database.commit()


{'fraction_non_alphanumeric': 0.15365779002142638, 'fraction_numerical': 0.02509947964493419, 'mean_word_length': 6.012875536480687, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3124566', 'n_tokens_mistral': 1343, 'n_tokens_neox': 1273, 'n_words': 247}