Skip to content

Commit

Permalink
SNOW-1058245-sqlalchemy-20-support: fix inspection - part 3 - test fo…
Browse files Browse the repository at this point in the history
…r both version
  • Loading branch information
sfc-gh-mraba committed Feb 27, 2024
1 parent 8d0489c commit 2ecb0dd
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions tests/test_orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,18 +367,29 @@ class Department(Base):
.select_from(Employee)
.outerjoin(sub)
)
# assert (
# str(query.compile(engine_testaccount)).replace("\n", "")
# == "SELECT employees.employee_id, departments.department_id "
# "FROM departments, employees LEFT OUTER JOIN LATERAL "
# "(SELECT departments.department_id AS department_id, departments.name AS name "
# "FROM departments) AS anon_1"
# )
compiled_stmts = (
# v1.x
"SELECT employees.employee_id, departments.department_id "
"FROM departments, employees LEFT OUTER JOIN LATERAL "
"(SELECT departments.department_id AS department_id, departments.name AS name "
"FROM departments) AS anon_1",
# v2.x
"SELECT employees.employee_id, departments.department_id "
"FROM employees LEFT OUTER JOIN LATERAL "
"(SELECT departments.department_id AS department_id, departments.name AS name "
"FROM departments) AS anon_1, departments",
)
compiled_stmt = str(query.compile(engine_testaccount)).replace("\n", "")
assert compiled_stmt in compiled_stmts

with caplog.at_level(logging.DEBUG):
assert [res for res in session.execute(query)]
assert (
"SELECT employees.employee_id, departments.department_id FROM departments"
in caplog.text
) or (
"SELECT employees.employee_id, departments.department_id FROM employees"
in caplog.text
)


Expand Down

0 comments on commit 2ecb0dd

Please sign in to comment.