简体   繁体   English

如何为连接到Vertica或PostgreSQL的python应用程序实现连接池?

[英]How to implement connection pooling for a python application connecting to Vertica or PostgreSQL?

I have a python application which interacts with vertica database through vertica python client. 我有一个python应用程序,它通过vertica python客户端与vertica数据库交互。 Currently there is no connection pool to manage the connections, instead for every request a new connection is opened and then closed at the end of the request. 目前没有连接池来管理连接,而是为每个请求打开一个新连接,然后在请求结束时关闭。 However, this design will cost to handle concurrent requests. 但是,此设计将花费处理并发请求。 Also, the python application is run on a uwsgi and an Nginx server to process multiple requests. 此外,python应用程序在uwsgi和Nginx服务器上运行,以处理多个请求。

I would like to use an existing connection pool to handle connections to vertica from python but I dont seem to find connection pools like C3Po or Hikari in python. 我想使用现有的连接池来处理从python到vertica的连接,但我似乎没有在python中找到像C3Po或Hikari这样的连接池。 Could you please help me with the pools for python - vertica 你能帮我解决python - vertica的游泳池吗?

For native Postgres, have a look at some of the connection pools discussed at Should PostgreSQL connections be pooled in a Python web app, or create a new connection per request? 对于本机Postgres,请看一下在PostNetSQL连接中讨论的一些连接池是在Python Web应用程序中汇集,还是为每个请求创建一个新连接?

For Vertica, it doesn't look like connection pooling is available in the native driver though it might be worth posting an issue on GitHub if you'd like more specific details. 对于Vertica,它看起来不像本机驱动程序中的连接池可用,但如果您想了解更多具体细节,可能值得在GitHub上发布问题。 You could probably use Vertica's ODBC driver through pyODBC since that supports connedction pooling if configured as discussed at http://www.unixodbc.org/doc/conn_pool.html 您可以通过pyODBC使用Vertica的ODBC驱动程序,因为如果按照http://www.unixodbc.org/doc/conn_pool.html中的讨论配置,它支持连接池

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM