sqlspec 0.32.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.
- sqlspec/__init__.py +104 -0
- sqlspec/__main__.py +12 -0
- sqlspec/__metadata__.py +14 -0
- sqlspec/_serialization.py +312 -0
- sqlspec/_typing.py +784 -0
- sqlspec/adapters/__init__.py +0 -0
- sqlspec/adapters/adbc/__init__.py +5 -0
- sqlspec/adapters/adbc/_types.py +12 -0
- sqlspec/adapters/adbc/adk/__init__.py +5 -0
- sqlspec/adapters/adbc/adk/store.py +880 -0
- sqlspec/adapters/adbc/config.py +436 -0
- sqlspec/adapters/adbc/data_dictionary.py +537 -0
- sqlspec/adapters/adbc/driver.py +841 -0
- sqlspec/adapters/adbc/litestar/__init__.py +5 -0
- sqlspec/adapters/adbc/litestar/store.py +504 -0
- sqlspec/adapters/adbc/type_converter.py +153 -0
- sqlspec/adapters/aiosqlite/__init__.py +29 -0
- sqlspec/adapters/aiosqlite/_types.py +13 -0
- sqlspec/adapters/aiosqlite/adk/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/adk/store.py +536 -0
- sqlspec/adapters/aiosqlite/config.py +310 -0
- sqlspec/adapters/aiosqlite/data_dictionary.py +260 -0
- sqlspec/adapters/aiosqlite/driver.py +463 -0
- sqlspec/adapters/aiosqlite/litestar/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/litestar/store.py +281 -0
- sqlspec/adapters/aiosqlite/pool.py +500 -0
- sqlspec/adapters/asyncmy/__init__.py +25 -0
- sqlspec/adapters/asyncmy/_types.py +12 -0
- sqlspec/adapters/asyncmy/adk/__init__.py +5 -0
- sqlspec/adapters/asyncmy/adk/store.py +503 -0
- sqlspec/adapters/asyncmy/config.py +246 -0
- sqlspec/adapters/asyncmy/data_dictionary.py +241 -0
- sqlspec/adapters/asyncmy/driver.py +632 -0
- sqlspec/adapters/asyncmy/litestar/__init__.py +5 -0
- sqlspec/adapters/asyncmy/litestar/store.py +296 -0
- sqlspec/adapters/asyncpg/__init__.py +23 -0
- sqlspec/adapters/asyncpg/_type_handlers.py +76 -0
- sqlspec/adapters/asyncpg/_types.py +23 -0
- sqlspec/adapters/asyncpg/adk/__init__.py +5 -0
- sqlspec/adapters/asyncpg/adk/store.py +460 -0
- sqlspec/adapters/asyncpg/config.py +464 -0
- sqlspec/adapters/asyncpg/data_dictionary.py +321 -0
- sqlspec/adapters/asyncpg/driver.py +720 -0
- sqlspec/adapters/asyncpg/litestar/__init__.py +5 -0
- sqlspec/adapters/asyncpg/litestar/store.py +253 -0
- sqlspec/adapters/bigquery/__init__.py +18 -0
- sqlspec/adapters/bigquery/_types.py +12 -0
- sqlspec/adapters/bigquery/adk/__init__.py +5 -0
- sqlspec/adapters/bigquery/adk/store.py +585 -0
- sqlspec/adapters/bigquery/config.py +298 -0
- sqlspec/adapters/bigquery/data_dictionary.py +256 -0
- sqlspec/adapters/bigquery/driver.py +1073 -0
- sqlspec/adapters/bigquery/litestar/__init__.py +5 -0
- sqlspec/adapters/bigquery/litestar/store.py +327 -0
- sqlspec/adapters/bigquery/type_converter.py +125 -0
- sqlspec/adapters/duckdb/__init__.py +24 -0
- sqlspec/adapters/duckdb/_types.py +12 -0
- sqlspec/adapters/duckdb/adk/__init__.py +14 -0
- sqlspec/adapters/duckdb/adk/store.py +563 -0
- sqlspec/adapters/duckdb/config.py +396 -0
- sqlspec/adapters/duckdb/data_dictionary.py +264 -0
- sqlspec/adapters/duckdb/driver.py +604 -0
- sqlspec/adapters/duckdb/litestar/__init__.py +5 -0
- sqlspec/adapters/duckdb/litestar/store.py +332 -0
- sqlspec/adapters/duckdb/pool.py +273 -0
- sqlspec/adapters/duckdb/type_converter.py +133 -0
- sqlspec/adapters/oracledb/__init__.py +32 -0
- sqlspec/adapters/oracledb/_numpy_handlers.py +133 -0
- sqlspec/adapters/oracledb/_types.py +39 -0
- sqlspec/adapters/oracledb/_uuid_handlers.py +130 -0
- sqlspec/adapters/oracledb/adk/__init__.py +5 -0
- sqlspec/adapters/oracledb/adk/store.py +1632 -0
- sqlspec/adapters/oracledb/config.py +469 -0
- sqlspec/adapters/oracledb/data_dictionary.py +717 -0
- sqlspec/adapters/oracledb/driver.py +1493 -0
- sqlspec/adapters/oracledb/litestar/__init__.py +5 -0
- sqlspec/adapters/oracledb/litestar/store.py +765 -0
- sqlspec/adapters/oracledb/migrations.py +532 -0
- sqlspec/adapters/oracledb/type_converter.py +207 -0
- sqlspec/adapters/psqlpy/__init__.py +16 -0
- sqlspec/adapters/psqlpy/_type_handlers.py +44 -0
- sqlspec/adapters/psqlpy/_types.py +12 -0
- sqlspec/adapters/psqlpy/adk/__init__.py +5 -0
- sqlspec/adapters/psqlpy/adk/store.py +483 -0
- sqlspec/adapters/psqlpy/config.py +271 -0
- sqlspec/adapters/psqlpy/data_dictionary.py +179 -0
- sqlspec/adapters/psqlpy/driver.py +892 -0
- sqlspec/adapters/psqlpy/litestar/__init__.py +5 -0
- sqlspec/adapters/psqlpy/litestar/store.py +272 -0
- sqlspec/adapters/psqlpy/type_converter.py +102 -0
- sqlspec/adapters/psycopg/__init__.py +32 -0
- sqlspec/adapters/psycopg/_type_handlers.py +90 -0
- sqlspec/adapters/psycopg/_types.py +18 -0
- sqlspec/adapters/psycopg/adk/__init__.py +5 -0
- sqlspec/adapters/psycopg/adk/store.py +962 -0
- sqlspec/adapters/psycopg/config.py +487 -0
- sqlspec/adapters/psycopg/data_dictionary.py +630 -0
- sqlspec/adapters/psycopg/driver.py +1336 -0
- sqlspec/adapters/psycopg/litestar/__init__.py +5 -0
- sqlspec/adapters/psycopg/litestar/store.py +554 -0
- sqlspec/adapters/spanner/__init__.py +38 -0
- sqlspec/adapters/spanner/_type_handlers.py +186 -0
- sqlspec/adapters/spanner/_types.py +12 -0
- sqlspec/adapters/spanner/adk/__init__.py +5 -0
- sqlspec/adapters/spanner/adk/store.py +435 -0
- sqlspec/adapters/spanner/config.py +241 -0
- sqlspec/adapters/spanner/data_dictionary.py +95 -0
- sqlspec/adapters/spanner/dialect/__init__.py +6 -0
- sqlspec/adapters/spanner/dialect/_spangres.py +52 -0
- sqlspec/adapters/spanner/dialect/_spanner.py +123 -0
- sqlspec/adapters/spanner/driver.py +366 -0
- sqlspec/adapters/spanner/litestar/__init__.py +5 -0
- sqlspec/adapters/spanner/litestar/store.py +266 -0
- sqlspec/adapters/spanner/type_converter.py +46 -0
- sqlspec/adapters/sqlite/__init__.py +18 -0
- sqlspec/adapters/sqlite/_type_handlers.py +86 -0
- sqlspec/adapters/sqlite/_types.py +11 -0
- sqlspec/adapters/sqlite/adk/__init__.py +5 -0
- sqlspec/adapters/sqlite/adk/store.py +582 -0
- sqlspec/adapters/sqlite/config.py +221 -0
- sqlspec/adapters/sqlite/data_dictionary.py +256 -0
- sqlspec/adapters/sqlite/driver.py +527 -0
- sqlspec/adapters/sqlite/litestar/__init__.py +5 -0
- sqlspec/adapters/sqlite/litestar/store.py +318 -0
- sqlspec/adapters/sqlite/pool.py +140 -0
- sqlspec/base.py +811 -0
- sqlspec/builder/__init__.py +146 -0
- sqlspec/builder/_base.py +900 -0
- sqlspec/builder/_column.py +517 -0
- sqlspec/builder/_ddl.py +1642 -0
- sqlspec/builder/_delete.py +84 -0
- sqlspec/builder/_dml.py +381 -0
- sqlspec/builder/_expression_wrappers.py +46 -0
- sqlspec/builder/_factory.py +1537 -0
- sqlspec/builder/_insert.py +315 -0
- sqlspec/builder/_join.py +375 -0
- sqlspec/builder/_merge.py +848 -0
- sqlspec/builder/_parsing_utils.py +297 -0
- sqlspec/builder/_select.py +1615 -0
- sqlspec/builder/_update.py +161 -0
- sqlspec/builder/_vector_expressions.py +259 -0
- sqlspec/cli.py +764 -0
- sqlspec/config.py +1540 -0
- sqlspec/core/__init__.py +305 -0
- sqlspec/core/cache.py +785 -0
- sqlspec/core/compiler.py +603 -0
- sqlspec/core/filters.py +872 -0
- sqlspec/core/hashing.py +274 -0
- sqlspec/core/metrics.py +83 -0
- sqlspec/core/parameters/__init__.py +64 -0
- sqlspec/core/parameters/_alignment.py +266 -0
- sqlspec/core/parameters/_converter.py +413 -0
- sqlspec/core/parameters/_processor.py +341 -0
- sqlspec/core/parameters/_registry.py +201 -0
- sqlspec/core/parameters/_transformers.py +226 -0
- sqlspec/core/parameters/_types.py +430 -0
- sqlspec/core/parameters/_validator.py +123 -0
- sqlspec/core/pipeline.py +187 -0
- sqlspec/core/result.py +1124 -0
- sqlspec/core/splitter.py +940 -0
- sqlspec/core/stack.py +163 -0
- sqlspec/core/statement.py +835 -0
- sqlspec/core/type_conversion.py +235 -0
- sqlspec/driver/__init__.py +36 -0
- sqlspec/driver/_async.py +1027 -0
- sqlspec/driver/_common.py +1236 -0
- sqlspec/driver/_sync.py +1025 -0
- sqlspec/driver/mixins/__init__.py +7 -0
- sqlspec/driver/mixins/_result_tools.py +61 -0
- sqlspec/driver/mixins/_sql_translator.py +122 -0
- sqlspec/driver/mixins/_storage.py +311 -0
- sqlspec/exceptions.py +321 -0
- sqlspec/extensions/__init__.py +0 -0
- sqlspec/extensions/adk/__init__.py +53 -0
- sqlspec/extensions/adk/_types.py +51 -0
- sqlspec/extensions/adk/converters.py +172 -0
- sqlspec/extensions/adk/migrations/0001_create_adk_tables.py +144 -0
- sqlspec/extensions/adk/migrations/__init__.py +0 -0
- sqlspec/extensions/adk/service.py +181 -0
- sqlspec/extensions/adk/store.py +536 -0
- sqlspec/extensions/aiosql/__init__.py +10 -0
- sqlspec/extensions/aiosql/adapter.py +471 -0
- sqlspec/extensions/fastapi/__init__.py +19 -0
- sqlspec/extensions/fastapi/extension.py +341 -0
- sqlspec/extensions/fastapi/providers.py +543 -0
- sqlspec/extensions/flask/__init__.py +36 -0
- sqlspec/extensions/flask/_state.py +72 -0
- sqlspec/extensions/flask/_utils.py +40 -0
- sqlspec/extensions/flask/extension.py +402 -0
- sqlspec/extensions/litestar/__init__.py +23 -0
- sqlspec/extensions/litestar/_utils.py +52 -0
- sqlspec/extensions/litestar/cli.py +92 -0
- sqlspec/extensions/litestar/config.py +90 -0
- sqlspec/extensions/litestar/handlers.py +316 -0
- sqlspec/extensions/litestar/migrations/0001_create_session_table.py +137 -0
- sqlspec/extensions/litestar/migrations/__init__.py +3 -0
- sqlspec/extensions/litestar/plugin.py +638 -0
- sqlspec/extensions/litestar/providers.py +454 -0
- sqlspec/extensions/litestar/store.py +265 -0
- sqlspec/extensions/otel/__init__.py +58 -0
- sqlspec/extensions/prometheus/__init__.py +107 -0
- sqlspec/extensions/starlette/__init__.py +10 -0
- sqlspec/extensions/starlette/_state.py +26 -0
- sqlspec/extensions/starlette/_utils.py +52 -0
- sqlspec/extensions/starlette/extension.py +257 -0
- sqlspec/extensions/starlette/middleware.py +154 -0
- sqlspec/loader.py +716 -0
- sqlspec/migrations/__init__.py +36 -0
- sqlspec/migrations/base.py +728 -0
- sqlspec/migrations/commands.py +1140 -0
- sqlspec/migrations/context.py +142 -0
- sqlspec/migrations/fix.py +203 -0
- sqlspec/migrations/loaders.py +450 -0
- sqlspec/migrations/runner.py +1024 -0
- sqlspec/migrations/templates.py +234 -0
- sqlspec/migrations/tracker.py +403 -0
- sqlspec/migrations/utils.py +256 -0
- sqlspec/migrations/validation.py +203 -0
- sqlspec/observability/__init__.py +22 -0
- sqlspec/observability/_config.py +228 -0
- sqlspec/observability/_diagnostics.py +67 -0
- sqlspec/observability/_dispatcher.py +151 -0
- sqlspec/observability/_observer.py +180 -0
- sqlspec/observability/_runtime.py +381 -0
- sqlspec/observability/_spans.py +158 -0
- sqlspec/protocols.py +530 -0
- sqlspec/py.typed +0 -0
- sqlspec/storage/__init__.py +46 -0
- sqlspec/storage/_utils.py +104 -0
- sqlspec/storage/backends/__init__.py +1 -0
- sqlspec/storage/backends/base.py +163 -0
- sqlspec/storage/backends/fsspec.py +398 -0
- sqlspec/storage/backends/local.py +377 -0
- sqlspec/storage/backends/obstore.py +580 -0
- sqlspec/storage/errors.py +104 -0
- sqlspec/storage/pipeline.py +604 -0
- sqlspec/storage/registry.py +289 -0
- sqlspec/typing.py +219 -0
- sqlspec/utils/__init__.py +31 -0
- sqlspec/utils/arrow_helpers.py +95 -0
- sqlspec/utils/config_resolver.py +153 -0
- sqlspec/utils/correlation.py +132 -0
- sqlspec/utils/data_transformation.py +114 -0
- sqlspec/utils/dependencies.py +79 -0
- sqlspec/utils/deprecation.py +113 -0
- sqlspec/utils/fixtures.py +250 -0
- sqlspec/utils/logging.py +172 -0
- sqlspec/utils/module_loader.py +273 -0
- sqlspec/utils/portal.py +325 -0
- sqlspec/utils/schema.py +288 -0
- sqlspec/utils/serializers.py +396 -0
- sqlspec/utils/singleton.py +41 -0
- sqlspec/utils/sync_tools.py +277 -0
- sqlspec/utils/text.py +108 -0
- sqlspec/utils/type_converters.py +99 -0
- sqlspec/utils/type_guards.py +1324 -0
- sqlspec/utils/version.py +444 -0
- sqlspec-0.32.0.dist-info/METADATA +202 -0
- sqlspec-0.32.0.dist-info/RECORD +262 -0
- sqlspec-0.32.0.dist-info/WHEEL +4 -0
- sqlspec-0.32.0.dist-info/entry_points.txt +2 -0
- sqlspec-0.32.0.dist-info/licenses/LICENSE +21 -0
sqlspec/_typing.py
ADDED
|
@@ -0,0 +1,784 @@
|
|
|
1
|
+
# ruff: noqa: RUF100, PLR0913, A002, DOC201, PLR6301, PLR0917, ARG004, ARG002, ARG001
|
|
2
|
+
"""Wrapper around library classes for compatibility when libraries are installed."""
|
|
3
|
+
|
|
4
|
+
import enum
|
|
5
|
+
from collections.abc import Iterable, Mapping
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from enum import Enum
|
|
8
|
+
from typing import Any, ClassVar, Final, Literal, Protocol, TypeAlias, cast, runtime_checkable
|
|
9
|
+
|
|
10
|
+
from typing_extensions import TypeVar, dataclass_transform
|
|
11
|
+
|
|
12
|
+
from sqlspec.utils.dependencies import dependency_flag, module_available
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@runtime_checkable
|
|
16
|
+
class DataclassProtocol(Protocol):
|
|
17
|
+
"""Protocol for instance checking dataclasses."""
|
|
18
|
+
|
|
19
|
+
__dataclass_fields__: "ClassVar[dict[str, Any]]"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
T = TypeVar("T")
|
|
23
|
+
T_co = TypeVar("T_co", covariant=True)
|
|
24
|
+
|
|
25
|
+
# Always define stub types for type checking
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class BaseModelStub:
|
|
29
|
+
"""Placeholder implementation."""
|
|
30
|
+
|
|
31
|
+
model_fields: ClassVar[dict[str, Any]] = {}
|
|
32
|
+
__slots__ = ("__dict__", "__pydantic_extra__", "__pydantic_fields_set__", "__pydantic_private__")
|
|
33
|
+
|
|
34
|
+
def __init__(self, **data: Any) -> None:
|
|
35
|
+
for key, value in data.items():
|
|
36
|
+
setattr(self, key, value)
|
|
37
|
+
|
|
38
|
+
def model_dump( # noqa: PLR0913
|
|
39
|
+
self,
|
|
40
|
+
/,
|
|
41
|
+
*,
|
|
42
|
+
include: "Any | None" = None, # noqa: ARG002
|
|
43
|
+
exclude: "Any | None" = None, # noqa: ARG002
|
|
44
|
+
context: "Any | None" = None, # noqa: ARG002
|
|
45
|
+
by_alias: bool = False, # noqa: ARG002
|
|
46
|
+
exclude_unset: bool = False, # noqa: ARG002
|
|
47
|
+
exclude_defaults: bool = False, # noqa: ARG002
|
|
48
|
+
exclude_none: bool = False, # noqa: ARG002
|
|
49
|
+
round_trip: bool = False, # noqa: ARG002
|
|
50
|
+
warnings: "bool | Literal['none', 'warn', 'error']" = True, # noqa: ARG002
|
|
51
|
+
serialize_as_any: bool = False, # noqa: ARG002
|
|
52
|
+
) -> "dict[str, Any]":
|
|
53
|
+
"""Placeholder implementation."""
|
|
54
|
+
return {k: v for k, v in self.__dict__.items() if not k.startswith("_")}
|
|
55
|
+
|
|
56
|
+
def model_dump_json( # noqa: PLR0913
|
|
57
|
+
self,
|
|
58
|
+
/,
|
|
59
|
+
*,
|
|
60
|
+
include: "Any | None" = None, # noqa: ARG002
|
|
61
|
+
exclude: "Any | None" = None, # noqa: ARG002
|
|
62
|
+
context: "Any | None" = None, # noqa: ARG002
|
|
63
|
+
by_alias: bool = False, # noqa: ARG002
|
|
64
|
+
exclude_unset: bool = False, # noqa: ARG002
|
|
65
|
+
exclude_defaults: bool = False, # noqa: ARG002
|
|
66
|
+
exclude_none: bool = False, # noqa: ARG002
|
|
67
|
+
round_trip: bool = False, # noqa: ARG002
|
|
68
|
+
warnings: "bool | Literal['none', 'warn', 'error']" = True, # noqa: ARG002
|
|
69
|
+
serialize_as_any: bool = False, # noqa: ARG002
|
|
70
|
+
) -> str:
|
|
71
|
+
"""Placeholder implementation."""
|
|
72
|
+
return "{}"
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class TypeAdapterStub:
|
|
76
|
+
"""Placeholder implementation."""
|
|
77
|
+
|
|
78
|
+
def __init__(
|
|
79
|
+
self,
|
|
80
|
+
type: Any, # noqa: A002
|
|
81
|
+
*,
|
|
82
|
+
config: "Any | None" = None, # noqa: ARG002
|
|
83
|
+
_parent_depth: int = 2, # noqa: ARG002
|
|
84
|
+
module: "str | None" = None, # noqa: ARG002
|
|
85
|
+
) -> None:
|
|
86
|
+
"""Initialize."""
|
|
87
|
+
self._type = type
|
|
88
|
+
|
|
89
|
+
def validate_python( # noqa: PLR0913
|
|
90
|
+
self,
|
|
91
|
+
object: Any,
|
|
92
|
+
/,
|
|
93
|
+
*,
|
|
94
|
+
strict: "bool | None" = None, # noqa: ARG002
|
|
95
|
+
from_attributes: "bool | None" = None, # noqa: ARG002
|
|
96
|
+
context: "dict[str, Any] | None" = None, # noqa: ARG002
|
|
97
|
+
experimental_allow_partial: "bool | Literal['off', 'on', 'trailing-strings']" = False, # noqa: ARG002
|
|
98
|
+
) -> Any:
|
|
99
|
+
"""Validate Python object."""
|
|
100
|
+
return object
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@dataclass
|
|
104
|
+
class FailFastStub:
|
|
105
|
+
"""Placeholder implementation for FailFast."""
|
|
106
|
+
|
|
107
|
+
fail_fast: bool = True
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# Try to import real implementations at runtime
|
|
111
|
+
try:
|
|
112
|
+
from pydantic import BaseModel as _RealBaseModel
|
|
113
|
+
from pydantic import FailFast as _RealFailFast
|
|
114
|
+
from pydantic import TypeAdapter as _RealTypeAdapter
|
|
115
|
+
|
|
116
|
+
BaseModel = _RealBaseModel
|
|
117
|
+
TypeAdapter = _RealTypeAdapter
|
|
118
|
+
FailFast = _RealFailFast
|
|
119
|
+
except ImportError:
|
|
120
|
+
BaseModel = BaseModelStub # type: ignore[assignment,misc]
|
|
121
|
+
TypeAdapter = TypeAdapterStub # type: ignore[assignment,misc]
|
|
122
|
+
FailFast = FailFastStub # type: ignore[assignment,misc]
|
|
123
|
+
|
|
124
|
+
# Always define stub types for msgspec
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@dataclass_transform()
|
|
128
|
+
class StructStub:
|
|
129
|
+
"""Placeholder implementation."""
|
|
130
|
+
|
|
131
|
+
__struct_fields__: ClassVar[tuple[str, ...]] = ()
|
|
132
|
+
__slots__ = ()
|
|
133
|
+
|
|
134
|
+
def __init__(self, **kwargs: Any) -> None:
|
|
135
|
+
for key, value in kwargs.items():
|
|
136
|
+
setattr(self, key, value)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def convert_stub( # noqa: PLR0913
|
|
140
|
+
obj: Any, # noqa: ARG001
|
|
141
|
+
type: Any, # noqa: A002,ARG001
|
|
142
|
+
*,
|
|
143
|
+
strict: bool = True, # noqa: ARG001
|
|
144
|
+
from_attributes: bool = False, # noqa: ARG001
|
|
145
|
+
dec_hook: "Any | None" = None, # noqa: ARG001
|
|
146
|
+
builtin_types: "Any | None" = None, # noqa: ARG001
|
|
147
|
+
str_keys: bool = False, # noqa: ARG001
|
|
148
|
+
) -> Any:
|
|
149
|
+
"""Placeholder implementation."""
|
|
150
|
+
return {}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class UnsetTypeStub(enum.Enum):
|
|
154
|
+
UNSET = "UNSET"
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
UNSET_STUB = UnsetTypeStub.UNSET
|
|
158
|
+
|
|
159
|
+
# Try to import real implementations at runtime
|
|
160
|
+
try:
|
|
161
|
+
from msgspec import UNSET as _REAL_UNSET
|
|
162
|
+
from msgspec import Struct as _RealStruct
|
|
163
|
+
from msgspec import UnsetType as _RealUnsetType
|
|
164
|
+
from msgspec import convert as _real_convert
|
|
165
|
+
|
|
166
|
+
Struct = _RealStruct
|
|
167
|
+
UnsetType = _RealUnsetType
|
|
168
|
+
UNSET = _REAL_UNSET
|
|
169
|
+
convert = _real_convert
|
|
170
|
+
except ImportError:
|
|
171
|
+
Struct = StructStub # type: ignore[assignment,misc]
|
|
172
|
+
UnsetType = UnsetTypeStub # type: ignore[assignment,misc]
|
|
173
|
+
UNSET = UNSET_STUB # type: ignore[assignment] # pyright: ignore[reportConstantRedefinition]
|
|
174
|
+
convert = convert_stub
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
try:
|
|
178
|
+
import orjson # noqa: F401
|
|
179
|
+
except ImportError:
|
|
180
|
+
orjson = None # type: ignore[assignment]
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
# Always define stub type for DTOData
|
|
184
|
+
@runtime_checkable
|
|
185
|
+
class DTODataStub(Protocol[T]):
|
|
186
|
+
"""Placeholder implementation."""
|
|
187
|
+
|
|
188
|
+
__slots__ = ("_backend", "_data_as_builtins")
|
|
189
|
+
|
|
190
|
+
def __init__(self, backend: Any, data_as_builtins: Any) -> None:
|
|
191
|
+
"""Initialize."""
|
|
192
|
+
|
|
193
|
+
def create_instance(self, **kwargs: Any) -> T:
|
|
194
|
+
return cast("T", kwargs)
|
|
195
|
+
|
|
196
|
+
def update_instance(self, instance: T, **kwargs: Any) -> T:
|
|
197
|
+
"""Update instance."""
|
|
198
|
+
return cast("T", kwargs)
|
|
199
|
+
|
|
200
|
+
def as_builtins(self) -> Any:
|
|
201
|
+
"""Convert to builtins."""
|
|
202
|
+
return {}
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
# Try to import real implementation at runtime
|
|
206
|
+
try:
|
|
207
|
+
from litestar.dto.data_structures import DTOData as _RealDTOData # pyright: ignore[reportUnknownVariableType]
|
|
208
|
+
|
|
209
|
+
DTOData = _RealDTOData
|
|
210
|
+
except ImportError:
|
|
211
|
+
DTOData = DTODataStub # type: ignore[assignment,misc]
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
# Always define stub types for attrs
|
|
215
|
+
@dataclass_transform()
|
|
216
|
+
class AttrsInstanceStub:
|
|
217
|
+
"""Placeholder Implementation for attrs classes"""
|
|
218
|
+
|
|
219
|
+
__attrs_attrs__: ClassVar[tuple[Any, ...]] = ()
|
|
220
|
+
__slots__ = ()
|
|
221
|
+
|
|
222
|
+
def __init__(self, **kwargs: Any) -> None:
|
|
223
|
+
for key, value in kwargs.items():
|
|
224
|
+
setattr(self, key, value)
|
|
225
|
+
|
|
226
|
+
def __repr__(self) -> str:
|
|
227
|
+
return f"{self.__class__.__name__}()"
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def attrs_asdict_stub(*args: Any, **kwargs: Any) -> "dict[str, Any]": # noqa: ARG001
|
|
231
|
+
"""Placeholder implementation"""
|
|
232
|
+
return {}
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def attrs_define_stub(*args: Any, **kwargs: Any) -> Any: # noqa: ARG001
|
|
236
|
+
"""Placeholder implementation"""
|
|
237
|
+
return lambda cls: cls # pyright: ignore[reportUnknownVariableType,reportUnknownLambdaType]
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def attrs_field_stub(*args: Any, **kwargs: Any) -> Any: # noqa: ARG001
|
|
241
|
+
"""Placeholder implementation"""
|
|
242
|
+
return None
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def attrs_fields_stub(*args: Any, **kwargs: Any) -> "tuple[Any, ...]": # noqa: ARG001
|
|
246
|
+
"""Placeholder implementation"""
|
|
247
|
+
return ()
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def attrs_has_stub(*args: Any, **kwargs: Any) -> bool: # noqa: ARG001
|
|
251
|
+
"""Placeholder implementation"""
|
|
252
|
+
return False
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
# Try to import real implementations at runtime
|
|
256
|
+
try:
|
|
257
|
+
from attrs import AttrsInstance as _RealAttrsInstance # pyright: ignore
|
|
258
|
+
from attrs import asdict as _real_attrs_asdict
|
|
259
|
+
from attrs import define as _real_attrs_define
|
|
260
|
+
from attrs import field as _real_attrs_field
|
|
261
|
+
from attrs import fields as _real_attrs_fields
|
|
262
|
+
from attrs import has as _real_attrs_has
|
|
263
|
+
|
|
264
|
+
AttrsInstance = _RealAttrsInstance
|
|
265
|
+
attrs_asdict = _real_attrs_asdict
|
|
266
|
+
attrs_define = _real_attrs_define
|
|
267
|
+
attrs_field = _real_attrs_field
|
|
268
|
+
attrs_fields = _real_attrs_fields
|
|
269
|
+
attrs_has = _real_attrs_has
|
|
270
|
+
except ImportError:
|
|
271
|
+
AttrsInstance = AttrsInstanceStub # type: ignore[misc]
|
|
272
|
+
attrs_asdict = attrs_asdict_stub
|
|
273
|
+
attrs_define = attrs_define_stub
|
|
274
|
+
attrs_field = attrs_field_stub
|
|
275
|
+
attrs_fields = attrs_fields_stub
|
|
276
|
+
attrs_has = attrs_has_stub # type: ignore[assignment]
|
|
277
|
+
|
|
278
|
+
try:
|
|
279
|
+
from cattrs import structure as cattrs_structure
|
|
280
|
+
from cattrs import unstructure as cattrs_unstructure
|
|
281
|
+
except ImportError:
|
|
282
|
+
|
|
283
|
+
def cattrs_unstructure(*args: Any, **kwargs: Any) -> Any: # noqa: ARG001
|
|
284
|
+
"""Placeholder implementation"""
|
|
285
|
+
return {}
|
|
286
|
+
|
|
287
|
+
def cattrs_structure(*args: Any, **kwargs: Any) -> Any: # noqa: ARG001
|
|
288
|
+
"""Placeholder implementation"""
|
|
289
|
+
return {}
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
class EmptyEnum(Enum):
|
|
293
|
+
"""A sentinel enum used as placeholder."""
|
|
294
|
+
|
|
295
|
+
EMPTY = 0
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
EmptyType = Literal[EmptyEnum.EMPTY] | UnsetType
|
|
299
|
+
Empty: Final = EmptyEnum.EMPTY
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
@runtime_checkable
|
|
303
|
+
class ArrowTableResult(Protocol):
|
|
304
|
+
"""This is a typed shim for pyarrow.Table."""
|
|
305
|
+
|
|
306
|
+
def to_batches(self, batch_size: int) -> Any:
|
|
307
|
+
return None
|
|
308
|
+
|
|
309
|
+
@property
|
|
310
|
+
def num_rows(self) -> int:
|
|
311
|
+
return 0
|
|
312
|
+
|
|
313
|
+
@property
|
|
314
|
+
def num_columns(self) -> int:
|
|
315
|
+
return 0
|
|
316
|
+
|
|
317
|
+
def to_pydict(self) -> dict[str, Any]:
|
|
318
|
+
return {}
|
|
319
|
+
|
|
320
|
+
def to_string(self) -> str:
|
|
321
|
+
return ""
|
|
322
|
+
|
|
323
|
+
def from_arrays(
|
|
324
|
+
self,
|
|
325
|
+
arrays: list[Any],
|
|
326
|
+
names: "list[str] | None" = None,
|
|
327
|
+
schema: "Any | None" = None,
|
|
328
|
+
metadata: "Mapping[str, Any] | None" = None,
|
|
329
|
+
) -> Any:
|
|
330
|
+
return None
|
|
331
|
+
|
|
332
|
+
def from_pydict(
|
|
333
|
+
self, mapping: dict[str, Any], schema: "Any | None" = None, metadata: "Mapping[str, Any] | None" = None
|
|
334
|
+
) -> Any:
|
|
335
|
+
return None
|
|
336
|
+
|
|
337
|
+
def from_batches(self, batches: Iterable[Any], schema: Any | None = None) -> Any:
|
|
338
|
+
return None
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
@runtime_checkable
|
|
342
|
+
class ArrowRecordBatchResult(Protocol):
|
|
343
|
+
"""This is a typed shim for pyarrow.RecordBatch."""
|
|
344
|
+
|
|
345
|
+
def num_rows(self) -> int:
|
|
346
|
+
return 0
|
|
347
|
+
|
|
348
|
+
def num_columns(self) -> int:
|
|
349
|
+
return 0
|
|
350
|
+
|
|
351
|
+
def to_pydict(self) -> dict[str, Any]:
|
|
352
|
+
return {}
|
|
353
|
+
|
|
354
|
+
def to_pandas(self) -> Any:
|
|
355
|
+
return None
|
|
356
|
+
|
|
357
|
+
def schema(self) -> Any:
|
|
358
|
+
return None
|
|
359
|
+
|
|
360
|
+
def column(self, i: int) -> Any:
|
|
361
|
+
return None
|
|
362
|
+
|
|
363
|
+
def slice(self, offset: int = 0, length: "int | None" = None) -> Any:
|
|
364
|
+
return None
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
@runtime_checkable
|
|
368
|
+
class ArrowSchemaProtocol(Protocol):
|
|
369
|
+
"""Typed shim for pyarrow.Schema."""
|
|
370
|
+
|
|
371
|
+
def field(self, i: int) -> Any:
|
|
372
|
+
"""Get field by index."""
|
|
373
|
+
...
|
|
374
|
+
|
|
375
|
+
@property
|
|
376
|
+
def names(self) -> "list[str]":
|
|
377
|
+
"""Get list of field names."""
|
|
378
|
+
...
|
|
379
|
+
|
|
380
|
+
def __len__(self) -> int:
|
|
381
|
+
"""Get number of fields."""
|
|
382
|
+
return 0
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
@runtime_checkable
|
|
386
|
+
class ArrowRecordBatchReaderProtocol(Protocol):
|
|
387
|
+
"""Typed shim for pyarrow.RecordBatchReader."""
|
|
388
|
+
|
|
389
|
+
def read_all(self) -> Any:
|
|
390
|
+
"""Read all batches into a table."""
|
|
391
|
+
...
|
|
392
|
+
|
|
393
|
+
def read_next_batch(self) -> Any:
|
|
394
|
+
"""Read next batch."""
|
|
395
|
+
...
|
|
396
|
+
|
|
397
|
+
def __iter__(self) -> "Iterable[Any]":
|
|
398
|
+
"""Iterate over batches."""
|
|
399
|
+
...
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
try:
|
|
403
|
+
from pyarrow import RecordBatch as ArrowRecordBatch
|
|
404
|
+
from pyarrow import RecordBatchReader as ArrowRecordBatchReader
|
|
405
|
+
from pyarrow import Schema as ArrowSchema
|
|
406
|
+
from pyarrow import Table as ArrowTable
|
|
407
|
+
except ImportError:
|
|
408
|
+
ArrowTable = ArrowTableResult # type: ignore[assignment,misc]
|
|
409
|
+
ArrowRecordBatch = ArrowRecordBatchResult # type: ignore[assignment,misc]
|
|
410
|
+
ArrowSchema = ArrowSchemaProtocol # type: ignore[assignment,misc]
|
|
411
|
+
ArrowRecordBatchReader = ArrowRecordBatchReaderProtocol # type: ignore[assignment,misc]
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
@runtime_checkable
|
|
415
|
+
class PandasDataFrameProtocol(Protocol):
|
|
416
|
+
"""Typed shim for pandas.DataFrame."""
|
|
417
|
+
|
|
418
|
+
def __len__(self) -> int:
|
|
419
|
+
"""Get number of rows."""
|
|
420
|
+
...
|
|
421
|
+
|
|
422
|
+
def __getitem__(self, key: Any) -> Any:
|
|
423
|
+
"""Get column or row."""
|
|
424
|
+
...
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
@runtime_checkable
|
|
428
|
+
class PolarsDataFrameProtocol(Protocol):
|
|
429
|
+
"""Typed shim for polars.DataFrame."""
|
|
430
|
+
|
|
431
|
+
def __len__(self) -> int:
|
|
432
|
+
"""Get number of rows."""
|
|
433
|
+
...
|
|
434
|
+
|
|
435
|
+
def __getitem__(self, key: Any) -> Any:
|
|
436
|
+
"""Get column or row."""
|
|
437
|
+
...
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
try:
|
|
441
|
+
from pandas import DataFrame as PandasDataFrame
|
|
442
|
+
except ImportError:
|
|
443
|
+
PandasDataFrame = PandasDataFrameProtocol # type: ignore[assignment,misc]
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
try:
|
|
447
|
+
from polars import DataFrame as PolarsDataFrame
|
|
448
|
+
|
|
449
|
+
except ImportError:
|
|
450
|
+
PolarsDataFrame = PolarsDataFrameProtocol # type: ignore[assignment,misc]
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
@runtime_checkable
|
|
454
|
+
class NumpyArrayStub(Protocol):
|
|
455
|
+
"""Protocol stub for numpy.ndarray when numpy is not installed.
|
|
456
|
+
|
|
457
|
+
Provides minimal interface for type checking and serialization support.
|
|
458
|
+
"""
|
|
459
|
+
|
|
460
|
+
def tolist(self) -> "list[Any]":
|
|
461
|
+
"""Convert array to Python list."""
|
|
462
|
+
...
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
try:
|
|
466
|
+
from numpy import ndarray as NumpyArray # noqa: N812
|
|
467
|
+
except ImportError:
|
|
468
|
+
NumpyArray = NumpyArrayStub # type: ignore[assignment,misc]
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
try:
|
|
472
|
+
from opentelemetry import trace # pyright: ignore[reportMissingImports, reportAssignmentType]
|
|
473
|
+
from opentelemetry.trace import ( # pyright: ignore[reportMissingImports, reportAssignmentType]
|
|
474
|
+
Span, # pyright: ignore[reportMissingImports, reportAssignmentType]
|
|
475
|
+
Status,
|
|
476
|
+
StatusCode,
|
|
477
|
+
Tracer, # pyright: ignore[reportMissingImports, reportAssignmentType]
|
|
478
|
+
)
|
|
479
|
+
except ImportError:
|
|
480
|
+
# Define shims for when opentelemetry is not installed
|
|
481
|
+
|
|
482
|
+
class Span: # type: ignore[no-redef]
|
|
483
|
+
def set_attribute(self, key: str, value: Any) -> None:
|
|
484
|
+
return None
|
|
485
|
+
|
|
486
|
+
def record_exception(
|
|
487
|
+
self,
|
|
488
|
+
exception: "Exception",
|
|
489
|
+
attributes: "Mapping[str, Any] | None" = None,
|
|
490
|
+
timestamp: "int | None" = None,
|
|
491
|
+
escaped: bool = False,
|
|
492
|
+
) -> None:
|
|
493
|
+
return None
|
|
494
|
+
|
|
495
|
+
def set_status(self, status: Any, description: "str | None" = None) -> None:
|
|
496
|
+
return None
|
|
497
|
+
|
|
498
|
+
def end(self, end_time: "int | None" = None) -> None:
|
|
499
|
+
return None
|
|
500
|
+
|
|
501
|
+
def __enter__(self) -> "Span":
|
|
502
|
+
return self # type: ignore[return-value]
|
|
503
|
+
|
|
504
|
+
def __exit__(self, exc_type: object, exc_val: object, exc_tb: object) -> None:
|
|
505
|
+
return None
|
|
506
|
+
|
|
507
|
+
class Tracer: # type: ignore[no-redef]
|
|
508
|
+
def start_span(
|
|
509
|
+
self,
|
|
510
|
+
name: str,
|
|
511
|
+
context: Any = None,
|
|
512
|
+
kind: Any = None,
|
|
513
|
+
attributes: Any = None,
|
|
514
|
+
links: Any = None,
|
|
515
|
+
start_time: Any = None,
|
|
516
|
+
record_exception: bool = True,
|
|
517
|
+
set_status_on_exception: bool = True,
|
|
518
|
+
) -> Span:
|
|
519
|
+
return Span() # type: ignore[abstract]
|
|
520
|
+
|
|
521
|
+
class _TraceModule:
|
|
522
|
+
def get_tracer(
|
|
523
|
+
self,
|
|
524
|
+
instrumenting_module_name: str,
|
|
525
|
+
instrumenting_library_version: "str | None" = None,
|
|
526
|
+
schema_url: "str | None" = None,
|
|
527
|
+
tracer_provider: Any = None,
|
|
528
|
+
) -> Tracer:
|
|
529
|
+
return Tracer() # type: ignore[abstract] # pragma: no cover
|
|
530
|
+
|
|
531
|
+
def get_tracer_provider(self) -> Any: # pragma: no cover
|
|
532
|
+
return None
|
|
533
|
+
|
|
534
|
+
TracerProvider = type(None) # Shim for TracerProvider if needed elsewhere
|
|
535
|
+
StatusCode = type(None) # Shim for StatusCode
|
|
536
|
+
Status = type(None) # Shim for Status
|
|
537
|
+
|
|
538
|
+
trace = _TraceModule() # type: ignore[assignment]
|
|
539
|
+
StatusCode = trace.StatusCode # type: ignore[misc]
|
|
540
|
+
Status = trace.Status # type: ignore[misc]
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
try:
|
|
544
|
+
from prometheus_client import ( # pyright: ignore[reportMissingImports, reportAssignmentType]
|
|
545
|
+
Counter, # pyright: ignore[reportAssignmentType]
|
|
546
|
+
Gauge, # pyright: ignore[reportAssignmentType]
|
|
547
|
+
Histogram, # pyright: ignore[reportAssignmentType]
|
|
548
|
+
)
|
|
549
|
+
except ImportError:
|
|
550
|
+
# Define shims for when prometheus_client is not installed
|
|
551
|
+
|
|
552
|
+
class _Metric: # Base shim for metrics
|
|
553
|
+
def __init__(
|
|
554
|
+
self,
|
|
555
|
+
name: str,
|
|
556
|
+
documentation: str,
|
|
557
|
+
labelnames: tuple[str, ...] = (),
|
|
558
|
+
namespace: str = "",
|
|
559
|
+
subsystem: str = "",
|
|
560
|
+
unit: str = "",
|
|
561
|
+
registry: Any = None,
|
|
562
|
+
ejemplar_fn: Any = None,
|
|
563
|
+
buckets: Any = None,
|
|
564
|
+
**_: Any,
|
|
565
|
+
) -> None:
|
|
566
|
+
return None
|
|
567
|
+
|
|
568
|
+
def labels(self, *labelvalues: str, **labelkwargs: str) -> "_MetricInstance":
|
|
569
|
+
return _MetricInstance()
|
|
570
|
+
|
|
571
|
+
class _MetricInstance:
|
|
572
|
+
def inc(self, amount: float = 1) -> None:
|
|
573
|
+
return None
|
|
574
|
+
|
|
575
|
+
def dec(self, amount: float = 1) -> None:
|
|
576
|
+
return None
|
|
577
|
+
|
|
578
|
+
def set(self, value: float) -> None:
|
|
579
|
+
return None
|
|
580
|
+
|
|
581
|
+
def observe(self, amount: float) -> None:
|
|
582
|
+
return None
|
|
583
|
+
|
|
584
|
+
class Counter(_Metric): # type: ignore[no-redef]
|
|
585
|
+
def labels(self, *labelvalues: str, **labelkwargs: str) -> _MetricInstance:
|
|
586
|
+
return _MetricInstance() # pragma: no cover
|
|
587
|
+
|
|
588
|
+
class Gauge(_Metric): # type: ignore[no-redef]
|
|
589
|
+
def labels(self, *labelvalues: str, **labelkwargs: str) -> _MetricInstance:
|
|
590
|
+
return _MetricInstance() # pragma: no cover
|
|
591
|
+
|
|
592
|
+
class Histogram(_Metric): # type: ignore[no-redef]
|
|
593
|
+
def labels(self, *labelvalues: str, **labelkwargs: str) -> _MetricInstance:
|
|
594
|
+
return _MetricInstance() # pragma: no cover
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
try:
|
|
598
|
+
import aiosql # pyright: ignore[reportMissingImports, reportAssignmentType]
|
|
599
|
+
from aiosql.types import ( # pyright: ignore[reportMissingImports, reportAssignmentType]
|
|
600
|
+
AsyncDriverAdapterProtocol as AiosqlAsyncProtocol, # pyright: ignore[reportMissingImports, reportAssignmentType]
|
|
601
|
+
)
|
|
602
|
+
from aiosql.types import (
|
|
603
|
+
ParamType as AiosqlParamType, # pyright: ignore[reportMissingImports, reportAssignmentType, reportRedeclaration]
|
|
604
|
+
)
|
|
605
|
+
from aiosql.types import (
|
|
606
|
+
SQLOperationType as AiosqlSQLOperationType, # pyright: ignore[reportMissingImports, reportAssignmentType]
|
|
607
|
+
)
|
|
608
|
+
from aiosql.types import ( # pyright: ignore[reportMissingImports, reportAssignmentType]
|
|
609
|
+
SyncDriverAdapterProtocol as AiosqlSyncProtocol, # pyright: ignore[reportMissingImports, reportAssignmentType]
|
|
610
|
+
)
|
|
611
|
+
except ImportError:
|
|
612
|
+
# Define shims for when aiosql is not installed
|
|
613
|
+
|
|
614
|
+
class _AiosqlShim:
|
|
615
|
+
"""Placeholder aiosql module"""
|
|
616
|
+
|
|
617
|
+
@staticmethod
|
|
618
|
+
def from_path(sql_path: str, driver_adapter: Any, **kwargs: Any) -> Any:
|
|
619
|
+
"""Placeholder from_path method"""
|
|
620
|
+
return None # pragma: no cover
|
|
621
|
+
|
|
622
|
+
@staticmethod
|
|
623
|
+
def from_str(sql_str: str, driver_adapter: Any, **kwargs: Any) -> Any:
|
|
624
|
+
"""Placeholder from_str method"""
|
|
625
|
+
return None # pragma: no cover
|
|
626
|
+
|
|
627
|
+
aiosql = _AiosqlShim() # type: ignore[assignment]
|
|
628
|
+
|
|
629
|
+
# Placeholder types for aiosql protocols
|
|
630
|
+
AiosqlParamType: TypeAlias = dict[str, Any] | list[Any] | None # type: ignore[misc,no-redef]
|
|
631
|
+
|
|
632
|
+
class AiosqlSQLOperationType(Enum): # type: ignore[no-redef]
|
|
633
|
+
"""Enumeration of aiosql operation types."""
|
|
634
|
+
|
|
635
|
+
INSERT_RETURNING = 0
|
|
636
|
+
INSERT_UPDATE_DELETE = 1
|
|
637
|
+
INSERT_UPDATE_DELETE_MANY = 2
|
|
638
|
+
SCRIPT = 3
|
|
639
|
+
SELECT = 4
|
|
640
|
+
SELECT_ONE = 5
|
|
641
|
+
SELECT_VALUE = 6
|
|
642
|
+
|
|
643
|
+
@runtime_checkable
|
|
644
|
+
class AiosqlSyncProtocol(Protocol): # type: ignore[no-redef]
|
|
645
|
+
"""Placeholder for aiosql SyncDriverAdapterProtocol"""
|
|
646
|
+
|
|
647
|
+
is_aio_driver: "ClassVar[bool]"
|
|
648
|
+
|
|
649
|
+
def process_sql(self, query_name: str, op_type: Any, sql: str) -> str: ...
|
|
650
|
+
def select(
|
|
651
|
+
self, conn: Any, query_name: str, sql: str, parameters: Any, record_class: "Any | None" = None
|
|
652
|
+
) -> Any: ...
|
|
653
|
+
def select_one(
|
|
654
|
+
self, conn: Any, query_name: str, sql: str, parameters: Any, record_class: "Any | None" = None
|
|
655
|
+
) -> "Any | None": ...
|
|
656
|
+
def select_value(self, conn: Any, query_name: str, sql: str, parameters: Any) -> "Any | None": ...
|
|
657
|
+
def select_cursor(self, conn: Any, query_name: str, sql: str, parameters: Any) -> Any: ...
|
|
658
|
+
def insert_update_delete(self, conn: Any, query_name: str, sql: str, parameters: Any) -> int: ...
|
|
659
|
+
def insert_update_delete_many(self, conn: Any, query_name: str, sql: str, parameters: Any) -> int: ...
|
|
660
|
+
def insert_returning(self, conn: Any, query_name: str, sql: str, parameters: Any) -> "Any | None": ...
|
|
661
|
+
|
|
662
|
+
@runtime_checkable
|
|
663
|
+
class AiosqlAsyncProtocol(Protocol): # type: ignore[no-redef]
|
|
664
|
+
"""Placeholder for aiosql AsyncDriverAdapterProtocol"""
|
|
665
|
+
|
|
666
|
+
is_aio_driver: "ClassVar[bool]"
|
|
667
|
+
|
|
668
|
+
def process_sql(self, query_name: str, op_type: Any, sql: str) -> str: ...
|
|
669
|
+
async def select(
|
|
670
|
+
self, conn: Any, query_name: str, sql: str, parameters: Any, record_class: "Any | None" = None
|
|
671
|
+
) -> Any: ...
|
|
672
|
+
async def select_one(
|
|
673
|
+
self, conn: Any, query_name: str, sql: str, parameters: Any, record_class: "Any | None" = None
|
|
674
|
+
) -> "Any | None": ...
|
|
675
|
+
async def select_value(self, conn: Any, query_name: str, sql: str, parameters: Any) -> "Any | None": ...
|
|
676
|
+
async def select_cursor(self, conn: Any, query_name: str, sql: str, parameters: Any) -> Any: ...
|
|
677
|
+
async def insert_update_delete(self, conn: Any, query_name: str, sql: str, parameters: Any) -> None: ...
|
|
678
|
+
async def insert_update_delete_many(self, conn: Any, query_name: str, sql: str, parameters: Any) -> None: ...
|
|
679
|
+
async def insert_returning(self, conn: Any, query_name: str, sql: str, parameters: Any) -> "Any | None": ...
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
AIOSQL_INSTALLED = dependency_flag("aiosql")
|
|
683
|
+
ATTRS_INSTALLED = dependency_flag("attrs")
|
|
684
|
+
CATTRS_INSTALLED = dependency_flag("cattrs")
|
|
685
|
+
CLOUD_SQL_CONNECTOR_INSTALLED = dependency_flag("google.cloud.sql.connector")
|
|
686
|
+
FSSPEC_INSTALLED = dependency_flag("fsspec")
|
|
687
|
+
LITESTAR_INSTALLED = dependency_flag("litestar")
|
|
688
|
+
MSGSPEC_INSTALLED = dependency_flag("msgspec")
|
|
689
|
+
NUMPY_INSTALLED = dependency_flag("numpy")
|
|
690
|
+
OBSTORE_INSTALLED = dependency_flag("obstore")
|
|
691
|
+
OPENTELEMETRY_INSTALLED = dependency_flag("opentelemetry")
|
|
692
|
+
ORJSON_INSTALLED = dependency_flag("orjson")
|
|
693
|
+
PANDAS_INSTALLED = dependency_flag("pandas")
|
|
694
|
+
PGVECTOR_INSTALLED = dependency_flag("pgvector")
|
|
695
|
+
POLARS_INSTALLED = dependency_flag("polars")
|
|
696
|
+
PROMETHEUS_INSTALLED = dependency_flag("prometheus_client")
|
|
697
|
+
PYARROW_INSTALLED = dependency_flag("pyarrow")
|
|
698
|
+
PYDANTIC_INSTALLED = dependency_flag("pydantic")
|
|
699
|
+
ALLOYDB_CONNECTOR_INSTALLED = dependency_flag("google.cloud.alloydb.connector")
|
|
700
|
+
|
|
701
|
+
__all__ = (
|
|
702
|
+
"AIOSQL_INSTALLED",
|
|
703
|
+
"ALLOYDB_CONNECTOR_INSTALLED",
|
|
704
|
+
"ATTRS_INSTALLED",
|
|
705
|
+
"CATTRS_INSTALLED",
|
|
706
|
+
"CLOUD_SQL_CONNECTOR_INSTALLED",
|
|
707
|
+
"FSSPEC_INSTALLED",
|
|
708
|
+
"LITESTAR_INSTALLED",
|
|
709
|
+
"MSGSPEC_INSTALLED",
|
|
710
|
+
"NUMPY_INSTALLED",
|
|
711
|
+
"OBSTORE_INSTALLED",
|
|
712
|
+
"OPENTELEMETRY_INSTALLED",
|
|
713
|
+
"ORJSON_INSTALLED",
|
|
714
|
+
"PANDAS_INSTALLED",
|
|
715
|
+
"PGVECTOR_INSTALLED",
|
|
716
|
+
"POLARS_INSTALLED",
|
|
717
|
+
"PROMETHEUS_INSTALLED",
|
|
718
|
+
"PYARROW_INSTALLED",
|
|
719
|
+
"PYDANTIC_INSTALLED",
|
|
720
|
+
"UNSET",
|
|
721
|
+
"UNSET_STUB",
|
|
722
|
+
"AiosqlAsyncProtocol",
|
|
723
|
+
"AiosqlParamType",
|
|
724
|
+
"AiosqlSQLOperationType",
|
|
725
|
+
"AiosqlSyncProtocol",
|
|
726
|
+
"ArrowRecordBatch",
|
|
727
|
+
"ArrowRecordBatchReader",
|
|
728
|
+
"ArrowRecordBatchReaderProtocol",
|
|
729
|
+
"ArrowRecordBatchResult",
|
|
730
|
+
"ArrowSchema",
|
|
731
|
+
"ArrowSchemaProtocol",
|
|
732
|
+
"ArrowTable",
|
|
733
|
+
"ArrowTableResult",
|
|
734
|
+
"AttrsInstance",
|
|
735
|
+
"AttrsInstanceStub",
|
|
736
|
+
"BaseModel",
|
|
737
|
+
"BaseModelStub",
|
|
738
|
+
"Counter",
|
|
739
|
+
"DTOData",
|
|
740
|
+
"DTODataStub",
|
|
741
|
+
"DataclassProtocol",
|
|
742
|
+
"Empty",
|
|
743
|
+
"EmptyEnum",
|
|
744
|
+
"EmptyType",
|
|
745
|
+
"FailFast",
|
|
746
|
+
"FailFastStub",
|
|
747
|
+
"Gauge",
|
|
748
|
+
"Histogram",
|
|
749
|
+
"NumpyArray",
|
|
750
|
+
"NumpyArrayStub",
|
|
751
|
+
"PandasDataFrame",
|
|
752
|
+
"PandasDataFrameProtocol",
|
|
753
|
+
"PolarsDataFrame",
|
|
754
|
+
"PolarsDataFrameProtocol",
|
|
755
|
+
"Span",
|
|
756
|
+
"Status",
|
|
757
|
+
"StatusCode",
|
|
758
|
+
"Struct",
|
|
759
|
+
"StructStub",
|
|
760
|
+
"T",
|
|
761
|
+
"T_co",
|
|
762
|
+
"Tracer",
|
|
763
|
+
"TypeAdapter",
|
|
764
|
+
"TypeAdapterStub",
|
|
765
|
+
"UnsetType",
|
|
766
|
+
"UnsetTypeStub",
|
|
767
|
+
"aiosql",
|
|
768
|
+
"attrs_asdict",
|
|
769
|
+
"attrs_asdict_stub",
|
|
770
|
+
"attrs_define",
|
|
771
|
+
"attrs_define_stub",
|
|
772
|
+
"attrs_field",
|
|
773
|
+
"attrs_field_stub",
|
|
774
|
+
"attrs_fields",
|
|
775
|
+
"attrs_fields_stub",
|
|
776
|
+
"attrs_has",
|
|
777
|
+
"attrs_has_stub",
|
|
778
|
+
"cattrs_structure",
|
|
779
|
+
"cattrs_unstructure",
|
|
780
|
+
"convert",
|
|
781
|
+
"convert_stub",
|
|
782
|
+
"module_available",
|
|
783
|
+
"trace",
|
|
784
|
+
)
|