postgres.py 文件源码

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

项目:dbt 作者: fishtown-analytics 项目源码 文件源码
def exception_handler(cls, profile, sql, model_name=None,
                          connection_name=None):
        connection = cls.get_connection(profile, connection_name)

        try:
            yield

        except psycopg2.DatabaseError as e:
            logger.debug('Postgres error: {}'.format(str(e)))

            cls.release_connection(profile, connection_name)
            raise dbt.exceptions.DatabaseException(
                dbt.compat.to_string(e).strip())

        except Exception as e:
            logger.debug("Error running SQL: %s", sql)
            logger.debug("Rolling back transaction.")
            cls.release_connection(profile, connection_name)
            raise dbt.exceptions.RuntimeException(e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号