mysqlx.get_client

mysqlx.get_client(connection_string, options_string)

Creates a Client instance with the provided connection data and settings.

Parameters:
  • connection_string

    A string or a dict type object to indicate the connection data used to connect to a MySQL server.

    The string must have the following uri format:

    cnx_str = 'mysqlx://{user}:{pwd}@{host}:{port}'
    cnx_str = ('mysqlx://{user}:{pwd}@['
               '    (address={host}:{port}, priority=n),'
               '    (address={host}:{port}, priority=n), ...]'
               '       ?[option=value]')
    

    And the dictionary:

    cnx_dict = {
        'host': 'The host where the MySQL product is running',
        'port': '(int) the port number configured for X protocol',
        'user': 'The user name account',
        'password': 'The password for the given user account',
        'ssl-mode': 'The flags for ssl mode in mysqlx.SSLMode.FLAG',
        'ssl-ca': 'The path to the ca.cert'
        "connect-timeout": '(int) milliseconds to wait on timeout'
    }
    
  • options_string

    A string in the form of a document or a dictionary type with configuration for the client.

    Current options include:

    options = {
        'pooling': {
            'enabled': (bool), # [True | False], True by default
            'max_size': (int), # Maximum connections per pool
            "max_idle_time": (int), # milliseconds that a
                # connection will remain active while not in use.
                # By default 0, means infinite.
            "queue_timeout": (int), # milliseconds a request will
                # wait for a connection to become available.
                # By default 0, means infinite.
        }
    }
    
Returns:

Client object.

Return type:

mysqlx.Client

New in version 8.0.13.