sqlspec 0.21.0__py3-none-any.whl → 0.22.0__py3-none-any.whl

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.

Potentially problematic release.


This version of sqlspec might be problematic. Click here for more details.

@@ -1,102 +0,0 @@
1
- """Storage backend capability system.
2
-
3
- This module provides a centralized way to track and query storage backend capabilities.
4
- """
5
-
6
- from dataclasses import dataclass
7
- from typing import ClassVar
8
-
9
- from mypy_extensions import mypyc_attr
10
-
11
- __all__ = ("HasStorageCapabilities", "StorageCapabilities")
12
-
13
-
14
- @dataclass
15
- class StorageCapabilities:
16
- """Tracks capabilities of a storage backend."""
17
-
18
- supports_read: bool = True
19
- supports_write: bool = True
20
- supports_delete: bool = True
21
- supports_list: bool = True
22
- supports_exists: bool = True
23
- supports_copy: bool = True
24
- supports_move: bool = True
25
- supports_metadata: bool = True
26
-
27
- supports_arrow: bool = False
28
- supports_streaming: bool = False
29
- supports_async: bool = False
30
- supports_batch_operations: bool = False
31
- supports_multipart_upload: bool = False
32
- supports_compression: bool = False
33
-
34
- supports_s3_select: bool = False
35
- supports_gcs_compose: bool = False
36
- supports_azure_snapshots: bool = False
37
-
38
- is_remote: bool = True
39
- is_cloud_native: bool = False
40
- has_low_latency: bool = False
41
-
42
- @classmethod
43
- def local_filesystem(cls) -> "StorageCapabilities":
44
- """Capabilities for local filesystem backend."""
45
- return cls(
46
- is_remote=False, has_low_latency=True, supports_arrow=True, supports_streaming=True, supports_async=True
47
- )
48
-
49
- @classmethod
50
- def s3_compatible(cls) -> "StorageCapabilities":
51
- """Capabilities for S3-compatible backends."""
52
- return cls(
53
- is_cloud_native=True,
54
- supports_multipart_upload=True,
55
- supports_s3_select=True,
56
- supports_arrow=True,
57
- supports_streaming=True,
58
- supports_async=True,
59
- )
60
-
61
- @classmethod
62
- def gcs(cls) -> "StorageCapabilities":
63
- """Capabilities for Google Cloud Storage."""
64
- return cls(
65
- is_cloud_native=True,
66
- supports_multipart_upload=True,
67
- supports_gcs_compose=True,
68
- supports_arrow=True,
69
- supports_streaming=True,
70
- supports_async=True,
71
- )
72
-
73
- @classmethod
74
- def azure_blob(cls) -> "StorageCapabilities":
75
- """Capabilities for Azure Blob Storage."""
76
- return cls(
77
- is_cloud_native=True,
78
- supports_multipart_upload=True,
79
- supports_azure_snapshots=True,
80
- supports_arrow=True,
81
- supports_streaming=True,
82
- supports_async=True,
83
- )
84
-
85
-
86
- @mypyc_attr(allow_interpreted_subclasses=True)
87
- class HasStorageCapabilities:
88
- """Mixin for storage backends that expose their capabilities."""
89
-
90
- __slots__ = ()
91
-
92
- capabilities: ClassVar[StorageCapabilities]
93
-
94
- @classmethod
95
- def has_capability(cls, capability: str) -> bool:
96
- """Check if backend has a specific capability."""
97
- return getattr(cls.capabilities, capability, False)
98
-
99
- @classmethod
100
- def get_capabilities(cls) -> StorageCapabilities:
101
- """Get all capabilities for this backend."""
102
- return cls.capabilities