-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for COPY TO/FROM Azure Blob Storage #55
Conversation
fe03728
to
4dc228c
Compare
b9114cf
to
2feb683
Compare
afb3c71
to
2a3061f
Compare
2a3061f
to
0a3281f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #55 +/- ##
==========================================
+ Coverage 92.11% 92.54% +0.42%
==========================================
Files 71 75 +4
Lines 9109 9621 +512
==========================================
+ Hits 8391 8904 +513
+ Misses 718 717 -1 ☔ View full report in Codecov by Sentry. |
0a3281f
to
80e449f
Compare
Supports following Azure Blob uri forms: - `az://{container}/key` - `azure://{container}/key` - `https://{account}.blob.core.windows.net/{container}` **Configuration** The simplest way to configure object storage is by creating the standard [`~/.azure/config`](https://learn.microsoft.com/en-us/cli/azure/azure-cli-configuration?view=azure-cli-latest) file: ```bash $ cat ~/.azure/config [storage] account = devstoreaccount1 key = Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw== ``` Alternatively, you can use the following environment variables when starting postgres to configure the Azure Blob Storage client: - `AZURE_STORAGE_ACCOUNT`: the storage account name of the Azure Blob - `AZURE_STORAGE_KEY`: the storage key of the Azure Blob - `AZURE_STORAGE_SAS_TOKEN`: the storage SAS token for the Azure Blob - `AZURE_CONFIG_FILE`: an alternative location for the config file **Bonus** Additionally, PR supports following S3 uri forms: - `s3://{bucket}/key` - `s3a://{bucket}/key` - `https://s3.amazonaws.com/{bucket}/key` - `https://{bucket}.s3.amazonaws.com/key` Closes #50
80e449f
to
8553677
Compare
done | ||
|
||
# create container | ||
az storage container create -n $AZURE_TEST_CONTAINER_NAME --connection-string $AZURE_STORAGE_CONNECTION_STRING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot easily create azurite test container via a docker entrypoint script (as we do for minio) since azurite image does not include az cli.
24ff523
to
e0df256
Compare
@@ -20,6 +24,15 @@ pgrx::pg_module_magic!(); | |||
|
|||
extension_sql_file!("../sql/bootstrap.sql", name = "role_setup", bootstrap); | |||
|
|||
// PG_BACKEND_TOKIO_RUNTIME creates a tokio runtime that uses the current thread |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved from uri_utils to a more common file
src/object_store.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved object store logic from uri_utils to this module with a submodule per object store
e0df256
to
e9d0cdd
Compare
src/object_store/aws.rs
Outdated
|
||
// first tries environment variables and then the config files | ||
let sdk_config = PG_BACKEND_TOKIO_RUNTIME.block_on(async { | ||
aws_config::defaults(BehaviorVersion::v2024_03_28()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this also does the STS dance then, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct via provide_credentials()
- get rid of aws-sts dep in test as aws_config already supports it
5d0b80f
to
d5f5ef2
Compare
Supports following Azure Blob uri forms:
az://{container}/key
azure://{container}/key
https://{account}.blob.core.windows.net/{container}
Configuration
The simplest way to configure object storage is by creating the standard
~/.azure/config
file:$ cat ~/.azure/config [storage] account = devstoreaccount1 key = Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
Alternatively, you can use the following environment variables when starting postgres to configure the Azure Blob Storage client:
AZURE_STORAGE_ACCOUNT
: the storage account name of the Azure BlobAZURE_STORAGE_KEY
: the storage key of the Azure BlobAZURE_CONNECTION_STRING
: the connection string of the Azure BlobAZURE_STORAGE_SAS_TOKEN
: the storage SAS token for the Azure BlobAZURE_TENANT_ID
: the tenant id for client secret auth (only via environment variables)AZURE_CLIENT_ID
: the client id for client secret auth (only via environment variables)AZURE_CLIENT_SECRET
: the client secret for client secret auth (only via environment variables)AZURE_STORAGE_ENDPOINT
: the endpoint (only via environment variables)AZURE_ALLOW_HTTP
: allows http endpoints (only via environment variables)AZURE_CONFIG_FILE
: an alternative location for the config file (only via environment variables)Bonus
Additionally, PR adds support to the following S3 uri forms:
https://s3.amazonaws.com/{bucket}/key
https://{bucket}.s3.amazonaws.com/key
Closes #50