Commit to the database after we write to it
This commit is contained in:
parent
c534d52fc4
commit
bb34a4dd87
1 changed files with 5 additions and 6 deletions
11
storage.py
11
storage.py
|
@ -29,8 +29,8 @@ class Storage(object):
|
||||||
logger.info("Performing initial database setup...")
|
logger.info("Performing initial database setup...")
|
||||||
|
|
||||||
# Initialize a connection to the database
|
# Initialize a connection to the database
|
||||||
conn = sqlite3.connect(self.db_path)
|
self.conn = sqlite3.connect(self.db_path)
|
||||||
self.cursor = conn.cursor()
|
self.cursor = self.conn.cursor()
|
||||||
|
|
||||||
# Sync token table
|
# Sync token table
|
||||||
self.cursor.execute("CREATE TABLE sync_token ("
|
self.cursor.execute("CREATE TABLE sync_token ("
|
||||||
|
@ -42,10 +42,8 @@ class Storage(object):
|
||||||
def _run_migrations(self):
|
def _run_migrations(self):
|
||||||
"""Execute database migrations"""
|
"""Execute database migrations"""
|
||||||
# Initialize a connection to the database
|
# Initialize a connection to the database
|
||||||
conn = sqlite3.connect(self.db_path)
|
self.conn = sqlite3.connect(self.db_path)
|
||||||
self.cursor = conn.cursor()
|
self.cursor = self.conn.cursor()
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
def get_sync_token(self):
|
def get_sync_token(self):
|
||||||
"""Retrieve the next_batch token from the last sync response.
|
"""Retrieve the next_batch token from the last sync response.
|
||||||
|
@ -73,3 +71,4 @@ class Storage(object):
|
||||||
"""
|
"""
|
||||||
self.cursor.execute("INSERT OR REPLACE INTO sync_token"
|
self.cursor.execute("INSERT OR REPLACE INTO sync_token"
|
||||||
" (token) VALUES (?)", (token,))
|
" (token) VALUES (?)", (token,))
|
||||||
|
self.conn.commit()
|
||||||
|
|
Loading…
Reference in a new issue