def tables_exist(self):
query = """
SELECT EXISTS (
SELECT 1
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name = 'connection'
);
"""
with connect(self.connection_string) as con:
con.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
with con.cursor() as cur:
cur.execute(query)
result = cur.fetchone()
if result is not None:
exists = result[0]
return exists
return False
评论列表
文章目录