From e936a530ccca3f27e70632bb69e3bc2cfe95b95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Santos?= Date: Thu, 5 May 2016 19:26:34 +0200 Subject: [PATCH] Pass Database.__init__ kwargs to create_engine This change allows setting the behaviour of the SQLAlchemy engine (for example setting check_same_thread to False for sqlite3 databases). --- records.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/records.py b/records.py index c791b60..d22523b 100644 --- a/records.py +++ b/records.py @@ -196,7 +196,7 @@ class RecordCollection(object): class Database(object): """A Database connection.""" - def __init__(self, db_url=None): + def __init__(self, db_url=None, **kwargs): # If no db_url was provided, fallback to $DATABASE_URL. self.db_url = db_url or DATABASE_URL @@ -204,7 +204,7 @@ class Database(object): raise ValueError('You must provide a db_url.') # Connect to the database. - self.db = create_engine(self.db_url).connect() + self.db = create_engine(self.db_url, **kwargs).connect() self.open = True def close(self):