Replies: 1 comment
-
There are two ways: Explicit prepared statements where you are responsible to manage lifecycle of prepared statementscursor.execute("PREPARE pstmt_1 FROM SELECT * FROM nation WHERE name = ?").fetchall()
results = cursor.execute("EXECUTE pstmt_1 USING 'ALGERIA'").fetchall()
print(results)
results = cursor.execute("EXECUTE pstmt_1 USING 'CANADA'").fetchall()
print(results)
cursor.execute("DEALLOCATE PREPARE pstmt_1") Implicit where statements are managed by the clientparams = ["CANADA"]
# tuples also work
params = ("CANADA")
results = cursor.execute("SELECT * FROM nation WHERE name = ?", params)
print(results) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've been triying to make a prepared statement and execute it in trino python client, but i can't figure it out, if someone can throw some light on the situation
Beta Was this translation helpful? Give feedback.
All reactions