Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions docs/en/engines/database-engines/datalake.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ The following settings are supported:
| `storage_endpoint` | Endpoint URL for the underlying storage |
| `oauth_server_uri` | URI of the OAuth2 authorization server for authentication |
| `vended_credentials` | Boolean indicating whether to use vended credentials from the catalog (supports AWS S3 and Azure ADLS Gen2) |
| `vended_credentials_cache_ttl` | Maximum cache entry lifetime (in seconds) for vended credentials (REST catalogs only). Default `300`; `0` disables caching. |
| `aws_access_key_id` | AWS access key ID for S3/Glue access (if not using vended credentials) |
| `aws_secret_access_key` | AWS secret access key for S3/Glue access (if not using vended credentials) |
| `region` | AWS region for the service (e.g., `us-east-1`) |
Expand Down
3 changes: 3 additions & 0 deletions src/Common/ProfileEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,9 @@ The server successfully detected this situation and will download merged part fr
M(AIRowsProcessed, "Number of rows that received an AI result.", ValueType::Number) \
M(AIRowsSkipped, "Number of rows that received a default value due to quota or error.", ValueType::Number) \
\
M(DataLakeRestCatalogCredentialsVended, "Number of table metadata requests to REST catalog asking to vend storage credentials.", ValueType::Number) \
M(DataLakeRestCatalogCredentialsCacheHits, "Number of table metadata requests to REST catalog reusing cached storage credentials.", ValueType::Number) \
\

#ifdef APPLY_FOR_EXTERNAL_EVENTS
#define APPLY_FOR_EVENTS(M) APPLY_FOR_BUILTIN_EVENTS(M) APPLY_FOR_EXTERNAL_EVENTS(M)
Expand Down
7 changes: 7 additions & 0 deletions src/Databases/DataLake/DatabaseDataLake.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <algorithm>
#include <array>
#include <chrono>
#include <memory>
#include <Databases/DataLake/DatabaseDataLake.h>
#include <Core/SettingsEnums.h>
Expand Down Expand Up @@ -63,6 +64,7 @@ namespace DatabaseDataLakeSetting
extern const DatabaseDataLakeSettingsString oauth_server_uri;
extern const DatabaseDataLakeSettingsBool oauth_server_use_request_body;
extern const DatabaseDataLakeSettingsBool vended_credentials;
extern const DatabaseDataLakeSettingsUInt64 vended_credentials_cache_ttl;
extern const DatabaseDataLakeSettingsString aws_access_key_id;
extern const DatabaseDataLakeSettingsString aws_secret_access_key;
extern const DatabaseDataLakeSettingsString region;
Expand Down Expand Up @@ -319,6 +321,10 @@ std::shared_ptr<DataLake::ICatalog> DatabaseDataLake::getCatalog() const
/// Lazily build the catalog on first access for databases attached at startup (see ctor).
if (!catalog_impl)
initialize();

catalog_impl->setVendedCredentialsCacheTTL(
std::chrono::seconds(settings[DatabaseDataLakeSetting::vended_credentials_cache_ttl].value));

return catalog_impl;
}

Expand Down Expand Up @@ -1208,6 +1214,7 @@ The following settings are supported:
| `storage_endpoint` | Endpoint URL for the underlying storage |
| `oauth_server_uri` | URI of the OAuth2 authorization server for authentication |
| `vended_credentials` | Boolean indicating whether to use vended credentials from the catalog (supports AWS S3 and Azure ADLS Gen2) |
| `vended_credentials_cache_ttl` | Maximum cache entry lifetime (in seconds) for vended credentials (REST catalogs only). Default `300`; `0` disables caching. |
| `aws_access_key_id` | AWS access key ID for S3/Glue access (if not using vended credentials) |
| `aws_secret_access_key` | AWS secret access key for S3/Glue access (if not using vended credentials) |
| `region` | AWS region for the service (e.g., `us-east-1`) |
Expand Down
1 change: 1 addition & 0 deletions src/Databases/DataLake/DatabaseDataLakeSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace ErrorCodes
DECLARE(DatabaseDataLakeCatalogType, catalog_type, DatabaseDataLakeCatalogType::NONE, "Catalog type", 0) \
DECLARE(String, catalog_credential, "", "", 0) \
DECLARE(Bool, vended_credentials, true, "Use vended credentials (storage credentials) from catalog", 0) \
DECLARE(UInt64, vended_credentials_cache_ttl, 300, "Maximum cache entry lifetime (in seconds) for vended credentials. '0' disables caching.", 0) \
DECLARE(String, auth_scope, "PRINCIPAL_ROLE:ALL", "Authorization scope for client credentials or token exchange", 0) \
DECLARE(String, oauth_server_uri, "", "OAuth server uri", 0) \
DECLARE(Bool, oauth_server_use_request_body, true, "Put parameters into request body or query params", 0) \
Expand Down
3 changes: 3 additions & 0 deletions src/Databases/DataLake/ICatalog.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <chrono>
#include <optional>
#include <Core/Types.h>
#include <Core/NamesAndTypes.h>
Expand Down Expand Up @@ -212,6 +213,8 @@ class ICatalog
return std::nullopt;
}

virtual void setVendedCredentialsCacheTTL(std::chrono::seconds /*ttl*/) {}

protected:
/// Name of the warehouse,
/// which is sometimes also called "catalog name".
Expand Down
Loading
Loading