如何处理PostgreSQL中的多个查询?
我的数据需要每天的delsupsert到10个PostgreSQL表,从Python的Psycopg2列出。我当前的(单个)查询具有30 ctes的插入,更新和删除,据我所知,这些插入,更新和删除仅在最后才能执行。
它很干净,但要调试和理解很复杂是具有挑战性的。重构这种情况以可读性和更容易调试的最佳方法是什么? (存储程序?提高语句?)
I have data that requires a daily delsupsert to 10 PostgreSQL tables, called from Python's psycopg2. My current (single) query has 30 CTEs of inserts, updates, and deletes, that get executed only at the end as far as I know.
It's clean, but it's challenging to debug and complicated to understand. What's the best way to refactor this situation for code readability and easier debugging? (Stored procedures? Raise statements?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论