Bug #111608 mysqlx DevAPI can't deduce bigint
Submitted: 28 Jun 2023 14:54 Modified: 30 Jun 12:22
Reporter: Kenneth Ostrom Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / Python Severity:S2 (Serious)
Version: OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[28 Jun 2023 14:54] Kenneth Ostrom
Description:
The mysqlx api deduces data types, but if it sees an integer it tries to make it a 32 bit integer. In the case of overflow, it just returns an exception dataset immediately.

How to repeat:
import mysqlx

session = mysqlx.get_session({
    'host': 'localhost',
    'port': 33060,
    'user': 'redacted',
    'password': 'redacted',
})

document1 = {
    '_id': 'unique-name-1',
    'small': 888888888,
    'stuff': 'other stuff',
}

document2 = {
    '_id': 'unique-name-2',
    'large': 8888888888,
    'stuff': 'other stuff',
}

try:
    db = session.create_schema('databasename')
except:
    db = session.get_schema('databasename')

try:
    collection = db.create_collection('tablename')
except:
    collection = db.get_collection('tablename')

try:
    collection.add(document1).execute()
    collection.add(document2).execute()
    print('done')
except Exception as e:
    print(type(e))
    print(e)

Suggested fix:
It's deducing types from the document. In the case of an integer type, we either need arbitrarily large integers, or at least automatically swap to bigint if you get an overflow on int.
[31 May 12:22] MySQL Verification Team
Hello Kenneth,

Thank you for the bug report.
Please upgrade to latest version and report us back if issue persist even in latest version along with test case. Thank you.

Regards,
Ashwini Patil
[1 Jul 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".