ConnectorTypeMYSQL
class connector_types.connector_type_mysql.ConnectorTypeMYSQL
Interact with a MySQL database. This connector type supports the execute
,
fetch
, fetchrow
, and fetchval
commands. Each command expects an
SQL query and returns the status, list, record or field value respectively.
Consult the MySQL SQL language documentation at https://dev.mysql.com/doc/refman/8.0/en/introduction.html for more information.
Input Schema
-
schema_version
Type:
string
-
authentication
Type:
anyOf
Options: -
host
The remote hostname or IP address.
Type:
string
-
port
Type:
anyOf
Options: -
tls
If to connect using TLS/SSL.
Type:
anyOf
Options: -
database
Type:
string
-
mode
Type:
anyOf
Options:
Output Schema
-
result
Data
Example
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='MYSQL',
authentication={
'authentication_method': 'username_password',
'username': 'root',
'password': '...',
},
host='...',
port={
'port_mode': 'service_name',
'service_name': 'mysql',
},
tls={
'tls_mode': 'use_tls_ssl',
'verify_ssl': True,
'check_hostname': True,
'server_ca': '...',
'client_cert': '...',
'client_key': '...',
},
database='...',
mode={
'mode_name': 'fetch',
'query': 'SELECT * FROM users',
},
)
this.log(result=result)
return this.success('all done')