-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
108 additions
and
8 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import logging | ||
|
||
from databricks.sdk import WorkspaceClient | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def upgrade(ws: WorkspaceClient): | ||
logger.info(f"upgrading user: {ws.current_user.me().user_name}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import logging | ||
|
||
from databricks.sdk import WorkspaceClient | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def upgrade(ws: WorkspaceClient): | ||
logger.info(f"other for: {ws.current_user.me().user_name}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import logging | ||
|
||
from databricks.sdk import WorkspaceClient | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def upgrade(ws: WorkspaceClient): | ||
logger.info(f"something else: {ws.current_user.me().user_name}") |
9 changes: 9 additions & 0 deletions
9
src/databricks/labs/blueprint/migrations/v0.2.0_another_breaking_change.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import logging | ||
|
||
from databricks.sdk import WorkspaceClient | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def upgrade(ws: WorkspaceClient): | ||
logger.info(f"breaking change: {ws.current_user.me().user_name}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from databricks.sdk.mixins.compute import SemVer | ||
|
||
from databricks.labs.blueprint.installation import Installation | ||
from databricks.labs.blueprint.wheels import Version | ||
|
||
|
||
class Upgrades: | ||
def __init__(self, installation: Installation): | ||
self._installation = installation | ||
|
||
def apply(self): | ||
pass | ||
|
||
def _installed(self) -> SemVer: | ||
return self._installation.load(Version).as_semver() | ||
|
||
def _diff(self, names: list[str]): | ||
installed_version = self._installed() | ||
for name in names: | ||
semver = self._parse_version(name) | ||
if not semver < installed_version: | ||
continue | ||
yield name | ||
|
||
@staticmethod | ||
def _parse_version(name: str) -> SemVer: | ||
split = name.split("_") | ||
if len(split) < 1: | ||
raise ValueError(f"invalid spec: {name}") | ||
return SemVer.parse(split[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def test_upgrades_works(): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from databricks.labs.blueprint.installation import MockInstallation | ||
from databricks.labs.blueprint.upgrades import Upgrades | ||
|
||
|
||
def test_upgrades_works(): | ||
installation = MockInstallation({ | ||
'version.json': { | ||
'version': '0.0.1' | ||
} | ||
}) | ||
upgrades = Upgrades(installation) | ||
# upgrades. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters