This post is about simple usage of mysqlx module i.e X Plugin
with latest Connector/Python DMR.
The version of Python Connector is 8.0.4.
Installing:
wget https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-8.0.4-0.1.dmr.el7.x86_64.rpm sudo yum install mysql-connector-python-8.0.4-0.1.dmr.el7.x86_64.rpm
Sample Python code:
# Connecting to MySQL and working with a Session import mysqlx # Connect to a dedicated MySQL server session = mysqlx.get_session({ 'host': 'localhost', 'port': 33060, 'user': 'bakux', 'password': 'Baku12345', 'ssl-mode': mysqlx.SSLMode.DISABLED }) schema = session.get_schema('generated_columns_test') # Create 'my_collection' in schema schema.create_collection('my_collection') # Get 'my_collection' from schema collection = schema.get_collection('my_collection') assert(True == collection.exists_in_database()) # You can also add multiple documents at once …[Read more]