Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 10 additions & 28 deletions chunk_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

from .errorcode import (ER_NO_ADDITIONAL_CHUNK, ER_CHUNK_DOWNLOAD_FAILED)
from .errors import (Error, OperationalError)
from .network import (SnowflakeRestful, NO_TOKEN, make_session)
from .ssl_wrap_socket import (set_proxies)

DEFAULT_REQUEST_TIMEOUT = 3600
DEFAULT_CLIENT_RESULT_PREFETCH_SLOTS = 2
Expand Down Expand Up @@ -126,7 +124,7 @@ def _download_chunk(self, idx):

logger.debug(u"started getting the result set %s: %s",
idx + 1, self._chunks[idx].url)
result_data = self._get_request(self._chunks[idx].url, headers)
result_data = self._fetch_chunk(self._chunks[idx].url, headers)
logger.debug(u"finished getting the result set %s: %s",
idx + 1, self._chunks[idx].url)

Expand Down Expand Up @@ -253,31 +251,15 @@ def __del__(self):
# ignore all errors in the destructor
pass

def _get_request(self, url, headers, is_raw_binary_iterator=True):
def _fetch_chunk(self, url, headers):
"""
GET request for Large Result set chunkloader
Fetch the chunk from S3.
"""
# sharing the proxy and certificate
proxies = set_proxies(
self._connection.rest._proxy_host,
self._connection.rest._proxy_port,
self._connection.rest._proxy_user,
self._connection.rest._proxy_password)

logger.debug(u'proxies=%s, url=%s', proxies, url)

return SnowflakeRestful.access_url(
self._connection,
make_session(),
u'get',
full_url=url,
headers=headers,
data=None,
proxies=proxies,
timeout=(self._connection._connect_timeout,
self._connection._connect_timeout,
DEFAULT_REQUEST_TIMEOUT),
token=NO_TOKEN,
is_raw_binary=True,
is_raw_binary_iterator=is_raw_binary_iterator,
timeouts = (
self._connection._connect_timeout,
self._connection._connect_timeout,
DEFAULT_REQUEST_TIMEOUT
)
return self._connection.rest.fetch(u'get', url, headers,
timeouts=timeouts, is_raw_binary=True, is_raw_binary_iterator=True,
use_ijson=self._use_ijson)
Loading