예제 #1
0
                      help="connection information for first server in "
                           "the form: <user>[:<password>]@<host>[:<port>]"
                           "[:<socket>] or <login-path>[:<port>][:<socket>].")

    # Connection information for the destination server
    parser.add_option("--server2", action="store", dest="server2",
                      type="string", default=None,
                      help="connection information for second server in "
                           "the form: <user>[:<password>]@<host>[:<port>]"
                           "[:<socket>] or <login-path>[:<port>][:<socket>].")

    # Add character set option
    add_character_set_option(parser)

    # Output format
    add_format_option(parser, "display the output in either grid (default), "
                              "tab, csv, or vertical format", "grid")

    # Add skips
    parser.add_option("--skip-checksum-table", action="store_true",
                      dest="no_checksum_table",
                      help="skip CHECKSUM TABLE step in data consistency "
                           "check.")

    parser.add_option("--skip-object-compare", action="store_true",
                      dest="no_object_check",
                      help="skip object comparison step.")

    parser.add_option("--skip-row-count", action="store_true",
                      dest="no_row_count",
                      help="skip row count step.")
예제 #2
0
                      help="include privileges that match base_user@% as well "
                      "as base_user@host",
                      default=False)

    # List mode
    parser.add_option("-l",
                      "--list",
                      action="store_true",
                      dest="list_users",
                      help="list all users on the source - does not require "
                      "a destination",
                      default=False)

    # format for list
    add_format_option(
        parser, "display the list of users in either grid "
        "(default), tab, csv, or vertical format - "
        "valid only for --list option", "grid")

    # Add verbosity and quiet (silent) mode
    add_verbosity(parser, True)

    # Now we process the rest of the arguments where the first is the
    # base user and the next N are the new users.
    opt, args = parser.parse_args()

    # Fail if no --source provided
    if not opt.source:
        parser.error(PARSE_ERR_OPTS_REQ.format(opt='--source'))

    # Fail if no users specified and not using the --list option
    if not args and not opt.list_users:
예제 #3
0
from mysql.utilities.exception import UtilError

# Constants
NAME = "MySQL Utilities - mysqlserverinfo "
DESCRIPTION = "mysqlserverinfo - show server information"
USAGE = "%prog --server=user:pass@host:port:socket --format=grid"

# Setup the command parser and setup server, help
parser = setup_common_options(os.path.basename(sys.argv[0]),
                              DESCRIPTION, USAGE, True)

# Setup utility-specific options:

# Input format
add_format_option(parser, "display the output in either grid (default), "
                  "tab, csv, or vertical format", "grid")     

# Header row
parser.add_option("-h", "--no-headers", action="store_true", dest="no_headers",
                  default=False, help="do not show column headers")

# Show my.cnf values
parser.add_option("-d", "--show-defaults", action="store_true",
                  dest="show_defaults", default=False,
                  help="show defaults from the config file per server")

# Add --start option
parser.add_option("-s", "--start", action="store_true", dest="start",
                  help="start server in read only mode if offline")

