Closed
Description
According to the doc of read_sql, dialect can be string or a csv.Dialect instance.
However this is not the case. If you look at the code, it can only really take a csv.Dialect instance. i.e. this doesn't work:
fh = io.StringIO(u"pomme\tpoire\n1\t\2")
pd.read_csv(fh, dialect='excel-tab')
but, this works:
fh = io.StringIO(u"pomme\tpoire\n1\t\2")
pd.read_csv(fh, dialect=csv.get_dialect('excel-tab'))
I would expect it to be able to take any string returned by the csv.list_dialects() function, similar to the way csv.reader works. So we can either remove the mention of string from the doc, or make it work as intended by checking if the dialect string is part of csv.list_dialects(). Let me know if this makes sense and I'll submit a PR.