• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python options.setup_common_options函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mysql.utilities.common.options.setup_common_options函数的典型用法代码示例。如果您正苦于以下问题:Python setup_common_options函数的具体用法?Python setup_common_options怎么用?Python setup_common_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setup_common_options函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setup_common_options

import time
from mysql.utilities import VERSION_FRM
from mysql.utilities.command.serverinfo import show_server_info
from mysql.utilities.common.options import setup_common_options
from mysql.utilities.common.options import add_format_option
from mysql.utilities.common.options import add_verbosity

from mysql.utilities.exception import UtilError

# Constants
NAME = "MySQL Utilities - mysqlserverinfo "
DESCRIPTION = "mysqlserverinfo - show server information"
USAGE = "%prog --server=user:[email protected]: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")
开发者ID:aoyanglee,项目名称:Travel-Inc,代码行数:32,代码来源:mysqlserverinfo.py


示例2: parser

  - You can list the users that have specific privileges using the option
    --privileges. The user must have all privileges listed in order to be
    included in the result.

  - If you specify some privileges on the --privileges option that are not
    valid for all the specified objects,  any that do not apply are not
    included in the list. For example, the SELECT privilege will be
    ignored for stored routines and the EXECUTE privilege will be ignored for
    tables but both will be taken into account for databases.

"""

if __name__ == '__main__':
    # Setup the command parser (with common options).
    parser = setup_common_options(os.path.basename(sys.argv[0]), DESCRIPTION,
                                  USAGE, append=False, server=True,
                                  server_default=None,
                                  extended_help=EXTENDED_HELP)

    # Add verbosity option (no --quite option).
    add_verbosity(parser, False)

    # Add show mode options
    parser.add_option("--show", action="store",
                      dest="show_mode", type="choice",
                      default="user_grants",
                      choices=["users", "user_grants", "raw"],
                      help="Controls the content of the report. If the value "
                           "USERS is specified, the report shows only the "
                           "list of users with any kind of grant over the "
                           "object. If USER_GRANTS is specified the reports "
                           "shows each user along with her list of privileges "
开发者ID:fengshao0907,项目名称:mysql-utilities,代码行数:32,代码来源:mysqlgrants.py


示例3: add_pattern

from mysql.utilities.common.options import parse_connection
from mysql.utilities.common.options import setup_common_options
from mysql.utilities.common.options import add_verbosity
from mysql.utilities.common.options import check_format_option
from mysql.utilities.exception import UtilError

def add_pattern(option, opt, value, parser, field):
    entry = (field, value)
    try:
        getattr(parser.values, option.dest).append(entry)
    except AttributeError:
        setattr(parser.values, option.dest, [entry])

# Setup the command parser and setup server, help
parser = setup_common_options(os.path.basename(sys.argv[0]),
                              "mysqlprocgrep - search process information",
                              "%prog --server=user:[email protected]:port:socket "
                              "[options]", True)
parser.add_option(
    "-G", "--basic-regexp", "--regexp",
    dest="use_regexp", action="store_true", default=False,
    help="Use 'REGEXP' operator to match pattern. Default is to use 'LIKE'.")
parser.add_option(
    "-Q", "--print-sql", "--sql",
    dest="print_sql", action="store_true", default=False,
    help="Print the statement instead of sending it to the server. If a kill option is submitted, a procedure will be generated containing the code for executing the kill.")
parser.add_option(
    "--sql-body",
    dest="sql_body", action="store_true", default=False,
    help="Only print the body of the procedure.")
parser.add_option(
    "--kill-connection",
开发者ID:Arrjaan,项目名称:Cliff,代码行数:32,代码来源:mysqlprocgrep.py


示例4: parser

  - The default timeout for performing the table checksum is 5 seconds.
    This value can be changed with the --checksum-timeout option.

  - The default timeout for waiting for slaves to catch up is 300 seconds.
    This value can be changed with the --rpl-timeout option.

  - The default interval to periodically verify if a slave has read all of
    the GTIDs from the master is 3 seconds. This value can be changed
    with the --interval option.

"""

if __name__ == "__main__":
    # Setup the command parser (with common options).
    parser = setup_common_options(
        os.path.basename(sys.argv[0]), DESCRIPTION, USAGE, server=False, extended_help=EXTENDED_HELP
    )

    # Add the --discover-slaves-login option.
    add_discover_slaves_option(parser)

    # Add the --master option.
    add_master_option(parser)

    # Add the --slaves option.
    add_slaves_option(parser)

    # Add the --ssl options
    add_ssl_options(parser)

    # Add verbosity option (no --quite option).
开发者ID:cloud-dev,项目名称:mysql-utilities,代码行数:31,代码来源:mysqlrplsync.py


示例5: check_python_version

# Check Python version compatibility
check_python_version()

import os.path
import re
import sys

from mysql.utilities.command.grep import ObjectGrep, OBJECT_TYPES
from mysql.utilities.common.options import add_regexp
from mysql.utilities.common.options import setup_common_options
from mysql.utilities.common.options import add_format_option

# Setup the command parser and setup server, help
parser = setup_common_options(
    os.path.basename(sys.argv[0]),
    "mysqlmetagrep - search metadata",
    "%prog --server=user:[email protected]:port:socket " "[options] pattern",
    True,
)

# Setup utility-specific options:
parser.add_option(
    "-b",
    "--body",
    dest="check_body",
    action="store_true",
    default=False,
    help="search the body of routines, triggers, and events as well",
)


def quote(string):
开发者ID:xiepaup,项目名称:mysql-utilities,代码行数:32,代码来源:mysqlmetagrep.py



注:本文中的mysql.utilities.common.options.setup_common_options函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python server.Server类代码示例发布时间:2022-05-27
下一篇:
Python options.add_verbosity函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap