__main__.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:elasticizer 作者: cfpb 项目源码 文件源码
def build_arg_parser():
    parser = configargparse.ArgParser(prog='elasticizer',
                                      description='from DB to Elasticsearch')
    parser.add('-c', '--my-config', required=True,
               is_config_file=True, help='config file path')
    parser.add('--index', '-i',
               required=True, dest='index',
               help='the Elasticsearch index name that Luigi updates')
    parser.add('--backup_count', '-b',
               default=0, type=backup_type, dest='backup_count',
               help=('number of back up indices: creates cycling indices '
                     '(*-v1 -v2... -vN), with current aliased by the index arg'))
    parser.add('--table', '-t',
               required=True, dest='table',
               help='the name of the SQL table from which Luigi reads')
    parser.add('--mapping_file', '-m',  metavar='mapping file',
               default='mappings.json', dest='mapping_file',
               help='the mapping filename used to set up Elasticsearch mappings')
    parser.add('--settings_file', '-s', metavar='settings file',
               default='settings.json', dest='settings_file',
               help='the settings filename used to set up Elasticsearch settings')
    parser.add('--docs_file', '-o',
               default='tmp.json', dest='docs_file',
               help='an output file that stores data being loaded into Elasticsearch.')
    parser.add('--sql_filter', required=False,
               default='', dest='sql_filter',
               help='Filter data from SQL query (e.g. WHERE id is not null)')
    parser.add('--es_timeout', required=False,
               default=10, dest='es_timeout',
               help='timeout when waiting for ES response during indexing')
    parser.add('--marker_table', action='store_true',
               default=False, dest='marker_table',
               help='write to a marker table in the SQL database')
    parser.add('--restart', '-r', action='store_true',
               default=False, dest='restart',
               help='clear all targets before running')
    parser.add('--clear', action='store_true',
               default=False, dest='clear',
               help='clear all targets')
    return parser
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号