Skip to content

Commit 8350ea8

Browse files
committed
Add support for sqlite3 in table must exist check
1 parent db44606 commit 8350ea8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/DatabaseLibrary/assertion.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ def table_must_exist(self,tableName):
170170
"""
171171
if self.db_api_module_name in ["cx_Oracle"]:
172172
selectStatement = ("select * from all_objects where object_type in ('TABLE','VIEW') and owner = SYS_CONTEXT('USERENV', 'SESSION_USER') and object_name = upper('%s')" % tableName)
173+
elif self.db_api_module_name in ["sqlite3"]:
174+
selectStatement = ("SELECT name FROM sqlite_master WHERE type='table' AND name='%s' COLLATE NOCASE" % tableName)
173175
else:
174176
selectStatement = ("select * from information_schema.tables where table_name='%s'" % tableName)
175177
num_rows = self.row_count(selectStatement)

0 commit comments

Comments
 (0)