From ca65c415833fe16f3e3a4b3ccaa4b1e535d4204f Mon Sep 17 00:00:00 2001 From: Marco Ceppi Date: Fri, 23 Feb 2018 20:43:48 -0500 Subject: [PATCH] Catch any AttributeErrors on primary key detection and return False --- asyncqlio/orm/schema/column.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/asyncqlio/orm/schema/column.py b/asyncqlio/orm/schema/column.py index ba217d6..123711e 100644 --- a/asyncqlio/orm/schema/column.py +++ b/asyncqlio/orm/schema/column.py @@ -207,9 +207,12 @@ def autoincrement(self) -> bool: """ Whether this column is set to autoincrement. """ - if isinstance(self.table.metadata.bind.dialect, sqlite3.Sqlite3Dialect): - return self.primary_key and isinstance(self.type, md_types.Integer) - return isinstance(self.type, md_types.Serial) + try: + if isinstance(self.table.metadata.bind.dialect, sqlite3.Sqlite3Dialect): + return self.primary_key and isinstance(self.type, md_types.Integer) + return isinstance(self.type, md_types.Serial) + except AttributeError: + return False # DDL stuff @classmethod