lance-namespace-impls 0.1.3__tar.gz → 0.2.0__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.
Files changed (28) hide show
  1. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/PKG-INFO +1 -1
  2. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/pyproject.toml +1 -1
  3. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/src/lance_namespace_impls/hive2.py +27 -3
  4. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/src/lance_namespace_impls/hive3.py +28 -0
  5. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/.gitignore +0 -0
  6. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/README.md +0 -0
  7. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/src/lance_namespace_impls/__init__.py +0 -0
  8. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/src/lance_namespace_impls/glue.py +0 -0
  9. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/src/lance_namespace_impls/iceberg.py +0 -0
  10. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/src/lance_namespace_impls/polaris.py +0 -0
  11. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/src/lance_namespace_impls/rest_client.py +0 -0
  12. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/src/lance_namespace_impls/schema.py +0 -0
  13. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/src/lance_namespace_impls/unity.py +0 -0
  14. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/__init__.py +0 -0
  15. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_glue.py +0 -0
  16. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_glue_integration.py +0 -0
  17. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_hive2.py +0 -0
  18. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_hive2_integration.py +0 -0
  19. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_hive3.py +0 -0
  20. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_hive3_integration.py +0 -0
  21. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_iceberg.py +0 -0
  22. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_iceberg_integration.py +0 -0
  23. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_namespace.py +0 -0
  24. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_polaris.py +0 -0
  25. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_polaris_integration.py +0 -0
  26. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_schema.py +0 -0
  27. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_unity.py +0 -0
  28. {lance_namespace_impls-0.1.3 → lance_namespace_impls-0.2.0}/tests/test_unity_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lance-namespace-impls
3
- Version: 0.1.3
3
+ Version: 0.2.0
4
4
  Summary: Third-party catalog implementations for Lance Namespace
5
5
  License: Apache-2.0
6
6
  Requires-Python: >=3.10
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "lance-namespace-impls"
7
- version = "0.1.3"
7
+ version = "0.2.0"
8
8
  description = "Third-party catalog implementations for Lance Namespace"
9
9
  readme = "README.md"
10
10
  license = { text = "Apache-2.0" }
@@ -72,6 +72,8 @@ from lance_namespace_urllib3_client.models import (
72
72
  CreateNamespaceResponse,
73
73
  DropNamespaceRequest,
74
74
  DropNamespaceResponse,
75
+ DropTableRequest,
76
+ DropTableResponse,
75
77
  ListTablesRequest,
76
78
  ListTablesResponse,
77
79
  DeclareTableRequest,
@@ -397,6 +399,31 @@ class Hive2Namespace(LanceNamespace):
397
399
  logger.error(f"Failed to describe table {request.id}: {e}")
398
400
  raise
399
401
 
402
+ def drop_table(self, request: DropTableRequest) -> DropTableResponse:
403
+ """Drop a table from the Hive Metastore and delete its data."""
404
+ try:
405
+ database, table_name = self._normalize_identifier(request.id)
406
+
407
+ with self.client as client:
408
+ table = client.get_table(database, table_name)
409
+
410
+ if not table.parameters:
411
+ raise ValueError(f"Table {request.id} is not a Lance table")
412
+ table_type = table.parameters.get(TABLE_TYPE_KEY, "").lower()
413
+ if table_type != LANCE_TABLE_FORMAT:
414
+ raise ValueError(f"Table {request.id} is not a Lance table")
415
+
416
+ location = table.sd.location if table.sd else None
417
+
418
+ client.drop_table(database, table_name, deleteData=True)
419
+
420
+ return DropTableResponse(location=location)
421
+ except Exception as e:
422
+ if NoSuchObjectException and isinstance(e, NoSuchObjectException):
423
+ raise ValueError(f"Table {request.id} does not exist")
424
+ logger.error(f"Failed to drop table {request.id}: {e}")
425
+ raise
426
+
400
427
  def deregister_table(
401
428
  self, request: DeregisterTableRequest
402
429
  ) -> DeregisterTableResponse:
@@ -405,10 +432,8 @@ class Hive2Namespace(LanceNamespace):
405
432
  database, table_name = self._normalize_identifier(request.id)
406
433
 
407
434
  with self.client as client:
408
- # Get table to check if it's a Lance table
409
435
  table = client.get_table(database, table_name)
410
436
 
411
- # Check if it's a Lance table (case insensitive)
412
437
  if not table.parameters:
413
438
  raise ValueError(f"Table {request.id} is not a Lance table")
414
439
  table_type = table.parameters.get(TABLE_TYPE_KEY, "").lower()
@@ -417,7 +442,6 @@ class Hive2Namespace(LanceNamespace):
417
442
 
418
443
  location = table.sd.location if table.sd else None
419
444
 
420
- # Drop the table metadata only (don't delete data)
421
445
  client.drop_table(database, table_name, deleteData=False)
422
446
 
423
447
  return DeregisterTableResponse(location=location)
@@ -74,6 +74,8 @@ from lance_namespace_urllib3_client.models import (
74
74
  CreateNamespaceResponse,
75
75
  DropNamespaceRequest,
76
76
  DropNamespaceResponse,
77
+ DropTableRequest,
78
+ DropTableResponse,
77
79
  ListTablesRequest,
78
80
  ListTablesResponse,
79
81
  DeclareTableRequest,
@@ -477,6 +479,32 @@ class Hive3Namespace(LanceNamespace):
477
479
  logger.error(f"Failed to describe table {request.id}: {e}")
478
480
  raise
479
481
 
482
+ def drop_table(self, request: DropTableRequest) -> DropTableResponse:
483
+ """Drop a table and delete its data."""
484
+ try:
485
+ catalog, database, table_name = self._normalize_identifier(request.id)
486
+
487
+ with self.client as client:
488
+ table = client.get_table(database, table_name)
489
+
490
+ if not table.parameters:
491
+ raise ValueError(f"Table {request.id} is not a Lance table")
492
+ table_type = table.parameters.get(TABLE_TYPE_KEY, "").lower()
493
+ if table_type != LANCE_TABLE_FORMAT:
494
+ raise ValueError(f"Table {request.id} is not a Lance table")
495
+
496
+ location = table.sd.location if table.sd else None
497
+
498
+ client.drop_table(database, table_name, deleteData=True)
499
+
500
+ return DropTableResponse(location=location)
501
+
502
+ except Exception as e:
503
+ if NoSuchObjectException and isinstance(e, NoSuchObjectException):
504
+ raise ValueError(f"Table {request.id} does not exist")
505
+ logger.error(f"Failed to drop table {request.id}: {e}")
506
+ raise
507
+
480
508
  def deregister_table(
481
509
  self, request: DeregisterTableRequest
482
510
  ) -> DeregisterTableResponse: