Skip to content

Commit

Permalink
make default secret name derived from bucket url
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-rp committed Oct 1, 2024
1 parent 3e96a6c commit 355f5b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dlt/destinations/impl/filesystem/sql_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Any, Iterator, AnyStr, List, cast, TYPE_CHECKING, Dict

import os
import re

import dlt

Expand Down Expand Up @@ -57,8 +58,12 @@ def __init__(
)

def create_authentication(self, persistent: bool = False, secret_name: str = None) -> None:
def _escape_bucket_name(bucket_name: str) -> str:
regex = re.compile("[^a-zA-Z]")
return regex.sub("", bucket_name.lower())

if not secret_name:
secret_name = f"secret_{self.fs_client.config.protocol}"
secret_name = f"secret_{_escape_bucket_name(self.fs_client.config.bucket_url)}"

persistent_stmt = ""
if persistent:
Expand Down

0 comments on commit 355f5b6

Please sign in to comment.