etl.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:train-occupancy 作者: datamindedbe 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号