pip_services3_mysql.connect package
Submodules
Module contents
-
class
pip_services3_mysql.connect.
MySqlConnection
Bases:
pip_services3_commons.refer.IReferenceable.IReferenceable
,pip_services3_commons.config.IConfigurable.IConfigurable
,pip_services3_commons.run.IOpenable.IOpenable
MySQL connection using plain driver.
By defining a connection and sharing it through multiple persistence components you can reduce number of used database connections.
- ### Configuration parameters ###
- connection(s):
discovery_key: (optional) a key to retrieve the connection from
IDiscovery
host: host name or IP address
port: port number (default: 27017)
uri: resource URI or connection string with all parameters in it
- credential(s):
store_key: (optional) a key to retrieve the credentials from
ICredentialStore
username: user name
password: user password
- options:
connect_timeout: (optional) number of milliseconds to wait before timing out when connecting a new client (default: 0)
idle_timeout: (optional) number of milliseconds a client must sit idle in the pool and not be checked out (default: 10000)
max_pool_size: (optional) maximum number of clients the pool should contain (default: 10)
- ### References ###
*:logger:*:*:1.0 (optional)
ILogger
components to pass log messages components to pass log messages*:discovery:*:*:1.0 (optional)
IDiscovery
services*:credential-store:*:*:1.0 (optional)
ICredentialStore
stores to resolve credentials
-
close
(correlation_id: Optional[str]) Closes component and frees used resources.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
- Returns
raise error or None no errors occured.
-
configure
(config: pip_services3_commons.config.ConfigParams.ConfigParams) Configures component by passing configuration parameters.
- Parameters
config – configuration parameters to be set.
-
get_connection
() → Any
-
is_open
() → bool Checks if the component is opened.
- Returns
true if the component has been opened and false otherwise.
-
open
(correlation_id: Optional[str]) Opens the component.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
-
set_references
(references: pip_services3_commons.refer.IReferences.IReferences) Sets references to dependent components.
- Parameters
references – references to locate the component dependencies.
-
class
pip_services3_mysql.connect.
MySqlConnectionResolver
Bases:
pip_services3_commons.refer.IReferenceable.IReferenceable
,pip_services3_commons.config.IConfigurable.IConfigurable
Helper class that resolves MySQL connection and credential parameters, validates them and generates a connection URI.
It is able to process multiple connections to MySQL cluster nodes.
- ### Configuration parameters ###
- connection(s):
discovery_key: (optional) a key to retrieve the connection from
IDiscovery
host: host name or IP address
port: port number (default: 27017)
database: database name
uri: resource URI or connection string with all parameters in it
- credential(s):
store_key: (optional) a key to retrieve the credentials from
ICredentialStore
username: user name
password: user password
- ### References ###
*:discovery:*:*:1.0 (optional)
IDiscovery
services*:credential-store:*:*:1.0 (optional)
ICredentialStore
stores to resolve credentials
-
configure
(config: pip_services3_commons.config.ConfigParams.ConfigParams) Configures component by passing configuration parameters.
- Parameters
config – configuration parameters to be set.
-
resolve
(correlation_id: Optional[str]) → str Resolves MySQL connection URI from connection and credential parameters.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
- Returns
resolved URI or raise error.
-
set_references
(references: pip_services3_commons.refer.IReferences.IReferences) Sets references to dependent components.
- Parameters
references – references to locate the component dependencies.