i am having an error when i execute my store procedure from python.I have copy the code from other project but i cant figure out why it doesnt work.
here is my crud.py:
from sqlalchemy.orm import Session
import models, schemas
def get_client(db: Session):
return db.query(models.Cliente).all()
# def crear_cliente(db: Session, cliente: schemas.Cliente):
# db_cliente =models.Cliente(id_cliente=cliente.id_cliente,nombre=cliente.nombre, descrip_error=cliente.descrip_error)
# db.add(db_cliente)
# db.commit()
# db.refresh(db_cliente)
# return db_cliente
def crear_cliente_store(db: Session, cliente: schemas.Cliente):
result=db.execute("InsertarCliente ?,?,?", [cliente.telefono, cliente.issue, cliente.tipo_issue])
db.commit()
return result
this is my main.py:
@client.post("/clientela")
def llamado_store(cliente:schemas.Cliente, db: Session=Depends(get_db)):
result=crear_cliente_store(db,cliente)
return result
in the console, it showns this message:
sqlalchemy.exc.ArgumentError: Textual SQL expression 'InsertarCliente ?,?,?' should be explicitly declared as text('InsertarCliente ?,?,?')
Thanks for reading, and sorry if i am not very clear
New contributor
JuanNaimo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.