Skip to content

Commit

Permalink
executor: updated the SqliteExecutor.create_connection method to ex…
Browse files Browse the repository at this point in the history
…ecute configuration statements in a transaction
  • Loading branch information
fuzeman committed May 18, 2017
1 parent 825d66b commit 060469e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions byte/executors/sqlite/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,15 @@ def create_connection(self):
instance = sqlite3.connect(self.path)
instance.isolation_level = None

# Enable write-ahead logging
instance.execute('PRAGMA journal_mode=WAL;')
# Create connection
connection = SqliteConnection(self, instance)

return SqliteConnection(self, instance)
# Configure connection
with connection.transaction() as transaction:
# Enable write-ahead logging
transaction.execute('PRAGMA journal_mode=WAL;')

return connection

def create_transaction(self, connection=None):
"""Create database transaction.
Expand Down

0 comments on commit 060469e

Please sign in to comment.