推荐学习书目
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
15399905591
V2EX  ›  Python

postgresql 在 Python 订阅变化的问题

  •  
  •   15399905591 · Mar 21, 2020 · 2560 views
    This topic created in 2271 days ago, the information mentioned may be changed or developed.
    希望在当前应用中监控某些表变化,之前想的方案是通过 sqlalchemy 的触发器去写,
    但是这个方案有两个弊端,一个是侵入式的,对程序不友好,二是该任务执行时间比较长,会影响性能,
    自己在网上查了下方案,发现 mysql 有一个 python-mysql-replication 库,但是 postgresql 的库没找到,
    有没有大佬有类似的库,或者有对应的解决方案,在这感谢大佬了。
    6 replies    2020-03-21 20:07:46 +08:00
    virusdefender
        1
    virusdefender  
       Mar 21, 2020
    如果不是特别实时,记录最后更新时间定期检查就好了,你说的触发器应该是最直接的办法
    15399905591
        2
    15399905591  
    OP
       Mar 21, 2020
    @virusdefender 这里需要实时数据,通过定时器的话, 这个动作比较大。
    dzdh
        3
    dzdh  
       Mar 21, 2020
    这些不是应该是在发生变化的应用程序中实现的吗 为毛要扔给数据库
    tomczhen
        4
    tomczhen  
       Mar 21, 2020 via Android
    你这个需求叫 change data capture 简称 CDC,按关键字去搜就好。
    encro
        5
    encro  
       Mar 21, 2020
    定义 ORM 的 behaviors 的 event 可以啊。
    ericFork
        6
    ericFork  
       Mar 21, 2020
    debezium
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4700 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 01:03 · PVG 09:03 · LAX 18:03 · JFK 21:03
    ♥ Do have faith in what you're doing.