vgi-python 0.31.2__py3-none-any.whl → 0.31.3__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.
- vgi/client/catalog_mixin.py +64 -9
- vgi/client/client.py +335 -20
- vgi/serve.py +155 -2
- vgi/table_filter_pushdown.py +20 -2
- vgi/table_in_out_function.py +12 -1
- vgi/worker.py +192 -10
- {vgi_python-0.31.2.dist-info → vgi_python-0.31.3.dist-info}/METADATA +4 -2
- {vgi_python-0.31.2.dist-info → vgi_python-0.31.3.dist-info}/RECORD +11 -11
- {vgi_python-0.31.2.dist-info → vgi_python-0.31.3.dist-info}/WHEEL +0 -0
- {vgi_python-0.31.2.dist-info → vgi_python-0.31.3.dist-info}/entry_points.txt +0 -0
- {vgi_python-0.31.2.dist-info → vgi_python-0.31.3.dist-info}/licenses/LICENSE +0 -0
vgi/client/catalog_mixin.py
CHANGED
|
@@ -56,6 +56,7 @@ from vgi.catalog import (
|
|
|
56
56
|
ColumnStatistics,
|
|
57
57
|
CopyFromFormatInfo,
|
|
58
58
|
FunctionInfo,
|
|
59
|
+
IndexInfo,
|
|
59
60
|
MacroInfo,
|
|
60
61
|
MacroType,
|
|
61
62
|
OnConflict,
|
|
@@ -113,15 +114,19 @@ class CatalogClientMixin:
|
|
|
113
114
|
|
|
114
115
|
# Type hints for attributes expected from Client
|
|
115
116
|
server_path: str | Sequence[str]
|
|
116
|
-
_transport: Literal["subprocess", "http", "tcp", "launch"]
|
|
117
|
+
_transport: Literal["subprocess", "http", "tcp", "iroh", "httpi", "launch"]
|
|
118
|
+
_iroh_endpoint: str | None
|
|
119
|
+
_iroh_options: dict[str, Any]
|
|
117
120
|
_base_url: str | None
|
|
118
121
|
_tcp_host: str | None
|
|
119
122
|
_tcp_port: int | None
|
|
123
|
+
_tcp_proxy: str | None
|
|
120
124
|
_launch_argv: tuple[str, ...] | None
|
|
121
125
|
_launch_idle_timeout: float
|
|
122
126
|
_launch_state_dir: str | None
|
|
123
127
|
_launch_socket_path: str | None
|
|
124
128
|
_external_location: Any | None
|
|
129
|
+
_accepted_max_response_bytes: int | None
|
|
125
130
|
|
|
126
131
|
def _worker_argv(self) -> list[str]:
|
|
127
132
|
"""The worker command as an argv list, however ``server_path`` was given.
|
|
@@ -162,26 +167,53 @@ class CatalogClientMixin:
|
|
|
162
167
|
"""
|
|
163
168
|
try:
|
|
164
169
|
transport = getattr(self, "_transport", "subprocess")
|
|
165
|
-
if transport
|
|
170
|
+
if transport in ("http", "httpi"):
|
|
166
171
|
from vgi_rpc.http import http_connect
|
|
167
172
|
|
|
168
173
|
httpx_client = self._get_or_create_httpx_client()
|
|
169
|
-
|
|
174
|
+
if transport == "httpi":
|
|
175
|
+
connection = http_connect(
|
|
176
|
+
VgiProtocol, # type: ignore[type-abstract]
|
|
177
|
+
base_url=self._base_url,
|
|
178
|
+
client=httpx_client,
|
|
179
|
+
prefix=getattr(self, "_http_prefix", ""),
|
|
180
|
+
external_location=getattr(self, "_external_location", None),
|
|
181
|
+
accepted_max_response_bytes=self._accepted_max_response_bytes,
|
|
182
|
+
)
|
|
183
|
+
else:
|
|
184
|
+
connection = http_connect(
|
|
185
|
+
VgiProtocol, # type: ignore[type-abstract]
|
|
186
|
+
base_url=self._base_url,
|
|
187
|
+
client=httpx_client,
|
|
188
|
+
external_location=getattr(self, "_external_location", None),
|
|
189
|
+
accepted_max_response_bytes=self._accepted_max_response_bytes,
|
|
190
|
+
)
|
|
191
|
+
with connection as proxy:
|
|
192
|
+
yield proxy
|
|
193
|
+
elif transport == "iroh":
|
|
194
|
+
from vgi_rpc.iroh import iroh_connect
|
|
195
|
+
|
|
196
|
+
assert self._iroh_endpoint is not None
|
|
197
|
+
with iroh_connect(
|
|
170
198
|
VgiProtocol, # type: ignore[type-abstract]
|
|
171
|
-
|
|
172
|
-
client=httpx_client,
|
|
199
|
+
self._iroh_endpoint,
|
|
173
200
|
external_location=getattr(self, "_external_location", None),
|
|
201
|
+
**self._iroh_options,
|
|
174
202
|
) as proxy:
|
|
175
203
|
yield proxy
|
|
176
204
|
elif transport == "tcp":
|
|
177
205
|
from vgi_rpc.rpc import tcp_connect
|
|
178
206
|
|
|
179
207
|
assert self._tcp_host is not None and self._tcp_port is not None
|
|
208
|
+
proxy_options: dict[str, Any] = {}
|
|
209
|
+
if self._tcp_proxy is not None:
|
|
210
|
+
proxy_options["proxy"] = self._tcp_proxy
|
|
180
211
|
with tcp_connect(
|
|
181
212
|
VgiProtocol, # type: ignore[type-abstract]
|
|
182
213
|
self._tcp_host,
|
|
183
214
|
self._tcp_port,
|
|
184
215
|
external_location=getattr(self, "_external_location", None),
|
|
216
|
+
**proxy_options,
|
|
185
217
|
) as proxy:
|
|
186
218
|
yield proxy
|
|
187
219
|
elif transport == "launch":
|
|
@@ -523,6 +555,16 @@ class CatalogClientMixin:
|
|
|
523
555
|
type: Literal[SchemaObjectType.SCALAR_MACRO, SchemaObjectType.TABLE_MACRO],
|
|
524
556
|
) -> Sequence[MacroInfo]: ...
|
|
525
557
|
|
|
558
|
+
@overload
|
|
559
|
+
def schema_contents(
|
|
560
|
+
self,
|
|
561
|
+
*,
|
|
562
|
+
attach_opaque_data: AttachOpaqueData,
|
|
563
|
+
transaction_opaque_data: TransactionOpaqueData | None = None,
|
|
564
|
+
name: str,
|
|
565
|
+
type: Literal[SchemaObjectType.INDEX],
|
|
566
|
+
) -> Sequence[IndexInfo]: ...
|
|
567
|
+
|
|
526
568
|
@overload
|
|
527
569
|
def schema_contents(
|
|
528
570
|
self,
|
|
@@ -531,7 +573,7 @@ class CatalogClientMixin:
|
|
|
531
573
|
transaction_opaque_data: TransactionOpaqueData | None = None,
|
|
532
574
|
name: str,
|
|
533
575
|
type: SchemaObjectType,
|
|
534
|
-
) -> Sequence[TableInfo | ViewInfo | FunctionInfo | MacroInfo]: ...
|
|
576
|
+
) -> Sequence[TableInfo | ViewInfo | FunctionInfo | MacroInfo | IndexInfo]: ...
|
|
535
577
|
|
|
536
578
|
def schema_contents(
|
|
537
579
|
self,
|
|
@@ -540,8 +582,8 @@ class CatalogClientMixin:
|
|
|
540
582
|
transaction_opaque_data: TransactionOpaqueData | None = None,
|
|
541
583
|
name: str,
|
|
542
584
|
type: SchemaObjectType,
|
|
543
|
-
) -> Sequence[TableInfo | ViewInfo | FunctionInfo | MacroInfo]:
|
|
544
|
-
"""List contents of a schema (tables, views, functions, macros).
|
|
585
|
+
) -> Sequence[TableInfo | ViewInfo | FunctionInfo | MacroInfo | IndexInfo]:
|
|
586
|
+
"""List contents of a schema (tables, views, functions, macros, indexes).
|
|
545
587
|
|
|
546
588
|
Args:
|
|
547
589
|
attach_opaque_data: The attachment ID from catalog_attach.
|
|
@@ -554,9 +596,11 @@ class CatalogClientMixin:
|
|
|
554
596
|
- `SchemaObjectType.TABLE_FUNCTION`: Return only table functions
|
|
555
597
|
- `SchemaObjectType.SCALAR_MACRO`: Return only scalar macros
|
|
556
598
|
- `SchemaObjectType.TABLE_MACRO`: Return only table macros
|
|
599
|
+
- `SchemaObjectType.INDEX`: Return only indexes
|
|
557
600
|
|
|
558
601
|
Returns:
|
|
559
|
-
List of [`TableInfo`][], [`ViewInfo`][], [`FunctionInfo`][],
|
|
602
|
+
List of [`TableInfo`][], [`ViewInfo`][], [`FunctionInfo`][], [`MacroInfo`][],
|
|
603
|
+
or [`IndexInfo`][] depending on the type.
|
|
560
604
|
|
|
561
605
|
"""
|
|
562
606
|
with self._catalog_connect() as proxy:
|
|
@@ -579,6 +623,17 @@ class CatalogClientMixin:
|
|
|
579
623
|
type=type,
|
|
580
624
|
transaction_opaque_data=transaction_opaque_data,
|
|
581
625
|
).to_infos()
|
|
626
|
+
elif type == SchemaObjectType.INDEX:
|
|
627
|
+
# Its own RPC, not a variant of catalog_schema_contents_functions
|
|
628
|
+
# (the `else` branch below) -- an index has no FunctionInfo-shaped
|
|
629
|
+
# representation at all. Before this branch existed, `type=INDEX`
|
|
630
|
+
# silently fell through to the functions RPC and returned
|
|
631
|
+
# nonsense (or an empty list) instead of raising or working.
|
|
632
|
+
return proxy.catalog_schema_contents_indexes(
|
|
633
|
+
attach_opaque_data=attach_opaque_data,
|
|
634
|
+
name=name,
|
|
635
|
+
transaction_opaque_data=transaction_opaque_data,
|
|
636
|
+
).to_infos()
|
|
582
637
|
else:
|
|
583
638
|
return proxy.catalog_schema_contents_functions(
|
|
584
639
|
attach_opaque_data=attach_opaque_data,
|