Skip to content

Commit

Permalink
#139 Removed archive extension in the BucketPath.as_udf_path (#140)
Browse files Browse the repository at this point in the history
* Prepare release 0.11.0

* #139 Removed archive extension in as_udf_path

* [run-saas-tests]

* Update doc/changes/changes_0.11.0.md

Co-authored-by: Christoph Kuhnke <[email protected]>

* [run-saas-tests]

* [run-saas-tests]

---------

Co-authored-by: Christoph Kuhnke <[email protected]>
  • Loading branch information
ahsimb and ckunki authored May 23, 2024
1 parent 16d8d3a commit 5ae2e0d
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 141 deletions.
2 changes: 2 additions & 0 deletions doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 📝 Changes

* [unreleased](unreleased.md)
* [0.11.0](changes_0.11.0.md)
* [0.10.0](changes_0.10.0.md)
* [0.9.0](changes_0.9.0.md)
* [0.8.0](changes_0.8.0.md)
Expand All @@ -17,6 +18,7 @@
hidden:
---
unreleased
changes_0.11.0
changes_0.10.0
changes_0.9.0
changes_0.8.0
Expand Down
8 changes: 8 additions & 0 deletions doc/changes/changes_0.11.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 0.11.0 - 2024-05-23

## Internal
- Updated lockfile
- Update workflows to align with used exasol-toolbox version (0.12.0)

## Bug Fixes
- #139: Removed archive extension suffix if the path is of an archive in `BucketPath.as_udf_path`
4 changes: 0 additions & 4 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
# Unreleased

## Internal
- Updated lockfile
- Update workflows to align with used exasol-toolbox version (0.12.0)
11 changes: 10 additions & 1 deletion exasol/bucketfs/_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from exasol.bucketfs._service import Service
from exasol.bucketfs._error import BucketFsError

ARCHIVE_SUFFIXES = [".tar", ".gz", ".tgz", ".zip", ".tar"]


class StorageBackend(Enum):
onprem = auto()
Expand Down Expand Up @@ -170,6 +172,12 @@ def __truediv__(self, other):
"""


def _remove_archive_suffix(path: PurePath) -> PurePath:
while path.suffix in ARCHIVE_SUFFIXES:
path = path.with_suffix('')
return path


class _BucketFile:
"""
A node in a perceived file structure of a bucket.
Expand Down Expand Up @@ -288,7 +296,8 @@ def as_uri(self) -> str:
return self._path.as_uri()

def as_udf_path(self) -> str:
return str(PurePath(self._bucket_api.udf_path) / self._path)
return str(PurePath(self._bucket_api.udf_path) /
_remove_archive_suffix(self._path))

def exists(self) -> bool:
return self._navigate() is not None
Expand Down
2 changes: 1 addition & 1 deletion exasol/bucketfs/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
# Do not edit this file manually!
# If you need to change the version, do so in the project.toml, e.g. by using `poetry version X.Y.Z`.
MAJOR = 0
MINOR = 10
MINOR = 11
PATCH = 0
VERSION = f"{MAJOR}.{MINOR}.{PATCH}"
Loading

0 comments on commit 5ae2e0d

Please sign in to comment.