ygg 0.1.65__tar.gz → 0.1.66__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.
- {ygg-0.1.65 → ygg-0.1.66}/PKG-INFO +1 -1
- {ygg-0.1.65 → ygg-0.1.66}/pyproject.toml +1 -1
- {ygg-0.1.65 → ygg-0.1.66}/src/ygg.egg-info/PKG-INFO +1 -1
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/sql/engine.py +2 -1
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/sql/statement_result.py +8 -6
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/sql/warehouse.py +83 -5
- ygg-0.1.66/src/yggdrasil/version.py +1 -0
- ygg-0.1.65/src/yggdrasil/version.py +0 -1
- {ygg-0.1.65 → ygg-0.1.66}/LICENSE +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/README.md +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/setup.cfg +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/ygg.egg-info/SOURCES.txt +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/ygg.egg-info/dependency_links.txt +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/ygg.egg-info/entry_points.txt +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/ygg.egg-info/requires.txt +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/ygg.egg-info/top_level.txt +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/ai/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/ai/session.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/ai/sql_session.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/compute/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/compute/cluster.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/compute/command_execution.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/compute/exceptions.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/compute/execution_context.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/compute/remote.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/exceptions.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/jobs/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/jobs/config.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/sql/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/sql/exceptions.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/sql/types.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/workspaces/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/workspaces/filesytem.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/workspaces/io.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/workspaces/path.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/workspaces/path_kind.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/workspaces/volumes_path.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/databricks/workspaces/workspace.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/dataclasses/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/dataclasses/dataclass.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/exceptions.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/libs/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/libs/databrickslib.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/libs/extensions/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/libs/extensions/polars_extensions.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/libs/extensions/spark_extensions.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/libs/pandaslib.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/libs/polarslib.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/libs/sparklib.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/pyutils/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/pyutils/callable_serde.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/pyutils/equality.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/pyutils/exceptions.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/pyutils/expiring_dict.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/pyutils/mimetypes.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/pyutils/modules.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/pyutils/parallel.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/pyutils/python_env.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/pyutils/retry.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/pyutils/waiting_config.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/requests/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/requests/msal.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/requests/session.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/cast/__init__.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/cast/arrow_cast.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/cast/cast_options.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/cast/pandas_cast.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/cast/polars_cast.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/cast/polars_pandas_cast.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/cast/registry.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/cast/spark_cast.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/cast/spark_pandas_cast.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/cast/spark_polars_cast.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/dummy_class.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/file_format.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/python_arrow.py +0 -0
- {ygg-0.1.65 → ygg-0.1.66}/src/yggdrasil/types/python_defaults.py +0 -0
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "ygg"
|
|
8
|
-
version = "0.1.
|
|
8
|
+
version = "0.1.66"
|
|
9
9
|
description = "Type-friendly utilities for moving data between Python objects, Arrow, Polars, Pandas, Spark, and Databricks"
|
|
10
10
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
11
11
|
license = { file = "LICENSE" }
|
|
@@ -186,7 +186,8 @@ class SQLEngine(WorkspaceService):
|
|
|
186
186
|
self._warehouse = wh.find_warehouse(
|
|
187
187
|
warehouse_id=warehouse_id,
|
|
188
188
|
warehouse_name=warehouse_name,
|
|
189
|
-
raise_error=False
|
|
189
|
+
raise_error=False,
|
|
190
|
+
find_starter=True
|
|
190
191
|
)
|
|
191
192
|
|
|
192
193
|
if self._warehouse is None:
|
|
@@ -305,14 +305,16 @@ class StatementResult:
|
|
|
305
305
|
The current StatementResult instance.
|
|
306
306
|
"""
|
|
307
307
|
wait = WaitingConfig.check_arg(wait)
|
|
308
|
-
iteration, start = 0, time.time()
|
|
309
308
|
|
|
310
|
-
if
|
|
311
|
-
|
|
312
|
-
iteration += 1
|
|
309
|
+
if wait.timeout:
|
|
310
|
+
iteration, start = 0, time.time()
|
|
313
311
|
|
|
314
|
-
|
|
315
|
-
|
|
312
|
+
if not self.done:
|
|
313
|
+
wait.sleep(iteration=iteration, start=start)
|
|
314
|
+
iteration += 1
|
|
315
|
+
|
|
316
|
+
if raise_error:
|
|
317
|
+
self.raise_for_status()
|
|
316
318
|
|
|
317
319
|
return self
|
|
318
320
|
|
|
@@ -18,8 +18,9 @@ try:
|
|
|
18
18
|
EndpointTags, EndpointTagPair, EndpointInfoWarehouseType,
|
|
19
19
|
GetWarehouseResponse, GetWarehouseResponseWarehouseType,
|
|
20
20
|
Disposition, Format,
|
|
21
|
-
ExecuteStatementRequestOnWaitTimeout, StatementParameterListItem
|
|
22
|
-
|
|
21
|
+
ExecuteStatementRequestOnWaitTimeout, StatementParameterListItem,
|
|
22
|
+
WarehouseAccessControlRequest, WarehousePermissionLevel
|
|
23
|
+
)
|
|
23
24
|
|
|
24
25
|
_CREATE_ARG_NAMES = {_ for _ in inspect.signature(WarehousesAPI.create).parameters.keys()}
|
|
25
26
|
_EDIT_ARG_NAMES = {_ for _ in inspect.signature(WarehousesAPI.edit).parameters.keys()}
|
|
@@ -36,6 +37,7 @@ except ImportError:
|
|
|
36
37
|
Format = DatabricksDummyClass
|
|
37
38
|
ExecuteStatementRequestOnWaitTimeout = DatabricksDummyClass
|
|
38
39
|
StatementParameterListItem = DatabricksDummyClass
|
|
40
|
+
WarehouseAccessControlRequest = DatabricksDummyClass
|
|
39
41
|
|
|
40
42
|
|
|
41
43
|
__all__ = [
|
|
@@ -242,6 +244,7 @@ class SQLWarehouse(WorkspaceService):
|
|
|
242
244
|
warehouse_id: Optional[str] = None,
|
|
243
245
|
warehouse_name: Optional[str] = None,
|
|
244
246
|
raise_error: bool = True,
|
|
247
|
+
find_starter: bool = False
|
|
245
248
|
):
|
|
246
249
|
if warehouse_id:
|
|
247
250
|
if warehouse_id == self.warehouse_id:
|
|
@@ -291,7 +294,7 @@ class SQLWarehouse(WorkspaceService):
|
|
|
291
294
|
elif warehouse.warehouse_name == starter_name:
|
|
292
295
|
starter_warehouse = warehouse
|
|
293
296
|
|
|
294
|
-
if starter_warehouse is not None:
|
|
297
|
+
if find_starter and starter_warehouse is not None:
|
|
295
298
|
return starter_warehouse
|
|
296
299
|
|
|
297
300
|
if raise_error:
|
|
@@ -401,6 +404,7 @@ class SQLWarehouse(WorkspaceService):
|
|
|
401
404
|
warehouse_id=warehouse_id,
|
|
402
405
|
warehouse_name=name,
|
|
403
406
|
raise_error=False,
|
|
407
|
+
find_starter=False
|
|
404
408
|
)
|
|
405
409
|
|
|
406
410
|
if found is not None:
|
|
@@ -443,13 +447,17 @@ class SQLWarehouse(WorkspaceService):
|
|
|
443
447
|
|
|
444
448
|
info = EndpointInfo(**update_details)
|
|
445
449
|
|
|
446
|
-
|
|
450
|
+
created = SQLWarehouse(
|
|
447
451
|
workspace=self.workspace,
|
|
448
452
|
warehouse_id=info.id,
|
|
449
453
|
warehouse_name=info.name,
|
|
450
454
|
_details=info
|
|
451
455
|
)
|
|
452
456
|
|
|
457
|
+
created.update_permissions()
|
|
458
|
+
|
|
459
|
+
return created
|
|
460
|
+
|
|
453
461
|
def update(
|
|
454
462
|
self,
|
|
455
463
|
wait: Optional[WaitingConfigArg] = None,
|
|
@@ -510,6 +518,76 @@ class SQLWarehouse(WorkspaceService):
|
|
|
510
518
|
|
|
511
519
|
return self
|
|
512
520
|
|
|
521
|
+
def update_permissions(
|
|
522
|
+
self,
|
|
523
|
+
access_control_list: Optional[List[WarehouseAccessControlRequest]] = None,
|
|
524
|
+
wait: Optional[WaitingConfigArg] = None
|
|
525
|
+
):
|
|
526
|
+
if self.warehouse_id:
|
|
527
|
+
client = self.warehouse_client()
|
|
528
|
+
|
|
529
|
+
access_control_list = self._check_access_control_list(
|
|
530
|
+
access_control_list=access_control_list
|
|
531
|
+
)
|
|
532
|
+
|
|
533
|
+
if access_control_list:
|
|
534
|
+
client.update_permissions(
|
|
535
|
+
warehouse_id=self.warehouse_id,
|
|
536
|
+
access_control_list=access_control_list
|
|
537
|
+
)
|
|
538
|
+
|
|
539
|
+
def default_access_control_list(self, for_all: bool):
|
|
540
|
+
if for_all:
|
|
541
|
+
base = [
|
|
542
|
+
WarehouseAccessControlRequest(
|
|
543
|
+
group_name="users",
|
|
544
|
+
permission_level=WarehousePermissionLevel.CAN_USE
|
|
545
|
+
)
|
|
546
|
+
]
|
|
547
|
+
else:
|
|
548
|
+
base = []
|
|
549
|
+
|
|
550
|
+
groups = self.workspace.current_user.groups
|
|
551
|
+
|
|
552
|
+
if groups:
|
|
553
|
+
base.extend(
|
|
554
|
+
WarehouseAccessControlRequest(
|
|
555
|
+
group_name=group.display,
|
|
556
|
+
permission_level=WarehousePermissionLevel.CAN_MANAGE
|
|
557
|
+
)
|
|
558
|
+
for group in groups
|
|
559
|
+
if group.display != "users"
|
|
560
|
+
)
|
|
561
|
+
|
|
562
|
+
return base
|
|
563
|
+
|
|
564
|
+
def _check_access_control_list(
|
|
565
|
+
self,
|
|
566
|
+
access_control_list: Optional[List[WarehouseAccessControlRequest]] = None
|
|
567
|
+
):
|
|
568
|
+
if access_control_list is None:
|
|
569
|
+
access_control_list = []
|
|
570
|
+
|
|
571
|
+
access_control_list.extend(self.default_access_control_list(
|
|
572
|
+
for_all=self.warehouse_name.startswith("yggdrasil") if self.warehouse_name else False
|
|
573
|
+
))
|
|
574
|
+
|
|
575
|
+
return access_control_list
|
|
576
|
+
|
|
577
|
+
def delete(self):
|
|
578
|
+
if self.warehouse_id:
|
|
579
|
+
LOGGER.debug(
|
|
580
|
+
"Deleting %s",
|
|
581
|
+
self
|
|
582
|
+
)
|
|
583
|
+
|
|
584
|
+
self.warehouse_client().delete(id=self.warehouse_id)
|
|
585
|
+
|
|
586
|
+
LOGGER.info(
|
|
587
|
+
"Deleted %s",
|
|
588
|
+
self
|
|
589
|
+
)
|
|
590
|
+
|
|
513
591
|
def execute(
|
|
514
592
|
self,
|
|
515
593
|
statement: Optional[str] = None,
|
|
@@ -599,4 +677,4 @@ class SQLWarehouse(WorkspaceService):
|
|
|
599
677
|
execution
|
|
600
678
|
)
|
|
601
679
|
|
|
602
|
-
return execution.wait()
|
|
680
|
+
return execution.wait(wait=wait)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.66"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.65"
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|