Bug #90808 Adding JSON objects with parentheses in the fields causes error
Submitted: 9 May 2018 17:04 Modified: 8 Nov 2022 17:15
Reporter: Philip Antoniades Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version:8.0.11 OS:Any (Python 3.5.2)
Assigned to: CPU Architecture:Any
Tags: json, python, x protocol

[9 May 2018 17:04] Philip Antoniades
Description:
JSON that is fine in the MySQL Shell is rejected by the Python mysqlx module. Have not tested with Python 2.7, only 3.5. 

How to repeat:
parens = session.get_schema('mongo_mysql').create_collection( 'parens', reuse=True)
wparens = {'cuisine': 'Latin (Cuban, Dominican, Puerto Rican, South & Central American)', 'name': "Ramonita'S Restaurant", 'borough': 'Brooklyn'}
nparens = {'cuisine': 'Latin - Cuban, Dominican, Puerto Rican, South & Central American', 'name': "Ramonita'S Restaurant", 'borough': 'Brooklyn'}
try:
    parens.add(nparens).execute()
    parens.add( wparens).execute()
except ValueError as ve:
    print( "Error: {}".format( ve ))

nparens is added without issue. wparens kicks up the error:
Error: Expected token type 7 at pos 7 but found type 19(Rican)

In the Shell [python mode]:
> p = session.get_schema('mongo_mysql').get_collection( 'parens')
> p.add( {'cuisine': 'Latin (Cuban, Dominican, Puerto Rican, South & Central American)', 'name': "Ramonita'S Restaurant", 'borough': 'Brooklyn'} )
Query OK, 1 item affected (0.2372 sec)
[11 May 2018 10:48] Chiranjeevi Battula
Hello  Philip,

Thank you for the bug report.

Thanks,
Chiranjeevi.
[30 Sep 2022 14:42] Nuno Mariz
Posted by developer:
 
The issue could not be reproduced using Connector/Python 8.0.30.