Python/SQLAlchemy calling Stored Procedure(Postgres) with parameter

I’m trying to understand what is wrong with this code:

from flask import Flask
from flask_sqlalchemy import SQLAlchemy

con_str = 'postgresql://user:[email protected]_PostgresDB:5432/base'

app = Flask(__name__)

#Acesso a base
app.config["SQLALCHEMY_DATABASE_URI"] = con_str
db = SQLAlchemy(app)

conn = db.engine.raw_connection()

results = conn.cursor().callproc("usp_pes_pessoa",[1])

#...

My reference was:

[1]https://docs.sqlalchemy.org/en/14/core/connections.html#calling-stored-procedures

The code not call the procedured!

Thanks for your time!

Source: Python Questions

LEAVE A COMMENT