Merge pull request #20276 from github/tausbn/python-model-psycopg2-connection-pools

Python: Add support for Psycopg2 database connection pools
This commit is contained in:
Taus
2025-08-29 13:52:59 +02:00
committed by GitHub
5 changed files with 66 additions and 0 deletions

View File

@@ -29,4 +29,17 @@ private module Psycopg2 {
class Psycopg2 extends PEP249::PEP249ModuleApiNode {
Psycopg2() { this = API::moduleImport("psycopg2") }
}
/** A database connection obtained from a psycopg2 connection pool. */
class Psycopg2ConnectionPoolMember extends PEP249::DatabaseConnection {
Psycopg2ConnectionPoolMember() {
this =
any(Psycopg2 p)
.getMember("pool")
.getMember(["SimpleConnectionPool", "ThreadedConnectionPool", "AbstractConnectionPool"])
.getAnInstance()
.getMember("getconn")
.getReturn()
}
}
}