Skip to content

Commit

Permalink
Add backslash to quotable characters
Browse files Browse the repository at this point in the history
A backslash itself needs to be escaped when generating the Postgres copy
output.
  • Loading branch information
Mike Graves committed Apr 6, 2018
1 parent 49b5277 commit b1a5e25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion slingshot/db.py
Expand Up @@ -71,7 +71,7 @@ def prep_field(field, _type, encoding):
if _type == 'C':
if type(field) is bytes:
field = field.decode(encoding)
quotable = (u'\t', u'\n', u'\r', u'\.')
quotable = ('\\', u'\t', u'\n', u'\r', u'\.')
for q in quotable:
field = field.replace(q, u'\\' + q)
return field
Expand Down

0 comments on commit b1a5e25

Please sign in to comment.