I have the following query in which the final parameter (var_clob) is an output parameter.
query = """
BEGIN
p_post_grade(
:pin_term,
:pin_crn,
:pin_student_id,
:pin_instructor_id,
:pin_grade,
:pin_grde_code_incmp_final,
:pin_incomplete_ext_date,
:var_clob);
COMMIT;
END;
"""
I store the parameters in a dictionary:
params = {
"pin_term": json_body["term_code"],
"pin_crn": json_body["section_id"],
"pin_student_id": student["student_id"],
"pin_instructor_id": json_body["instructor_id"],
"pin_grade": student["grade"],
"pin_grde_code_incmp_final": None,
"pin_incomplete_ext_date": None
"var_clob": sqlalchemy.sql.outparam("var_clob", type_=String)
}
Then I call the sqlalchemy code to run the query
db_engine = create_engine('oracle+cx_oracle://' + db_username + ':' + db_pw + '@' + db_host + ':' + db_port + '/' + db_name, echo='debug')
conn = db_engine.connect()
result = conn.execute(text(query), **params)
I end up getting the following error:
(cx_Oracle.NotSupportedError) Python value of type BindParameter not supported.
How do I properly get output parameter values in sqlalchemy for cx_Oracle?