Skip to content
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

Support for Delta Extension #19

Merged
merged 2 commits into from
Jul 24, 2024
Merged
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
16 changes: 15 additions & 1 deletion deltalake2db/azure_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ def get_storage_options_fsspec(storage_options: dict):
return storage_options


def get_account_name_from_path(path: str):
if ".blob.core.windows.net" in path or ".dfs.core.windows.net" in path:
from urllib.parse import urlparse

up = urlparse(path)
return up.netloc.split(".")[0]
return None


def get_storage_options_object_store(
path: Union[Path, str],
storage_options: Optional[dict],
Expand Down Expand Up @@ -109,14 +118,19 @@ def _get_cred(chain: str):
if chain is not None:
new_opts = storage_options.copy()
new_opts.pop("chain", None)
new_opts.pop("anon", None)
cred = _get_credential_from_chain(chain, get_credential)
new_opts["token"] = cred.get_token(STORAGE_SCOPE).token
if account_name_from_url:
new_opts["account_name"] = new_opts.get(
"account_name", account_name_from_url
)
return new_path, new_opts
elif "anon" in storage_options and str(storage_options["anon"]).lower() in [
"1",
"true",
]:
storage_options = storage_options.copy()
storage_options.pop("anon")
if account_name_from_url is not None and "account_name" not in storage_options:
new_opts = storage_options.copy()
new_opts["account_name"] = account_name_from_url
Expand Down
Loading
Loading