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
评论列表
文章目录