Skip to content

Commit 1b9065f

Browse files
authored
[CIVP-13534] Escaping in civis_to_csv has changed from v1.6.0 to v1.7.0 of the python client (#185)
* remove use of parall-unload for civis_to_csv * update comment
1 parent 333a165 commit 1b9065f

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
99
### Fixed
1010
- Specify escape character in ``civis.io.read_civis_sql`` when performing parallel unload
1111
- Issue uploading files in ``civis.io.file_to_civis``
12+
- Revert performance enhancement that will change format of file produced by ``civis.io.civis_to_csv``
1213

1314
## 1.7.0 - 2017-11-15
1415
### Changed

civis/io/_tables.py

+5-17
Original file line numberDiff line numberDiff line change
@@ -371,29 +371,17 @@ def civis_to_csv(filename, sql, database, job_name=None, api_key=None,
371371
if compression == 'gzip':
372372
compression = 'none'
373373

374-
# determine if we can request headers separately; if we can then Platform
375-
# will perform a parallel unload which is significantly more performant
376-
ovrd_include_header, headers = _include_header(client, sql, include_header,
377-
db_id, credential_id,
378-
polling_interval)
379-
380-
# format headers so we can write them to the csv
381-
if headers:
382-
if not unquoted:
383-
headers = ['"{}"'.format(x.replace('"', r'\"')) for x in headers]
384-
headers = delimiter.join(headers) + '\n'
385-
headers = headers.encode('utf-8')
386-
else:
387-
headers = b''
374+
# don't support parallel unload; the output format
375+
# is different which would introduce a breaking change
376+
headers = b''
388377

389378
delimiter = DELIMITERS.get(delimiter)
390379
if not delimiter:
391380
raise ValueError("delimiter must be one of {}"
392381
.format(DELIMITERS.keys()))
393382

394-
# always set include_header to False and compression to gzip to
395-
# ensure the best performance when retrieving results
396-
csv_settings = dict(include_header=ovrd_include_header,
383+
# always set compression to gzip to reduce I/O
384+
csv_settings = dict(include_header=include_header,
397385
compression='gzip',
398386
column_delimiter=delimiter,
399387
unquoted=unquoted,

0 commit comments

Comments
 (0)