Extract parser

This commit is contained in:
2018-07-05 00:09:21 +02:00
parent c1483a43e4
commit bee3fd96b5
3 changed files with 101 additions and 55 deletions

View File

@@ -11,7 +11,8 @@ class Action:
def __init__(self, row):
if not row:
logging.debug('Action - empty row')
raise Exception('No action found - database need to be initialized.')
# TODO
# raise Exception('No action found - database need to be initialized.')
else:
logging.debug('Action - fill fields')
self.project_id, self.task_id, self.note_id = row
@@ -19,6 +20,16 @@ class Action:
def __str__(self):
return str(self.__dict__)
def handle_action(args, last_action, conn):
logging.info('>> handle action')
query = 'SELECT * FROM action;'
cursor = conn.cursor()
cursor.execute(query)
for row in cursor.fetchall():
result = row
logging.debug(result)
def create_action(cursor, project_id = '', task_id = '', note_id = '', message = ''):
query = """
INSERT INTO action (project_id, task_id, note_id, username, message, created_at)