This commit is contained in:
Jack Robison 2019-02-13 22:42:29 -05:00 committed by Lex Berezhny
parent 45c6ad3f6d
commit 09726876ad

View file

@ -72,8 +72,9 @@ class AIOSQLite:
self.executor.submit(self.__run_transaction_with_foreign_keys_disabled, fun, *args, **kwargs)
)
def __run_transaction_with_foreign_keys_disabled(self, fun: Callable[[sqlite3.Connection, Any, Any], Any], *args,
**kwargs):
def __run_transaction_with_foreign_keys_disabled(self,
fun: Callable[[sqlite3.Connection, Any, Any], Any],
*args, **kwargs):
foreign_keys_enabled, = self.connection.execute("pragma foreign_keys").fetchone()
if not foreign_keys_enabled:
raise sqlite3.IntegrityError("foreign keys are disabled, use `AIOSQLite.run` instead")