I was encountering the same problem and searched for two days before finding out that the code preceeding the error contained an error:
it was getting the following error, referring to an error in python and sqlalchemy
offertemodule_1 | File "/opt/packages/database/models.py", line 79, in process_bind_param
offertemodule_1 | return "%.32x" % uuid.UUID(value).int
offertemodule_1 | File "/usr/local/lib/python3.7/uuid.py", line 157, in __init__
offertemodule_1 | hex = hex.replace('urn:', '').replace('uuid:', '')
offertemodule_1 | sqlalchemy.exc.StatementError: (builtins.AttributeError) 'builtin_function_or_method' object has no attribute 'replace'
offertemodule_1 | [SQL: SELECT product.id AS product_id, product.supplier_id AS product_supplier_id, product.supplier_product_url AS product_supplier_product_url, product.supplier_product_id AS product_supplier_product_id, product.title AS product_title, product.description AS product_description, product.brand AS product_brand, product.product_line AS product_product_line, product.buying_price_ex_vat AS product_buying_price_ex_vat, product.buying_vat AS product_buying_vat, product.vat_pct AS product_vat_pct, product.advise_price AS product_advise_price, product.estimated_days_leadtime AS product_estimated_days_leadtime, product.product_category AS product_product_category, product.nestedproducts AS product_nestedproducts, product.atttibutes_meta AS product_atttibutes_meta, product.statistics_meta AS product_statistics_meta, product.active AS product_active, product.created AS product_created, product.created_by AS product_created_by, product.modified AS product_modified, product.modified_by AS product_modified_by
offertemodule_1 | FROM product
offertemodule_1 | WHERE product.id = %(id_1)s]
offertemodule_1 | [parameters: [immutabledict({})]]
But it turned out that a process before this was sending the wrong object to my database function
@ns_products.route('/<string:product_id>')
@api.response(404, 'product not found.')
class Details(Resource):
@api.marshal_with(product)
@api.doc(security='jwt')
@jwt_required
def get(self, product_id):
'''Returns a single product instance'''
return Product.get(id)`
Should be (note 'product_id')
@ns_products.route('/<string:product_id>')
@api.response(404, 'product not found.')
class Details(Resource):
@api.marshal_with(product)
@api.doc(security='jwt')
@jwt_required
def get(self, product_id):
'''Returns a single product instance'''
return Product.get(product_id)
Hence the uuid-string stored in product_id was actually a native python object 'id'. Hence it tried to process the string to a uuid and it failed.
postgresql.UUID
as well. – Ilja Everilä