sqlite_context.py 文件源码

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

项目:py 作者: stencila 项目源码 文件源码
def runCode(self, code):
        errors = None
        output = undefined
        try:
            if code.lstrip().upper().startswith('SELECT '):
                output = pandas.read_sql_query(code, self._connection)
            else:
                self._connection.execute(code)
        except Exception as exc:
            errors = [{
                'line': 0,
                'column': 0,
                'message': str(exc)
            }]

        return {
            'errors': errors,
            'output': None if output is undefined else pack(output)
        }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号