V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
wuwukai007
V2EX  ›  Python

Python -sql 这个库有大佬用过的吗, tuple(select) 解析 sql 巨慢,一条普通 sql 解析要 1s

  •  
  •   wuwukai007 · 2021-05-04 13:24:23 +08:00 · 1481 次点击
    这是一个创建于 1059 天前的主题,其中的信息可能已经有所发展或是发生改变。

    构造出 sql.Select 类,然后 tuple(select) 解析成字符串 sql,巨慢,看他源码里面父类迭代器

    def __iter__(self):
        yield str(self)
        yield self.params
    
    

    一头雾水,也不知道怎么调试,断点也打不进去

    第 1 条附言  ·  2021-05-04 15:16:54 +08:00
    2 条回复    2021-05-05 03:11:02 +08:00
    zagfai
        1
    zagfai  
       2021-05-04 22:41:18 +08:00
    这些都是越搞越复杂。。。 没啥意义
    no1xsyzy
        2
    no1xsyzy  
       2021-05-05 03:11:02 +08:00
    你分别调试 str(select) 和 select.params 啊
    yield 会跳出当前栈帧但不释放,随后再回到栈帧,何时回当前函数是不确定的,所以不方便调试。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2941 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 15:08 · PVG 23:08 · LAX 08:08 · JFK 11:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.