Replace in sqlalchemy

0

I have a SQL query that works fine, and I'm trying to include it in my API that has SQLAlchemy. This is the query that runs fine:

 SELECT * FROM Cliente WHERE (REPLACE (numeroDocumento,'-','')) like '30699583533'

In my records in the BD I have some fields without scripts and others with scripts, that's why I would need a search that I can search by omitting the scripts.

The query that I made without problems from my API but that only serves me for those numbers that do not have scripts is:

@app.route('/getclientid/<dni>', methods=['GET'])
@requires_auth
def getclientid_get(dni):
if request.method == 'GET':
    checkclient = cliente.query.filter_by(numerodocumento = dni).all()
    return jsonify({'cliente': [elemento.as_dict() for elemento in checkclient] })

Some suggestions on this, from now on many thanks and sorry for even my lack of knowledge of python and sqlalchemy.

    
asked by Francisco Puebla 27.12.2016 в 14:38
source

0 answers