Skip to content

Commit 6b1e890

Browse files
oyarushedarthbear
authored andcommitted
Added support of using custom S3 endpoint URL (chimpler#4)
1 parent f04bbaa commit 6b1e890

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,7 @@ psql> select * from animals;
193193

194194
If the file has the metadata `Content-Encoding=gzip` in S3, then the file will be automatically unzipped prior to be copied to the table.
195195
One can update the metadata in S3 by following the instructions described [here](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-object-metadata.html).
196+
197+
## Support custom S3 endpoint URL
198+
199+
If you need to change S3 endpoint URL set environment variable `S3_ENDPOINT_URL`, for example, to use local S3 server for development.

aws_s3--0.0.1.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ AS $$
6363
module_cache[module_name] = _module
6464
return _module
6565

66+
os = cache_import('os')
67+
6668
boto3 = cache_import('boto3')
6769
tempfile = cache_import('tempfile')
6870
gzip = cache_import('gzip')
@@ -75,7 +77,8 @@ AS $$
7577
aws_access_key_id=access_key,
7678
aws_secret_access_key=secret_key,
7779
aws_session_token=session_token,
78-
region_name=region
80+
region_name=region,
81+
endpoint_url=os.environ.get('S3_ENDPOINT_URL')
7982
)
8083

8184
response = s3.head_object(Bucket=bucket, Key=file_path)

0 commit comments

Comments
 (0)