class documentation

class MySQLTableDefinitionParser(object):

View In Hierarchy

Parses the results of a SHOW CREATE TABLE statement.
Method __init__ Undocumented
Method ​_add​_option​_regex Undocumented
Method ​_add​_option​_string Undocumented
Method ​_add​_option​_word Undocumented
Method ​_describe​_to​_create Re-format DESCRIBE output as a SHOW CREATE TABLE string.
Method ​_parse​_column Extract column details.
Method ​_parse​_constraints Parse a KEY or CONSTRAINT line.
Method ​_parse​_keyexprs Unpack '"col"(2),"col" ASC'-ish strings into components.
Method ​_parse​_table​_name Extract the table name.
Method ​_parse​_table​_options Build a dictionary of all reflected table-level options.
Method ​_prep​_regexes Pre-compile regular expressions.
Method parse Undocumented
Class Variable ​_optional​_equals Undocumented
Instance Variable ​_pr​_name Undocumented
Instance Variable ​_pr​_options Undocumented
Instance Variable ​_re​_ck​_constraint Undocumented
Instance Variable ​_re​_column Undocumented
Instance Variable ​_re​_column​_loose Undocumented
Instance Variable ​_re​_columns Undocumented
Instance Variable ​_re​_csv​_int Undocumented
Instance Variable ​_re​_csv​_str Undocumented
Instance Variable ​_re​_fk​_constraint Undocumented
Instance Variable ​_re​_key Undocumented
Instance Variable ​_re​_key​_version​_sql Undocumented
Instance Variable ​_re​_keyexprs Undocumented
Instance Variable ​_re​_partition Undocumented
Instance Variable dialect Undocumented
Instance Variable preparer Undocumented
def __init__(self, dialect, preparer):

Undocumented

def _add_option_regex(self, directive, regex):

Undocumented

def _add_option_string(self, directive):

Undocumented

def _add_option_word(self, directive):

Undocumented

def _describe_to_create(self, table_name, columns):

Re-format DESCRIBE output as a SHOW CREATE TABLE string.

DESCRIBE is a much simpler reflection and is sufficient for reflecting views for runtime use. This method formats DDL for columns only- keys are omitted.

Parameters
table​_nameUndocumented
columnsA sequence of DESCRIBE or SHOW COLUMNS 6-tuples. SHOW FULL COLUMNS FROM rows must be rearranged for use with this function.
def _parse_column(self, line, state):

Extract column details.

Falls back to a 'minimal support' variant if full parse fails.

Parameters
lineAny column-bearing line from SHOW CREATE TABLE
stateUndocumented
def _parse_constraints(self, line):
Parse a KEY or CONSTRAINT line.
Parameters
lineA line of SHOW CREATE TABLE output
def _parse_keyexprs(self, identifiers):
Unpack '"col"(2),"col" ASC'-ish strings into components.
def _parse_table_name(self, line, state):
Extract the table name.
Parameters
lineThe first line of SHOW CREATE TABLE
stateUndocumented
def _parse_table_options(self, line, state):
Build a dictionary of all reflected table-level options.
Parameters
lineThe final line of SHOW CREATE TABLE output.
stateUndocumented
def _prep_regexes(self):
Pre-compile regular expressions.
def parse(self, show_create, charset):

Undocumented

_optional_equals: str =

Undocumented

_pr_name =

Undocumented

_pr_options: list =

Undocumented

_re_ck_constraint =

Undocumented

_re_column =

Undocumented

_re_column_loose =

Undocumented

_re_columns: list =

Undocumented

_re_csv_int =

Undocumented

_re_csv_str =

Undocumented

_re_fk_constraint =

Undocumented

_re_key =

Undocumented

_re_key_version_sql =

Undocumented

_re_keyexprs =

Undocumented

_re_partition =

Undocumented

dialect =

Undocumented

preparer =

Undocumented