rethinkdb/rethinkdb — pull request #2097 by Aleaxander (2014-03-14 07:50:01+00:00)
Title: driver/python: fix import_format error

I tried to import a csv file with import subcommand, however, it failed
due to import_format was set to "json" by default if --format is not
given:

$ rethinkdb import -f x.csv --table test.csv_example
[ ] 0%
0 rows imported in 1 table
Traceback: [('/usr/lib64/python2.7/site-packages/rethinkdb/_import.py', 458,....)]
RuntimeError: Error: JSON format not recognized - file does not begin with an object or array
In file: /path/to/x.csv
Errors occurred during import

I guess we can do better by trying to get the proper format from the
filename, and then set it to "json" if failed.

Signed-off-by: Liu Aleaxander