Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
category: minorAnalysis
---

- The modelling of Psycopg2 now supports the use of `psycopg2.pool` connection pools for handling database connections.
13 changes: 13 additions & 0 deletions python/ql/lib/semmle/python/frameworks/Psycopg2.qll
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}