Skip to content

Commit 91442e1

Browse files
committed
Python: Model sessionmaker().begin()
1 parent feb2303 commit 91442e1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

python/ql/src/experimental/semmle/python/frameworks/SqlAlchemy.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ private module SqlAlchemy {
202202
.getMember("sessionmaker")
203203
.getReturn()
204204
.getACall()
205+
or
206+
this =
207+
API::moduleImport("sqlalchemy")
208+
.getMember("orm")
209+
.getMember("sessionmaker")
210+
.getReturn()
211+
.getMember("begin")
212+
.getACall()
205213
}
206214
}
207215

python/ql/test/experimental/library-tests/frameworks/sqlalchemy/new_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
assert result.fetchall() == [("FOO",)]
145145

146146
with Session.begin() as session:
147-
result = session.execute(raw_sql) # $ MISSING: getSql=raw_sql
147+
result = session.execute(raw_sql) # $ getSql=raw_sql
148148
assert result.fetchall() == [("FOO",)]
149149

150150
# Querying (1.4)

0 commit comments

Comments
 (0)