From ec4f06cabe86220fb61492b491d0c068db568335 Mon Sep 17 00:00:00 2001 From: mibe Date: Tue, 10 Feb 2026 16:23:09 +0000 Subject: [PATCH 1/3] #55 Added database idle time --- doc/changes/unreleased.md | 4 ++++ exasol/saas/client/api_access.py | 16 ++++++++++++++-- test/unit/test_api_access.py | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/doc/changes/unreleased.md b/doc/changes/unreleased.md index 8e31d73..97416b2 100644 --- a/doc/changes/unreleased.md +++ b/doc/changes/unreleased.md @@ -7,3 +7,7 @@ tbd. ## Refactorings * #128: Explicitly configured validation of SaaS SSL certificates in pyexasol connection + +## Bug fixing + +* #135: Made the database name semi-unique. \ No newline at end of file diff --git a/exasol/saas/client/api_access.py b/exasol/saas/client/api_access.py index e8eaafb..3f11b21 100644 --- a/exasol/saas/client/api_access.py +++ b/exasol/saas/client/api_access.py @@ -60,9 +60,21 @@ def interval_retry(interval: timedelta, timeout: timedelta): def timestamp_name(project_short_tag: str | None = None) -> str: """ - project_short_tag: Abbreviation of your project + Generates a semi-unique name for a database with the following format: + - 0-4: number of minutes since the start of the year in hex, + - 0-5: a semi-random number, + - provided tag, + - -username. + + Args: + project_short_tag: Abbreviation of your project """ - timestamp = f"{datetime.now(timezone.utc).timestamp():.0f}" + now = datetime.now() + year_start = datetime(now.year, 1, 1) + minutes_elapsed = int((now - year_start).total_seconds() // 60) + random_suffix = time.time_ns() % 1048576 + timestamp = f"{minutes_elapsed:05x}{random_suffix:05x}" + owner = getpass.getuser() candidate = f"{timestamp}{project_short_tag or ''}-{owner}" return candidate[: Limits.MAX_DATABASE_NAME_LENGTH] diff --git a/test/unit/test_api_access.py b/test/unit/test_api_access.py index f936705..3cbfc3b 100644 --- a/test/unit/test_api_access.py +++ b/test/unit/test_api_access.py @@ -7,6 +7,7 @@ from exasol.saas.client.api_access import ( OpenApiAccess, indicates_retry, + timestamp_name ) from exasol.saas.client.openapi.errors import UnexpectedStatus @@ -121,3 +122,16 @@ def test_delete_success( ) assert api_runner.mock.called assert expected_log_message in caplog.text + + +def test_timestamp_name() -> None: + names = [timestamp_name('TEST') for _ in range(3)] + minutes = [int(name[:5], 16) for name in names] + suffixes = [int(name[5:10], 16) for name in names] + tags = [name[10:14] for name in names] + # minutes from the start of the year should be the same + assert minutes[0] == minutes[1] or minutes[1] == minutes[2] + # suffixes should all be different + assert len(set(suffixes)) == 3 + # the provided tag should follow the hacky timestamp. + assert all(tag == 'TEST' for tag in tags) From 969962777cd0f6ac451250db079b0e270ea8d3d0 Mon Sep 17 00:00:00 2001 From: mibe Date: Wed, 11 Feb 2026 15:18:24 +0000 Subject: [PATCH 2/3] prepared release 2.7.0 --- doc/changes/changelog.md | 4 +++- doc/changes/changes_2.7.0.md | 13 +++++++++++++ doc/changes/unreleased.md | 12 ------------ pyproject.toml | 2 +- version.py | 2 +- 5 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 doc/changes/changes_2.7.0.md diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md index a5a21e1..e30deaa 100644 --- a/doc/changes/changelog.md +++ b/doc/changes/changelog.md @@ -1,6 +1,7 @@ # Changes -* [unreleased](unreleased.md) +* [unreleased](changes_2.7.0.md) +* [2.7.0](changes_2.7.0.md) * [2.6.0](changes_2.6.0.md) * [2.5.0](changes_2.5.0.md) * [2.4.0](changes_2.4.0.md) @@ -28,6 +29,7 @@ hidden: --- unreleased +changes_2.7.0 changes_2.6.0 changes_2.5.0 changes_2.4.0 diff --git a/doc/changes/changes_2.7.0.md b/doc/changes/changes_2.7.0.md new file mode 100644 index 0000000..006dd73 --- /dev/null +++ b/doc/changes/changes_2.7.0.md @@ -0,0 +1,13 @@ +# 2.7.0 - 2026-02-11 + +## Summary + +This release makes a breaking change in the format of the generated SaaS database name. + +## Refactorings + +* #128: Explicitly configured validation of SaaS SSL certificates in pyexasol connection + +## Bugfixes + +* #135: Made the database name semi-unique. \ No newline at end of file diff --git a/doc/changes/unreleased.md b/doc/changes/unreleased.md index 8661472..79e701b 100644 --- a/doc/changes/unreleased.md +++ b/doc/changes/unreleased.md @@ -1,13 +1 @@ # Unreleased - -## Summary - -tbd. - -## Refactorings - -* #128: Explicitly configured validation of SaaS SSL certificates in pyexasol connection - -## Bugfixes - -* #135: Made the database name semi-unique. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index ca36aac..4f88475 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "exasol-saas-api" -version = "2.6.0" +version = "2.7.0" requires-python = ">=3.10.0,<4.0" description = "API enabling Python applications connecting to Exasol database SaaS instances and using their SaaS services" authors = [ diff --git a/version.py b/version.py index d182308..ec718e9 100644 --- a/version.py +++ b/version.py @@ -9,7 +9,7 @@ """ MAJOR = 2 -MINOR = 6 +MINOR = 7 PATCH = 0 VERSION = f"{MAJOR}.{MINOR}.{PATCH}" __version__ = VERSION From f2e9140bf85ced86776d32aca97f686050b7d1d3 Mon Sep 17 00:00:00 2001 From: Mikhail Beck Date: Wed, 11 Feb 2026 15:39:09 +0000 Subject: [PATCH 3/3] Update doc/changes/changelog.md Co-authored-by: Steffen Pankratz --- doc/changes/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md index e30deaa..9a724e3 100644 --- a/doc/changes/changelog.md +++ b/doc/changes/changelog.md @@ -1,6 +1,6 @@ # Changes -* [unreleased](changes_2.7.0.md) +* [unreleased](unreleased.md) * [2.7.0](changes_2.7.0.md) * [2.6.0](changes_2.6.0.md) * [2.5.0](changes_2.5.0.md)