|
MySQL Shell API 26.10.0
Unified development interface for MySQL Products
|
Encloses the functions and classes available to interact with a MySQL Server using the traditional MySQL Protocol. More...
Classes | |
| class | Type |
| Constants to represent data types on Column objects. More... | |
Functions | |
| ClassicSession | get_classic_session (ConnectionData connectionData, str password) |
| Opens a classic MySQL protocol session to a MySQL server. More... | |
| ClassicSession | get_session (ConnectionData connectionData, str password) |
| Opens a classic MySQL protocol session to a MySQL server. More... | |
| list | split_script (str script, dict options) |
| Split a SQL script into individual statements. More... | |
| dict | parse_statement_ast (str statements, dict options) |
| Parse MySQL statements and return its AST representation. More... | |
| dict | parse_ddl_script (str script, dict options) |
| Parse DDL statements and return the detected object changes. More... | |
| dict | parse_data_type (str typeDefinition) |
| Parse a MySQL data type definition. More... | |
| list | tokenize_statement (str statement, dict options) |
| Lexes a MySQL statement into a list of tokens. More... | |
| str | quote_identifier (str s) |
| Quote a string as a MySQL identifier, escaping characters when needed. More... | |
| str | quote_string (str s) |
| Quote a string as a MySQL string literal, escaping characters when needed. More... | |
| str | unquote_identifier (str s) |
| Unquote a MySQL identifier. More... | |
| str | unquote_string (str s) |
| Unquote a MySQL string literal. More... | |
| str | make_account (str user, str host) |
| Joins user and host into an quoted account string. More... | |
| dict | split_account (str account) |
| Splits account string into user and host. More... | |
Encloses the functions and classes available to interact with a MySQL Server using the traditional MySQL Protocol.
Use this module to create a session using the traditional MySQL Protocol, for example for MySQL Servers where the X Protocol is not available.
Note that the API interface on this module is very limited, even you can load schemas, tables and views as objects there are no operations available on them.
The purpose of this module is to allow SQL Execution on MySQL Servers where the X Protocol is not enabled.
To use the properties and functions available on this module you first need to import it.
When running the shell in interactive mode, this module is automatically imported.
| ClassicSession get_classic_session | ( | ConnectionData | connectionData, |
| str | password | ||
| ) |
Opens a classic MySQL protocol session to a MySQL server.
| connectionData | The connection data for the session |
| password | Optional password for the session |
A ClassicSession object uses the traditional MySQL Protocol to allow executing operations on the connected MySQL Server.
Connection Data
The connection data may be specified in the following formats:
A basic URI string has the following format:
[scheme://][user[:password]@]<host[:port]|socket>[/schema][?option=value&option=value...]
For additional information about MySQL connection data, see Connection Data.
| ClassicSession get_session | ( | ConnectionData | connectionData, |
| str | password | ||
| ) |
Opens a classic MySQL protocol session to a MySQL server.
| connectionData | The connection data for the session |
| password | Optional password for the session |
A ClassicSession object uses the traditional MySQL Protocol to allow executing operations on the connected MySQL Server.
Connection Data
The connection data may be specified in the following formats:
A basic URI string has the following format:
[scheme://][user[:password]@]<host[:port]|socket>[/schema][?option=value&option=value...]
For additional information about MySQL connection data, see Connection Data.
| list split_script | ( | str | script, |
| dict | options | ||
| ) |
Split a SQL script into individual statements.
| script | A SQL script as a string containing multiple statements |
| options | Optional dictionary of parser options |
The default statement delimiter is `;` but it can be changed with the DELIMITER keyword, which must be followed by the delimiter character(s) and a newline.
Supported options are:
| dict parse_statement_ast | ( | str | statements, |
| dict | options | ||
| ) |
Parse MySQL statements and return its AST representation.
| statements | SQL statements to be parsed |
| options | Optional dictionary of parser options |
Supported options are:
| dict parse_ddl_script | ( | str | script, |
| dict | options | ||
| ) |
Parse DDL statements and return the detected object changes.
| script | SQL script with DDL statements |
| options | Optional dictionary of parser options |
Supported options are:
| dict parse_data_type | ( | str | typeDefinition | ) |
Parse a MySQL data type definition.
| typeDefinition | MySQL data type definition |
| list tokenize_statement | ( | str | statement, |
| dict | options | ||
| ) |
Lexes a MySQL statement into a list of tokens.
| statement | SQL statement to be tokenized |
| options | Optional dictionary of tokenizer options |
Supported options are:
| str quote_identifier | ( | str | s | ) |
Quote a string as a MySQL identifier, escaping characters when needed.
| s | the identifier name to be quoted |
| str quote_string | ( | str | s | ) |
Quote a string as a MySQL string literal, escaping characters when needed.
| s | the string value to be quoted |
| str unquote_identifier | ( | str | s | ) |
Unquote a MySQL identifier.
| s | String to unquote |
An exception is thrown if the input string is not quoted with backticks.
| str unquote_string | ( | str | s | ) |
Unquote a MySQL string literal.
| s | String to unquote |
| str make_account | ( | str | user, |
| str | host | ||
| ) |
Joins user and host into an quoted account string.
| user | User name to join |
| host | Host name to join |
| dict split_account | ( | str | account | ) |
Splits account string into user and host.
| account | Account string |
1.9.2