|
11 | 11 |
|
12 | 12 | from .errorcode import (ER_NO_ADDITIONAL_CHUNK, ER_CHUNK_DOWNLOAD_FAILED)
|
13 | 13 | from .errors import (Error, OperationalError)
|
14 |
| -from .network import (SnowflakeRestful, NO_TOKEN, MAX_CONNECTION_POOL) |
15 |
| -from .ssl_wrap_socket import (set_proxies) |
16 | 14 |
|
17 | 15 | DEFAULT_REQUEST_TIMEOUT = 3600
|
18 | 16 | DEFAULT_CLIENT_RESULT_PREFETCH_SLOTS = 2
|
@@ -126,9 +124,7 @@ def _download_chunk(self, idx):
|
126 | 124 |
|
127 | 125 | logger.debug(u"started getting the result set %s: %s",
|
128 | 126 | idx + 1, self._chunks[idx].url)
|
129 |
| - result_data = self._get_request( |
130 |
| - self._chunks[idx].url, |
131 |
| - headers, max_connection_pool=self._effective_threads) |
| 127 | + result_data = self._fetch_chunk(self._chunks[idx].url, headers) |
132 | 128 | logger.debug(u"finished getting the result set %s: %s",
|
133 | 129 | idx + 1, self._chunks[idx].url)
|
134 | 130 |
|
@@ -255,35 +251,15 @@ def __del__(self):
|
255 | 251 | # ignore all errors in the destructor
|
256 | 252 | pass
|
257 | 253 |
|
258 |
| - def _get_request( |
259 |
| - self, url, headers, |
260 |
| - is_raw_binary_iterator=True, |
261 |
| - max_connection_pool=MAX_CONNECTION_POOL): |
| 254 | + def _fetch_chunk(self, url, headers): |
262 | 255 | """
|
263 |
| - GET request for Large Result set chunkloader |
| 256 | + Fetch the chunk from S3. |
264 | 257 | """
|
265 |
| - # sharing the proxy and certificate |
266 |
| - proxies = set_proxies( |
267 |
| - self._connection.rest._proxy_host, |
268 |
| - self._connection.rest._proxy_port, |
269 |
| - self._connection.rest._proxy_user, |
270 |
| - self._connection.rest._proxy_password) |
271 |
| - |
272 |
| - logger.debug(u'proxies=%s, url=%s', proxies, url) |
273 |
| - |
274 |
| - return SnowflakeRestful.access_url( |
275 |
| - self._connection, |
276 |
| - self, |
277 |
| - u'get', |
278 |
| - full_url=url, |
279 |
| - headers=headers, |
280 |
| - data=None, |
281 |
| - proxies=proxies, |
282 |
| - timeout=(self._connection._connect_timeout, |
283 |
| - self._connection._connect_timeout, |
284 |
| - DEFAULT_REQUEST_TIMEOUT), |
285 |
| - token=NO_TOKEN, |
286 |
| - is_raw_binary=True, |
287 |
| - is_raw_binary_iterator=is_raw_binary_iterator, |
288 |
| - max_connection_pool=max_connection_pool, |
| 258 | + timeouts = ( |
| 259 | + self._connection._connect_timeout, |
| 260 | + self._connection._connect_timeout, |
| 261 | + DEFAULT_REQUEST_TIMEOUT |
| 262 | + ) |
| 263 | + return self._connection.rest.fetch(u'get', url, headers, |
| 264 | + timeouts=timeouts, is_raw_binary=True, is_raw_binary_iterator=True, |
289 | 265 | use_ijson=self._use_ijson)
|
0 commit comments