Skip to content

Commit a6d8978

Browse files
committed
fix: allow single file jsongz import
1 parent f6e3e40 commit a6d8978

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

rethinkdb/_import.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -895,11 +895,11 @@ def parse_options(argv, prog=None):
895895
file_import_group.add_option(
896896
"--format",
897897
dest="format",
898-
metavar="json|csv",
898+
metavar="json|jsongz|csv",
899899
default=None,
900900
help="format of the file (default: json, accepts newline delimited json)",
901901
type="choice",
902-
choices=["json", "csv"],
902+
choices=["json", "jsongz", "csv"],
903903
)
904904
file_import_group.add_option(
905905
"--pkey",
@@ -1076,7 +1076,7 @@ def parse_options(argv, prog=None):
10761076
if options.custom_header:
10771077
options.custom_header = options.custom_header.split(",")
10781078

1079-
elif options.format == "json":
1079+
elif (options.format == "json" or options.format == "jsongz") :
10801080
# disallow invalid options
10811081
if options.delimiter is not None:
10821082
parser.error("--delimiter option is not valid for json files")
@@ -1085,9 +1085,6 @@ def parse_options(argv, prog=None):
10851085
if options.custom_header is not None:
10861086
parser.error("--custom-header option is not valid for json files")
10871087

1088-
# default options
1089-
options.format = "json"
1090-
10911088
if options.max_document_size > 0:
10921089
global JSON_MAX_BUFFER_SIZE
10931090
JSON_MAX_BUFFER_SIZE = options.max_document_size

0 commit comments

Comments
 (0)