Share same connection

This commit is contained in:
2018-07-04 01:16:50 +02:00
parent 7390e6e031
commit 3c22e47d36
3 changed files with 65 additions and 60 deletions

View File

@@ -15,4 +15,17 @@ def create_action(cursor, project_id = '', task_id = '', note_id = '', message =
cursor.execute(query, (project_id, task_id, note_id, getpass.getuser(), message, datetime.datetime.now(),))
logging.debug('created action')
logging.debug('created action')
def read_last_action(conn):
logging.info('> last_action')
# query = 'SELECT * FROM action WHERE id = (SELECT MAX(id) FROM action'
# query = 'SELECT project_id, task_id, note_id FROM action'
query = 'SELECT project_id, task_id, note_id FROM action ORDER BY created_at DESC LIMIT 1;'
cursor = conn.cursor()
cursor.execute(query)
logging.debug('DEEEEEEEEBU')
last_action = cursor.fetchone()
logging.debug(last_action)
return last_action