foundry-dev-tools 2.1.4__tar.gz → 2.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/PKG-INFO +1 -1
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/pyproject.toml +1 -1
- foundry_dev_tools-2.1.7/src/foundry_dev_tools/__about__.py +1 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/cli/git.py +3 -3
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/context_client.py +41 -5
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/config/token_provider.py +1 -1
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/resources/dataset.py +50 -33
- foundry_dev_tools-2.1.4/src/foundry_dev_tools/__about__.py +0 -1
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/README.md +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/_optional/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/_optional/pandas.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/_optional/polars.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/_optional/pyarrow.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/_optional/pyspark.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/cached_foundry_client.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/cli/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/cli/build.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/cli/config.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/cli/git_credential_foundry.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/cli/info.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/cli/main.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/cli/s3.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/cli/stubs.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/api_client.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/build2.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/catalog.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/compass.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/data_proxy.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/foundry_sql_server.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/foundry_stats.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/jemma.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/metadata.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/multipass.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/public_ontologies_client.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/s3_client.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/schema_inference.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/config/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/config/config.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/config/config_types.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/config/context.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/errors/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/errors/compass.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/errors/config.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/errors/dataset.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/errors/handling.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/errors/meta.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/errors/multipass.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/errors/sql.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/foundry_api_client.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/helpers/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/helpers/multipass/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/helpers/multipass/group.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/helpers/multipass/principal.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/helpers/multipass/user.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/py.typed +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/resources/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/resources/folder.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/resources/resource.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/api_types.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/async_s3.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/caches/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/caches/metadata_store.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/caches/spark_caches.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/cli.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/clients.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/compat.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/config.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/converter/__init__.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/converter/foundry_spark.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/misc.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/public_api_types.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/repo.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/s3.py +0 -0
- {foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/spark.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: foundry-dev-tools
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.7
|
|
4
4
|
Summary: Seamlessly run your Palantir Foundry Repository transforms code on your local machine.
|
|
5
5
|
Author-Email: Nicolas Renkamp <nicolas.renkamp@merckgroup.com>, Jonas Wunderlich <jonas.wunderlich@merckgroup.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.1.7'
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import os
|
|
4
4
|
import re
|
|
5
5
|
import subprocess
|
|
6
|
-
from urllib.parse import urlparse
|
|
6
|
+
from urllib.parse import quote, urlparse
|
|
7
7
|
|
|
8
8
|
import click
|
|
9
9
|
from rich.console import Console
|
|
@@ -65,9 +65,9 @@ def _git_clone_cli(ctx: FoundryContext, console: Console, repo: str, path: str |
|
|
|
65
65
|
if repo_id is None:
|
|
66
66
|
return
|
|
67
67
|
repo_object = ctx.get_resource(repo_id)
|
|
68
|
-
clone_url = f"{ctx.host.scheme}://{ctx.host.domain}/stemma/git/{repo_id}/{repo_object.name}"
|
|
68
|
+
clone_url = f"{ctx.host.scheme}://{ctx.host.domain}" + quote(f"/stemma/git/{repo_id}/{repo_object.name}")
|
|
69
69
|
|
|
70
|
-
_path =
|
|
70
|
+
_path = repo_object.name if path is None else path
|
|
71
71
|
console.print(f"Executing git clone {clone_url} {path}")
|
|
72
72
|
if _path:
|
|
73
73
|
os.execvp("git", ["git", "clone", clone_url, _path]) # noqa: S606
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/context_client.py
RENAMED
|
@@ -5,6 +5,8 @@ from __future__ import annotations
|
|
|
5
5
|
import logging
|
|
6
6
|
import numbers
|
|
7
7
|
import os
|
|
8
|
+
import time
|
|
9
|
+
import typing
|
|
8
10
|
from typing import TYPE_CHECKING, Literal
|
|
9
11
|
|
|
10
12
|
import requests
|
|
@@ -32,6 +34,40 @@ if TYPE_CHECKING:
|
|
|
32
34
|
from foundry_dev_tools.config.context import FoundryContext
|
|
33
35
|
|
|
34
36
|
DEFAULT_TIMEOUT = (60, None)
|
|
37
|
+
LOGGER = logging.getLogger(__name__)
|
|
38
|
+
LOGGER.setLevel(logging.DEBUG)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def retry(times: int, exceptions: tuple[Exception]) -> typing.Callable:
|
|
42
|
+
"""Retry Decorator.
|
|
43
|
+
|
|
44
|
+
Code Copied from https://stackoverflow.com/a/64030200
|
|
45
|
+
|
|
46
|
+
Retries the wrapped function/method `times` times if the exceptions listed
|
|
47
|
+
in ``exceptions`` are thrown
|
|
48
|
+
:param times: The number of times to repeat the wrapped function/method
|
|
49
|
+
:type times: Int
|
|
50
|
+
:param Exceptions: Lists of exceptions that trigger a retry attempt
|
|
51
|
+
:type Exceptions: Tuple of Exceptions
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
def decorator(func: typing.Callable) -> typing.Callable:
|
|
55
|
+
def newfn(*args, **kwargs) -> typing.Callable:
|
|
56
|
+
attempt = 0
|
|
57
|
+
while attempt < times:
|
|
58
|
+
try:
|
|
59
|
+
return func(*args, **kwargs)
|
|
60
|
+
except exceptions: # noqa: PERF203
|
|
61
|
+
LOGGER.debug(
|
|
62
|
+
"Exception thrown when attempting to run %s, attempt " "%d of %d", func, attempt, times
|
|
63
|
+
)
|
|
64
|
+
time.sleep(0.1)
|
|
65
|
+
attempt += 1
|
|
66
|
+
return func(*args, **kwargs)
|
|
67
|
+
|
|
68
|
+
return newfn
|
|
69
|
+
|
|
70
|
+
return decorator
|
|
35
71
|
|
|
36
72
|
|
|
37
73
|
class ContextHTTPClient(requests.Session):
|
|
@@ -43,11 +79,10 @@ class ContextHTTPClient(requests.Session):
|
|
|
43
79
|
if self.context.config.requests_ca_bundle:
|
|
44
80
|
self.verify = os.fspath(self.context.config.requests_ca_bundle)
|
|
45
81
|
self.auth = lambda r: self.context.token_provider.requests_auth_handler(r)
|
|
46
|
-
self._logger = logging.getLogger(__name__)
|
|
47
|
-
self._logger.setLevel(logging.DEBUG)
|
|
48
82
|
self._counter = 0
|
|
49
83
|
self.headers = {"User-Agent": f"foundry-dev-tools/{__version__}/python-requests"}
|
|
50
84
|
|
|
85
|
+
@retry(times=3, exceptions=requests.exceptions.ConnectionError)
|
|
51
86
|
def request(
|
|
52
87
|
self,
|
|
53
88
|
method: str | bytes,
|
|
@@ -93,7 +128,7 @@ class ContextHTTPClient(requests.Session):
|
|
|
93
128
|
verify = rcab
|
|
94
129
|
if self.context.config.debug:
|
|
95
130
|
self._counter = count = self._counter + 1
|
|
96
|
-
|
|
131
|
+
LOGGER.debug(f"(r{count}) Making {method!s} request to {url!s}") # noqa: G004
|
|
97
132
|
|
|
98
133
|
if isinstance(timeout, numbers.Number):
|
|
99
134
|
# add default connect timeout if timeout is a number
|
|
@@ -121,10 +156,11 @@ class ContextHTTPClient(requests.Session):
|
|
|
121
156
|
json=json,
|
|
122
157
|
)
|
|
123
158
|
if self.context.config.debug:
|
|
124
|
-
|
|
159
|
+
LOGGER.debug(
|
|
125
160
|
f"(r{count}) Got response status={response.status_code}, " # noqa: G004
|
|
126
161
|
f"content_type={response.headers.get('content-type')}, "
|
|
127
|
-
f"content_length={response.headers.get('content-length')}"
|
|
162
|
+
f"content_length={response.headers.get('content-length')}, "
|
|
163
|
+
f"Server-Timing={response.headers.get('Server-Timing')}",
|
|
128
164
|
)
|
|
129
165
|
raise_foundry_api_error(response, error_handling)
|
|
130
166
|
return response
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/config/token_provider.py
RENAMED
|
@@ -171,7 +171,7 @@ class OAuthTokenProvider(CachedTokenProvider):
|
|
|
171
171
|
resp = requests.request(
|
|
172
172
|
"POST",
|
|
173
173
|
f"{self.host.url}/multipass/api/oauth2/token",
|
|
174
|
-
data={"grant_type": "client_credentials", "scope": self.scopes}
|
|
174
|
+
data={"grant_type": "client_credentials", "scope": " ".join(self.scopes)}
|
|
175
175
|
if self.scopes
|
|
176
176
|
else {"grant_type": "client_credentials"},
|
|
177
177
|
headers={
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/resources/dataset.py
RENAMED
|
@@ -41,7 +41,7 @@ if TYPE_CHECKING:
|
|
|
41
41
|
class Dataset(resource.Resource):
|
|
42
42
|
"""Helper class for datasets."""
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
_branch: api_types.Branch = None
|
|
45
45
|
_transaction: api_types.Transaction | None = None
|
|
46
46
|
__created__: bool | None = None
|
|
47
47
|
rid_start: ClassVar[str] = "ri.foundry.main.dataset"
|
|
@@ -55,6 +55,22 @@ class Dataset(resource.Resource):
|
|
|
55
55
|
raise RuntimeError(msg)
|
|
56
56
|
super().__init__(*args, **kwargs)
|
|
57
57
|
|
|
58
|
+
@property
|
|
59
|
+
def branch(self) -> api_types.Branch:
|
|
60
|
+
"""The branch of the dataset.
|
|
61
|
+
|
|
62
|
+
If self._branch is not set, and the default "master" branch does not exist, it will be created.
|
|
63
|
+
"""
|
|
64
|
+
if not self._branch:
|
|
65
|
+
# create branch with default name, if the branch is not set
|
|
66
|
+
# (e.g. when created via get_resource or directly instantiated)
|
|
67
|
+
self.switch_branch("master", create_branch_if_not_exists=True)
|
|
68
|
+
return self._branch
|
|
69
|
+
|
|
70
|
+
@branch.setter
|
|
71
|
+
def branch(self, branch: api_types.DatasetBranch):
|
|
72
|
+
self._branch = branch
|
|
73
|
+
|
|
58
74
|
@classmethod
|
|
59
75
|
def from_rid(
|
|
60
76
|
cls,
|
|
@@ -85,16 +101,12 @@ class Dataset(resource.Resource):
|
|
|
85
101
|
if isinstance(branch, dict):
|
|
86
102
|
inst.branch = branch
|
|
87
103
|
else:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
branch_id=branch,
|
|
95
|
-
parent_ref=parent_ref,
|
|
96
|
-
parent_branch_id=parent_branch_id,
|
|
97
|
-
).json()
|
|
104
|
+
inst.switch_branch(
|
|
105
|
+
branch=branch,
|
|
106
|
+
create_branch_if_not_exists=create_branch_if_not_exists,
|
|
107
|
+
parent_ref=parent_ref,
|
|
108
|
+
parent_branch_id=parent_branch_id,
|
|
109
|
+
)
|
|
98
110
|
return inst
|
|
99
111
|
|
|
100
112
|
@classmethod
|
|
@@ -128,16 +140,12 @@ class Dataset(resource.Resource):
|
|
|
128
140
|
"""
|
|
129
141
|
try:
|
|
130
142
|
inst = super().from_path(context, path, **kwargs)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
branch_id=branch,
|
|
138
|
-
parent_ref=parent_ref,
|
|
139
|
-
parent_branch_id=parent_branch_id,
|
|
140
|
-
).json()
|
|
143
|
+
inst.switch_branch(
|
|
144
|
+
branch=branch,
|
|
145
|
+
create_branch_if_not_exists=create_branch_if_not_exists,
|
|
146
|
+
parent_ref=parent_ref,
|
|
147
|
+
parent_branch_id=parent_branch_id,
|
|
148
|
+
)
|
|
141
149
|
inst.__created__ = False
|
|
142
150
|
except ResourceNotFoundError:
|
|
143
151
|
if create_if_not_exist:
|
|
@@ -160,14 +168,9 @@ class Dataset(resource.Resource):
|
|
|
160
168
|
See :py:meth:`~foundry_dev_tools.clients.catalog.CatalogClient.api_create_dataset`.
|
|
161
169
|
"""
|
|
162
170
|
rid = context.catalog.api_create_dataset(path).json()["rid"]
|
|
163
|
-
branch = context.catalog.api_create_branch(
|
|
164
|
-
rid,
|
|
165
|
-
branch,
|
|
166
|
-
parent_ref=parent_ref,
|
|
167
|
-
parent_branch_id=parent_branch_id,
|
|
168
|
-
).json()
|
|
169
171
|
|
|
170
|
-
inst = cls.from_rid(context, rid
|
|
172
|
+
inst = cls.from_rid(context, rid)
|
|
173
|
+
inst.switch_branch(branch=branch, parent_ref=parent_ref, parent_branch_id=parent_branch_id)
|
|
171
174
|
inst.__created__ = True
|
|
172
175
|
return inst
|
|
173
176
|
|
|
@@ -177,7 +180,7 @@ class Dataset(resource.Resource):
|
|
|
177
180
|
parent_ref: api_types.TransactionRid | None = None,
|
|
178
181
|
parent_branch_id: api_types.DatasetBranch | None = None,
|
|
179
182
|
) -> Self:
|
|
180
|
-
"""Creates a branch on a dataset.
|
|
183
|
+
"""Creates a branch on a dataset and switches to it.
|
|
181
184
|
|
|
182
185
|
Args:
|
|
183
186
|
branch: the branch to create
|
|
@@ -195,15 +198,29 @@ class Dataset(resource.Resource):
|
|
|
195
198
|
def switch_branch(
|
|
196
199
|
self,
|
|
197
200
|
branch: api_types.DatasetBranch,
|
|
201
|
+
create_branch_if_not_exists: bool = False,
|
|
202
|
+
parent_ref: api_types.TransactionRid | None = None,
|
|
203
|
+
parent_branch_id: api_types.DatasetBranch | None = None,
|
|
198
204
|
) -> Self:
|
|
199
205
|
"""Switch to another branch.
|
|
200
206
|
|
|
201
|
-
Branch needs to exist.
|
|
202
|
-
|
|
203
207
|
Args:
|
|
204
208
|
branch: the name of the branch to switch to
|
|
209
|
+
create_branch_if_not_exists: create branch if branch does not exist,
|
|
210
|
+
branch always will be created if resource does not exist
|
|
211
|
+
parent_ref: optionally the transaction off which the branch will be based
|
|
212
|
+
(only used if branch needs to be created)
|
|
213
|
+
parent_branch_id: optionally a parent branch name, otherwise a root branch
|
|
214
|
+
(only used if branch needs to be created)
|
|
215
|
+
|
|
205
216
|
"""
|
|
206
|
-
|
|
217
|
+
try:
|
|
218
|
+
self.branch = self.get_branch(branch)
|
|
219
|
+
except BranchNotFoundError:
|
|
220
|
+
if create_branch_if_not_exists:
|
|
221
|
+
self.create_branch(branch=branch, parent_ref=parent_ref, parent_branch_id=parent_branch_id)
|
|
222
|
+
else:
|
|
223
|
+
raise
|
|
207
224
|
return self
|
|
208
225
|
|
|
209
226
|
def get_branch(self, branch: api_types.DatasetBranch) -> api_types.Branch:
|
|
@@ -797,7 +814,7 @@ class Dataset(resource.Resource):
|
|
|
797
814
|
|
|
798
815
|
def _get_repr_dict(self) -> dict:
|
|
799
816
|
d = super()._get_repr_dict()
|
|
800
|
-
d["branch"] =
|
|
817
|
+
d["branch"] = self.branch["id"]
|
|
801
818
|
return d
|
|
802
819
|
|
|
803
820
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '2.1.4'
|
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/_optional/__init__.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/_optional/pandas.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/_optional/polars.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/_optional/pyarrow.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/_optional/pyspark.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/cached_foundry_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/__init__.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/api_client.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/catalog.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/compass.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/data_proxy.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/foundry_stats.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/metadata.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/multipass.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/clients/s3_client.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/config/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/config/config_types.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/errors/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/errors/handling.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/errors/multipass.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/foundry_api_client.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/helpers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/helpers/multipass/group.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/helpers/multipass/user.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/resources/__init__.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/resources/folder.py
RENAMED
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/resources/resource.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/api_types.py
RENAMED
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/caches/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{foundry_dev_tools-2.1.4 → foundry_dev_tools-2.1.7}/src/foundry_dev_tools/utils/public_api_types.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|