Skip to content

Commit 4ff25b4

Browse files
committed
from_url
1 parent 70076a4 commit 4ff25b4

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "dean_utils"
7-
version="0.0.50"
7+
version="0.0.51"
88
authors=[
99
{ name="Dean MacGregor", email="powertrading121@gmail.com"}
1010
]

src/dean_utils/utils/az_utils.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,24 @@ def __init__(self, connection_string=os.environ["Synblob"]): # noqa: SIM112
160160
stor = {key_conv[key]: val for key, val in stor.items() if key in key_conv}
161161
self.stor = stor
162162

163+
async def from_url(
164+
self,
165+
source_url: str,
166+
path: str,
167+
metadata: dict[str, str] | None = None,
168+
*,
169+
incremental_copy: bool = False,
170+
**kwargs,
171+
) -> dict[str, str | datetime]:
172+
async with (
173+
BlobClient.from_connection_string(
174+
self.connection_string, *(path.split("/", maxsplit=1))
175+
) as target,
176+
):
177+
return await target.start_copy_from_url(
178+
source_url, metadata, incremental_copy=incremental_copy, **kwargs
179+
)
180+
163181
async def stream_dl(
164182
self,
165183
client: httpx.AsyncClient,

0 commit comments

Comments
 (0)