コード例 #1
0
    def read(self, table: Union[GemTable, Tuple[str, int]], local_path: str):
        """
        Read the Table file from S3.

        If a Table object is not provided, retrieve it using the provided table and version ids.
        """
        # NOTE: this uses the pre-signed S3 download url. If we need to download larger files,
        # we have other options available (using multi-part downloads in parallel , for example).
        if isinstance(table, Tuple):
            table = self.get(table[0], table[1])

        data_location = table.download_url
        data_location = rewrite_s3_links_locally(data_location, self.session.s3_endpoint_url)
        response = requests.get(data_location)
        write_file_locally(response.content, local_path)
コード例 #2
0
def test_rewrite_s3_links_locally():
    assert "http://localhost:9572" == rewrite_s3_links_locally(
        "http://localstack:4572")
コード例 #3
0
 def read(self, local_path):
     """[DEPRECATED] Use TableCollection.read() instead."""  # noqa: D402
     data_location = self.download_url
     data_location = rewrite_s3_links_locally(data_location)
     response = requests.get(data_location)
     write_file_locally(response.content, local_path)
コード例 #4
0
 def read(self, local_path):
     """Read the Table file from S3."""
     data_location = self.download_url
     data_location = rewrite_s3_links_locally(data_location)
     response = requests.get(data_location)
     write_file_locally(response.content, local_path)