# Add --basedir option
예제 #4
0
    # executable, otherwise ignored.
    multiprocessing.freeze_support()

    # Setup the command parser and setup server, help
    parser = setup_common_options(os.path.basename(sys.argv[0]), DESCRIPTION,
                                  USAGE)

    # Setup utility-specific options:

    # Add character set option
    add_character_set_option(parser)

    # Input format
    add_format_option(parser, "the input file format in either sql (default), "
                      "grid, tab, csv, raw_csv or vertical format",
                      "sql",
                      True,
                      extra_formats=["raw_csv"])

    # Import mode
    parser.add_option("-i",
                      "--import",
                      action="store",
                      dest="import_type",
                      default="definitions",
                      help="control the import of "
                      "either 'data' = only the table data for the tables in "
                      "the database list, 'definitions' = import only the "
                      "definitions for the objects in the database list, or "
                      "'both' = import the metadata followed by the data "
                      "(default: import definitions)",
예제 #5
0
    stop_test = time.time()
    display_time = int((stop_test - start_test) * 100)
    if display_time == 0:
        display_time = 1
    print("Time: %6d\n" % display_time)


# Setup the command parser and setup server, help
parser = setup_common_options(os.path.basename(sys.argv[0]), DESCRIPTION,
                              USAGE)

# Setup utility-specific options:

# Output format
add_format_option(
    parser, "display the output in either sql (default), "
    "grid, tab, csv, or vertical format", "sql", True)

# Display format
parser.add_option("-d",
                  "--display",
                  action="store",
                  dest="display",
                  default="brief",
                  help="control the number of columns shown: "
                  "'brief' = minimal columns for object creation (default), "
                  "'full' = all columns, 'names' = only object names (not "
                  "valid for --format=sql)",
                  type="choice",
                  choices=_PERMITTED_DISPLAY)
예제 #6
0
    stop_test = time.time()
    display_time = int((stop_test - start_test) * 100)
    if display_time == 0:
        display_time = 1
    print("Time: %6d\n" % display_time)


# Setup the command parser and setup server, help
parser = setup_common_options(os.path.basename(sys.argv[0]), DESCRIPTION,
                              USAGE)

# Setup utility-specific options:

# Input format
add_format_option(
    parser, "the input file format in either sql (default), "
    "grid, tab, csv, or vertical format", "sql", True)

# Import mode
parser.add_option(
    "-i",
    "--import",
    action="store",
    dest="import_type",
    default="definitions",
    help="control the import of either "
    "'data' = only the table data for the tables in the database "
    "list, 'definitions' = import only the definitions for "
    "the objects in the database list, or 'both' = import "
    "the metadata followed by the data "
    "(default: import definitions)",
예제 #7
0
    # Include globals mode
    parser.add_option("--include-global-privileges", action="store_true",
                      dest="global_privs",
                      help="include privileges that match base_user@% as well "
                           "as base_user@host",
                      default=False)

    # List mode
    parser.add_option("-l", "--list", action="store_true", dest="list_users",
                      help="list all users on the source - does not require "
                           "a destination",
                      default=False)

    # format for list
    add_format_option(parser, "display the list of users in either grid "
                              "(default), tab, csv, or vertical format - "
                              "valid only for --list option", "grid")

    # Add verbosity and quiet (silent) mode
    add_verbosity(parser, True)

    # Now we process the rest of the arguments where the first is the
    # base user and the next N are the new users.
    opt, args = parser.parse_args()

    # Fail if no --source provided
    if not opt.source:
        parser.error(PARSE_ERR_OPTS_REQ.format(opt='--source'))

    # Fail if no users specified and not using the --list option
    if not args and not opt.list_users:
예제 #8
0
                      action="store_true",
                      dest="show_indexes",
                      default=False,
                      help="display indexes for each table")

    # Force mode
    parser.add_option("-s",
                      "--skip",
                      action="store_true",
                      dest="skip",
                      help="skip tables that do not exist",
                      default=False)

    # Index list format
    add_format_option(
        parser, "display the list of indexes per table in "
        "either sql, grid (default), tab, csv, or "
        "vertical format", "grid", True)

    # Show index statistics
    parser.add_option("--stats",
                      action="store_true",
                      dest="stats",
                      default=False,
                      help="show index performance statistics")

    # Set limit for best
    parser.add_option("--best",
                      action="store",
                      dest="best",
                      default=None,
                      help="limit index statistics to the best N indexes")
예제 #9
0
if __name__ == '__main__':
    # Needed for freeze support to avoid RuntimeError when running as a Windows
    # executable, otherwise ignored.
    multiprocessing.freeze_support()

    # Setup the command parser and setup server, help
    parser = setup_common_options(os.path.basename(sys.argv[0]),
                                  DESCRIPTION, USAGE)

    # Setup utility-specific options:

    # Add character set option
    add_character_set_option(parser)

    # Output format
    add_format_option(parser, "display the output in either sql (default), "
                      "grid, tab, csv, or vertical format", "sql", True)

    # Display format
    parser.add_option("-d", "--display", action="store", dest="display",
                      default="brief", help="control the number of columns "
                      "shown: 'brief' = minimal columns for object creation "
                      "(default), 'full' = all columns, 'names' = only object "
                      "names (not valid for --format=sql)", type="choice",
                      choices=_PERMITTED_DISPLAY)

    # Export mode
    parser.add_option("-e", "--export", action="store", dest="export",
                      default="definitions", help="control the export of "
                      "either 'data' = only the table data for the tables in "
                      "the database list, 'definitions' = export only the "
                      "definitions for the objects in the database list, or "
예제 #10
0
    # Needed for freeze support to avoid RuntimeError when running as a Windows
    # executable, otherwise ignored.
    multiprocessing.freeze_support()

    # Setup the command parser and setup server, help
    parser = setup_common_options(os.path.basename(sys.argv[0]),
                                  DESCRIPTION, USAGE)

    # Setup utility-specific options:

    # Add character set option
    add_character_set_option(parser)

    # Input format
    add_format_option(parser, "the input file format in either sql (default), "
                      "grid, tab, csv, raw_csv or vertical format", "sql",
                      True, extra_formats=["raw_csv"])

    # Import mode
    parser.add_option("-i", "--import", action="store", dest="import_type",
                      default="definitions", help="control the import of "
                      "either 'data' = only the table data for the tables in "
                      "the database list, 'definitions' = import only the "
                      "definitions for the objects in the database list, or "
                      "'both' = import the metadata followed by the data "
                      "(default: import definitions)", type="choice",
                      choices=_PERMITTED_IMPORTS)

    # Drop mode
    parser.add_option("-d", "--drop-first", action="store_true", default=False,
                      help="drop database before importing.", dest="do_drop")
예제 #11
0
                  dest="show_drops", default=False,
                  help="display DROP statements for dropping indexes")

# Display all indexes per table
parser.add_option("--show-indexes", "-i", action="store_true",
                  dest="show_indexes", default=False,
                  help="display indexes for each table")

# Force mode
parser.add_option("-s", "--skip", action="store_true", dest="skip",
                  help="skip tables that do not exist",
                  default=False)

# Index list format
add_format_option(parser, "display the list of indexes per table in either "
                  "sql, grid (default), tab, csv, or vertical format", "grid",
                  True)     

# Show index statistics
parser.add_option("--stats", action="store_true",
                  dest="stats", default=False,
                  help="show index performance statistics")

# Set limit for best
parser.add_option("--best", action="store",
                  dest="best", default=None,
                  help="limit index statistics to the best N indexes")

# Set limit for worst
parser.add_option("--worst", action="store",
                  dest="worst", default=None,
예제 #12
0
    start_test[in]      The starting time of the test
    """
    stop_test = time.time()
    display_time = int((stop_test - start_test) * 100)
    if display_time == 0:
        display_time = 1
    print("Time: %6d\n" % display_time)

# Setup the command parser and setup server, help
parser = setup_common_options(os.path.basename(sys.argv[0]),
                              DESCRIPTION, USAGE)

# Setup utility-specific options:

# Input format
add_format_option(parser, "the input file format in either sql (default), "
                  "grid, tab, csv, or vertical format", "sql", True)     

# Import mode
parser.add_option("-i", "--import", action="store", dest="import_type",
                  default="definitions", help="control the import of either "
                  "'data' = only the table data for the tables in the database "
                  "list, 'definitions' = import only the definitions for "
                  "the objects in the database list, or 'both' = import "
                  "the metadata followed by the data "
                  "(default: import definitions)", type="choice",
                  choices=_PERMITTED_IMPORTS)

# Drop mode
parser.add_option("-d", "--drop-first", action="store_true", default=False,
                  help="drop database before importing.", dest="do_drop")