biothings.web.connections
- biothings.web.connections.get_es_client(hosts=None, async_=False, **settings)[source]
Enhanced ES client initialization.
- Additionally support these parameters:
async_: use AsyncElasticserach instead of Elasticsearch. aws: setup request signing and provide reasonable ES settings
to access AWS OpenSearch, by default assuming it is on HTTPS.
- sniff: provide resonable default settings to enable client-side
LB to an ES cluster. this param itself is not an ES param.
Additionally, you can reuse connecions initialized with the same parameters by getting it from the connection pools every time. Here’s the connection pool interface signature:
- class biothings.web.connections._ClientPool(client_factory, async_factory, callback=None)[source]
Bases:
object
The module has already initialized connection pools for each supported databases. Directly access these pools without creating by yourselves.
- biothings.web.connections.es = <biothings.web.connections._ClientPool object>
- biothings.web.connections.sql = <biothings.web.connections._ClientPool object>
- biothings.web.connections.mongo = <biothings.web.connections._ClientPool object>