Skip to content

Commit ca09441

Browse files
committed
convert string to sqlalchemy text
1 parent f807f1e commit ca09441

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cs50/sql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def teardown_appcontext(exception):
370370
# "(psycopg2.errors.ObjectNotInPrerequisiteState) lastval is not yet defined in this session",
371371
# a la https://stackoverflow.com/a/24186770/5156190;
372372
# cf. https://www.psycopg.org/docs/errors.html re 55000
373-
result = connection.execute("""
373+
result = connection.execute(sqlalchemy.text("""
374374
CREATE OR REPLACE FUNCTION _LASTVAL()
375375
RETURNS integer LANGUAGE plpgsql
376376
AS $$
@@ -382,7 +382,7 @@ def teardown_appcontext(exception):
382382
END;
383383
END $$;
384384
SELECT _LASTVAL();
385-
""")
385+
"""))
386386
ret = result.first()[0]
387387

388388
# If not PostgreSQL

0 commit comments

Comments
 (0)