corvic-engine 0.3.0rc76__cp38-abi3-win_amd64.whl → 0.3.0rc78__cp38-abi3-win_amd64.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.
- corvic/engine/_native.pyd +0 -0
- corvic/eorm/__init__.py +404 -0
- corvic/model/_base_model.py +44 -40
- corvic/model/_completion_model.py +9 -9
- corvic/model/_defaults.py +5 -5
- corvic/model/_feature_view.py +17 -17
- corvic/model/_pipeline.py +12 -12
- corvic/model/_proto_orm_convert.py +102 -100
- corvic/model/_resource.py +24 -24
- corvic/model/_room.py +10 -14
- corvic/model/_source.py +18 -18
- corvic/model/_space.py +21 -21
- corvic/op_graph/_schema.py +3 -3
- corvic/op_graph/feature_types.py +4 -4
- corvic/op_graph/ops.py +2 -2
- corvic/orm/__init__.py +202 -307
- corvic/orm/_soft_delete.py +218 -0
- corvic/orm/ids.py +0 -69
- corvic/system/_embedder.py +2 -2
- corvic/system/op_graph_executor.py +2 -2
- corvic/system/storage.py +10 -8
- corvic/system_sqlite/client.py +10 -10
- corvic/table/table.py +3 -3
- {corvic_engine-0.3.0rc76.dist-info → corvic_engine-0.3.0rc78.dist-info}/METADATA +1 -1
- {corvic_engine-0.3.0rc76.dist-info → corvic_engine-0.3.0rc78.dist-info}/RECORD +27 -27
- corvic/orm/base.py +0 -256
- corvic/orm/mixins.py +0 -480
- {corvic_engine-0.3.0rc76.dist-info → corvic_engine-0.3.0rc78.dist-info}/WHEEL +0 -0
- {corvic_engine-0.3.0rc76.dist-info → corvic_engine-0.3.0rc78.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,218 @@
|
|
1
|
+
"""Mixin models for corvic orm tables."""
|
2
|
+
|
3
|
+
from datetime import UTC, datetime
|
4
|
+
from typing import Any, LiteralString
|
5
|
+
|
6
|
+
import sqlalchemy as sa
|
7
|
+
from sqlalchemy import event, exc
|
8
|
+
from sqlalchemy import orm as sa_orm
|
9
|
+
from sqlalchemy.ext import hybrid
|
10
|
+
from sqlalchemy.ext.hybrid import hybrid_property
|
11
|
+
|
12
|
+
from corvic.orm.errors import (
|
13
|
+
DeletedObjectError,
|
14
|
+
)
|
15
|
+
|
16
|
+
|
17
|
+
class BadDeleteError(DeletedObjectError):
|
18
|
+
"""Raised when deleting deleted objects."""
|
19
|
+
|
20
|
+
def __init__(self):
|
21
|
+
super().__init__(message="deleting an object that is already deleted")
|
22
|
+
|
23
|
+
|
24
|
+
def _filter_deleted_objects_when_orm_loading(
|
25
|
+
execute_state: sa_orm.session.ORMExecuteState,
|
26
|
+
):
|
27
|
+
# check if the orm operation was submitted with an option to force load despite
|
28
|
+
# soft-load status and if so just skip this event
|
29
|
+
if any(
|
30
|
+
isinstance(opt, SoftDeleteMixin.ForceLoadOption)
|
31
|
+
for opt in execute_state.user_defined_options
|
32
|
+
) or any(
|
33
|
+
isinstance(opt, SoftDeleteMixin.ForceLoadOption)
|
34
|
+
for opt in execute_state.local_execution_options.values()
|
35
|
+
):
|
36
|
+
return
|
37
|
+
|
38
|
+
def where_criteria(cls: type[SoftDeleteMixin]) -> sa.ColumnElement[bool]:
|
39
|
+
return ~cls.is_deleted
|
40
|
+
|
41
|
+
execute_state.statement = execute_state.statement.options(
|
42
|
+
sa_orm.with_loader_criteria(
|
43
|
+
entity_or_base=SoftDeleteMixin,
|
44
|
+
# suppressing pyright is unfortunately required as there seems to be a
|
45
|
+
# problem with sqlalchemy.orm.util::LoaderCriteriaOption which will
|
46
|
+
# construct a 'DeferredLambdaElement' when `where_criteria` is callable.
|
47
|
+
# However, the type annotations are not consistent with the implementation.
|
48
|
+
# The implementation, on callables criteria, passes to the lambda the
|
49
|
+
# mapping class for using in constructing the `ColumnElement[bool]` result
|
50
|
+
# needed. For this reason we ignore the argument type.
|
51
|
+
where_criteria=where_criteria,
|
52
|
+
include_aliases=True,
|
53
|
+
)
|
54
|
+
)
|
55
|
+
|
56
|
+
|
57
|
+
class SoftDeleteMixin(sa_orm.MappedAsDataclass):
|
58
|
+
"""Mixin to make corvic orm models use soft-delete.
|
59
|
+
|
60
|
+
Modifications to objects which are marked as deleted will result in
|
61
|
+
an error.
|
62
|
+
"""
|
63
|
+
|
64
|
+
class ForceLoadOption(sa_orm.UserDefinedOption):
|
65
|
+
"""Option for ignoring soft delete status when loading."""
|
66
|
+
|
67
|
+
_deleted_at: sa_orm.Mapped[datetime | None] = sa_orm.mapped_column(
|
68
|
+
"deleted_at",
|
69
|
+
sa.DateTime(timezone=True),
|
70
|
+
server_default=None,
|
71
|
+
default=None,
|
72
|
+
)
|
73
|
+
is_live: sa_orm.Mapped[bool | None] = sa_orm.mapped_column(
|
74
|
+
init=False,
|
75
|
+
default=True,
|
76
|
+
)
|
77
|
+
|
78
|
+
@hybrid.hybrid_property
|
79
|
+
def deleted_at(self) -> datetime | None:
|
80
|
+
if not self._deleted_at:
|
81
|
+
return None
|
82
|
+
return self._deleted_at.replace(tzinfo=UTC)
|
83
|
+
|
84
|
+
def reset_delete(self):
|
85
|
+
self._deleted_at = None
|
86
|
+
|
87
|
+
@classmethod
|
88
|
+
def _force_load_option(cls):
|
89
|
+
return cls.ForceLoadOption()
|
90
|
+
|
91
|
+
@classmethod
|
92
|
+
def force_load_options(cls):
|
93
|
+
"""Options to force load soft-deleted objects when using session.get."""
|
94
|
+
return [cls._force_load_option()]
|
95
|
+
|
96
|
+
@classmethod
|
97
|
+
def force_load_execution_options(cls):
|
98
|
+
"""Options to force load soft-deleted objects when using session.execute.
|
99
|
+
|
100
|
+
Also works with session.scalars.
|
101
|
+
"""
|
102
|
+
return {"ignored_option_name": cls._force_load_option()}
|
103
|
+
|
104
|
+
def mark_deleted(self):
|
105
|
+
"""Updates soft-delete object.
|
106
|
+
|
107
|
+
Note: users should not use this directly and instead should use
|
108
|
+
`session.delete(obj)`.
|
109
|
+
"""
|
110
|
+
if self.is_deleted:
|
111
|
+
raise BadDeleteError()
|
112
|
+
# set is_live to None instead of False so that orm objects can use it to
|
113
|
+
# build uniqueness constraints that are only enforced on non-deleted objects
|
114
|
+
self.is_live = None
|
115
|
+
self._deleted_at = datetime.now(tz=UTC)
|
116
|
+
|
117
|
+
@hybrid_property
|
118
|
+
def is_deleted(self) -> bool:
|
119
|
+
"""Useful when constructing queries for direct use (e.g via `session.execute`).
|
120
|
+
|
121
|
+
ORM users can rely on the typical session interfaces for checking object
|
122
|
+
persistence.
|
123
|
+
"""
|
124
|
+
return not self.is_live
|
125
|
+
|
126
|
+
@is_deleted.inplace.expression
|
127
|
+
@classmethod
|
128
|
+
def _is_deleted_expression(cls):
|
129
|
+
return cls.is_live.is_not(True)
|
130
|
+
|
131
|
+
@staticmethod
|
132
|
+
def register_session_event_listeners(session: type[sa_orm.Session]):
|
133
|
+
event.listen(
|
134
|
+
session, "do_orm_execute", _filter_deleted_objects_when_orm_loading
|
135
|
+
)
|
136
|
+
|
137
|
+
|
138
|
+
def live_unique_constraint(
|
139
|
+
column_name: LiteralString, *other_column_names: LiteralString
|
140
|
+
) -> sa.UniqueConstraint:
|
141
|
+
"""Construct a unique constraint that only applies to live objects.
|
142
|
+
|
143
|
+
Live objects are those that support soft deletion and have not been soft deleted.
|
144
|
+
"""
|
145
|
+
return sa.UniqueConstraint(column_name, *other_column_names, "is_live")
|
146
|
+
|
147
|
+
|
148
|
+
class Session(sa_orm.Session):
|
149
|
+
"""Wrapper around sqlalchemy.orm.Session."""
|
150
|
+
|
151
|
+
_soft_deleted: dict[sa_orm.InstanceState[Any], Any] | None = None
|
152
|
+
|
153
|
+
def _track_soft_deleted(self, instance: object):
|
154
|
+
if self._soft_deleted is None:
|
155
|
+
self._soft_deleted = {}
|
156
|
+
self._soft_deleted[sa_orm.attributes.instance_state(instance)] = instance
|
157
|
+
|
158
|
+
def _reset_soft_deleted(self):
|
159
|
+
self._soft_deleted = {}
|
160
|
+
|
161
|
+
def _ensure_persistence(self, instance: object):
|
162
|
+
instance_state = sa_orm.attributes.instance_state(instance)
|
163
|
+
if instance_state.key is None:
|
164
|
+
raise exc.InvalidRequestError("Instance is not persisted")
|
165
|
+
|
166
|
+
def _delete_soft_deleted(self, instance: SoftDeleteMixin):
|
167
|
+
self._ensure_persistence(instance)
|
168
|
+
|
169
|
+
instance.mark_deleted()
|
170
|
+
|
171
|
+
# Soft deleted should be tracked so that way a deleted soft-delete instance is
|
172
|
+
# correctly identified as being "deleted"
|
173
|
+
self._track_soft_deleted(instance)
|
174
|
+
|
175
|
+
# Flushing the objects being deleted is needed to ensure the 'soft-delete'
|
176
|
+
# impact is spread. This is because sqlalchemy flush implementation is doing
|
177
|
+
# the heavy lifting of updating deleted/modified state across dependencies
|
178
|
+
# after flushing. Ensuring this is done necessary to ensure relationships with
|
179
|
+
# cascades have valid state after a soft-delete. Otherwise divergence between
|
180
|
+
# hard-delete and soft-delete will be seen here (and surprise the user).
|
181
|
+
# Note: the cost is reduced by limiting the flush to the soft-delete instance.
|
182
|
+
self.flush([instance])
|
183
|
+
|
184
|
+
# Invalidate existing session references for expected get-after-delete behavior.
|
185
|
+
if sa_orm.attributes.instance_state(instance).session_id is self.hash_key:
|
186
|
+
self.expunge(instance)
|
187
|
+
|
188
|
+
def commit(self):
|
189
|
+
super().commit()
|
190
|
+
if self._soft_deleted:
|
191
|
+
self._reset_soft_deleted()
|
192
|
+
|
193
|
+
def rollback(self):
|
194
|
+
super().rollback()
|
195
|
+
if self._soft_deleted:
|
196
|
+
for obj in self._soft_deleted.values():
|
197
|
+
if isinstance(obj, SoftDeleteMixin):
|
198
|
+
obj.reset_delete()
|
199
|
+
obj.is_live = True
|
200
|
+
continue
|
201
|
+
raise RuntimeError("non-soft delete object in soft deleted set")
|
202
|
+
self._reset_soft_deleted()
|
203
|
+
|
204
|
+
@property
|
205
|
+
def deleted(self):
|
206
|
+
deleted = super().deleted
|
207
|
+
if self._soft_deleted:
|
208
|
+
deleted.update(self._soft_deleted.values())
|
209
|
+
return deleted
|
210
|
+
|
211
|
+
def delete(self, instance: object, *, force_hard_delete=False):
|
212
|
+
if isinstance(instance, SoftDeleteMixin) and not force_hard_delete:
|
213
|
+
self._delete_soft_deleted(instance)
|
214
|
+
return
|
215
|
+
super().delete(instance)
|
216
|
+
|
217
|
+
|
218
|
+
SoftDeleteMixin.register_session_event_listeners(Session)
|
corvic/orm/ids.py
CHANGED
@@ -8,7 +8,6 @@ from typing import Any, Generic, Self, TypeVar
|
|
8
8
|
import sqlalchemy as sa
|
9
9
|
import sqlalchemy.types as sa_types
|
10
10
|
|
11
|
-
import corvic.context
|
12
11
|
from corvic.orm.errors import InvalidORMIdentifierError
|
13
12
|
from corvic.result import Ok
|
14
13
|
|
@@ -110,74 +109,6 @@ class BaseIDFromStr(BaseID[str]):
|
|
110
109
|
return cls(orm_id or "")
|
111
110
|
|
112
111
|
|
113
|
-
class OrgID(BaseIDFromStr):
|
114
|
-
"""A unique identifier for an organization."""
|
115
|
-
|
116
|
-
@property
|
117
|
-
def is_super_user(self):
|
118
|
-
return self._value == corvic.context.SUPERUSER_ORG_ID
|
119
|
-
|
120
|
-
@property
|
121
|
-
def is_nobody(self):
|
122
|
-
return self._value == corvic.context.NOBODY_ORG_ID
|
123
|
-
|
124
|
-
|
125
|
-
class RoomID(BaseIDFromInt):
|
126
|
-
"""A unique identifier for a room."""
|
127
|
-
|
128
|
-
|
129
|
-
class ResourceID(BaseIDFromInt):
|
130
|
-
"""A unique identifier for a resource."""
|
131
|
-
|
132
|
-
|
133
|
-
class SourceID(BaseIDFromInt):
|
134
|
-
"""A unique identifier for a source."""
|
135
|
-
|
136
|
-
|
137
|
-
class PipelineID(BaseIDFromInt):
|
138
|
-
"""A unique identifier for a pipeline."""
|
139
|
-
|
140
|
-
|
141
|
-
class FeatureViewID(BaseIDFromInt):
|
142
|
-
"""A unique identifier for a feature view."""
|
143
|
-
|
144
|
-
|
145
|
-
class FeatureViewSourceID(BaseIDFromInt):
|
146
|
-
"""A unique identifier for a source in a feature view."""
|
147
|
-
|
148
|
-
|
149
|
-
class SpaceID(BaseIDFromInt):
|
150
|
-
"""A unique identifier for a space."""
|
151
|
-
|
152
|
-
|
153
|
-
class SpaceRunID(BaseIDFromInt):
|
154
|
-
"""A unique identifier for a space run."""
|
155
|
-
|
156
|
-
|
157
|
-
class SpaceParametersID(BaseIDFromInt):
|
158
|
-
"""A unique identifier for a space parameters."""
|
159
|
-
|
160
|
-
|
161
|
-
class AgentID(BaseIDFromInt):
|
162
|
-
"""A unique identifier for a agent."""
|
163
|
-
|
164
|
-
|
165
|
-
class AgentMessageID(BaseIDFromInt):
|
166
|
-
"""A unique identifier for a agent message."""
|
167
|
-
|
168
|
-
|
169
|
-
class UserMessageID(BaseIDFromInt):
|
170
|
-
"""A unique identifier for a user message."""
|
171
|
-
|
172
|
-
|
173
|
-
class MessageEntryID(BaseIDFromInt):
|
174
|
-
"""A unique identifier for a message entry."""
|
175
|
-
|
176
|
-
|
177
|
-
class CompletionModelID(BaseIDFromInt):
|
178
|
-
"""A unique identifier for a completion model."""
|
179
|
-
|
180
|
-
|
181
112
|
_IntID = TypeVar("_IntID", bound=BaseIDFromInt)
|
182
113
|
|
183
114
|
|
corvic/system/_embedder.py
CHANGED
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING, Any, Literal, Protocol, cast
|
|
7
7
|
import numpy as np
|
8
8
|
import polars as pl
|
9
9
|
|
10
|
-
from corvic import
|
10
|
+
from corvic import eorm
|
11
11
|
from corvic.result import InternalError, InvalidArgumentError, Ok
|
12
12
|
|
13
13
|
if TYPE_CHECKING:
|
@@ -26,7 +26,7 @@ class EmbedTextContext:
|
|
26
26
|
tokenizer_name: str
|
27
27
|
expected_vector_length: int
|
28
28
|
expected_coordinate_bitwidth: Literal[32, 64]
|
29
|
-
room_id:
|
29
|
+
room_id: eorm.RoomID
|
30
30
|
|
31
31
|
|
32
32
|
@dataclasses.dataclass
|
@@ -9,7 +9,7 @@ from typing import Any, Protocol
|
|
9
9
|
|
10
10
|
import pyarrow as pa
|
11
11
|
|
12
|
-
from corvic import
|
12
|
+
from corvic import eorm, op_graph
|
13
13
|
from corvic.result import (
|
14
14
|
InternalError,
|
15
15
|
InvalidArgumentError,
|
@@ -63,7 +63,7 @@ class ExecutionContext:
|
|
63
63
|
they are nodes in the tables_to_compute op graph.
|
64
64
|
"""
|
65
65
|
|
66
|
-
room_id:
|
66
|
+
room_id: eorm.RoomID
|
67
67
|
|
68
68
|
|
69
69
|
class TableComputeResult(Protocol):
|
corvic/system/storage.py
CHANGED
@@ -7,7 +7,7 @@ import uuid
|
|
7
7
|
from collections.abc import Iterator
|
8
8
|
from typing import Any, BinaryIO, Final, Literal, Protocol
|
9
9
|
|
10
|
-
from corvic import
|
10
|
+
from corvic import eorm
|
11
11
|
from corvic.result import Error
|
12
12
|
|
13
13
|
|
@@ -134,13 +134,15 @@ class StorageManager:
|
|
134
134
|
self.bucket = self._blob_client.bucket(self._bucket_name)
|
135
135
|
|
136
136
|
@staticmethod
|
137
|
-
def _render_room_id(room_id:
|
137
|
+
def _render_room_id(room_id: eorm.RoomID) -> str:
|
138
138
|
return f"{int(str(room_id)):016}"
|
139
139
|
|
140
140
|
def blob_from_url(self, url: str):
|
141
141
|
return self._blob_client.blob_from_url(url)
|
142
142
|
|
143
|
-
def make_tabular_blob(
|
143
|
+
def make_tabular_blob(
|
144
|
+
self, room_id: eorm.RoomID, suffix: str | None = None
|
145
|
+
) -> Blob:
|
144
146
|
if suffix:
|
145
147
|
name = f"{self._render_room_id(room_id)}/{suffix}"
|
146
148
|
else:
|
@@ -148,7 +150,7 @@ class StorageManager:
|
|
148
150
|
return self.bucket.blob(f"{self.tabular_prefix}/{name}")
|
149
151
|
|
150
152
|
def make_unstructured_blob(
|
151
|
-
self, room_id:
|
153
|
+
self, room_id: eorm.RoomID, suffix: str | None = None
|
152
154
|
) -> Blob:
|
153
155
|
if suffix:
|
154
156
|
name = f"{self._render_room_id(room_id)}/{suffix}"
|
@@ -156,7 +158,7 @@ class StorageManager:
|
|
156
158
|
name = f"{self._render_room_id(room_id)}/{uuid.uuid4()}"
|
157
159
|
return self.bucket.blob(f"{self.unstructured_prefix}/{name}")
|
158
160
|
|
159
|
-
def make_vector_blob(self, room_id:
|
161
|
+
def make_vector_blob(self, room_id: eorm.RoomID, suffix: str | None = None) -> Blob:
|
160
162
|
if suffix:
|
161
163
|
name = f"{self._render_room_id(room_id)}/{suffix}"
|
162
164
|
else:
|
@@ -172,11 +174,11 @@ class StorageManager:
|
|
172
174
|
def get_vector_blob_from_blob_name(self, blob_name: str) -> Blob:
|
173
175
|
return self.bucket.blob(f"{self.vector_prefix}/{blob_name}")
|
174
176
|
|
175
|
-
def tabular_prefix_for_room_id(self, room_id:
|
177
|
+
def tabular_prefix_for_room_id(self, room_id: eorm.RoomID) -> str:
|
176
178
|
return f"{self.tabular_prefix}/{self._render_room_id(room_id)}"
|
177
179
|
|
178
|
-
def unstructured_prefix_for_room_id(self, room_id:
|
180
|
+
def unstructured_prefix_for_room_id(self, room_id: eorm.RoomID) -> str:
|
179
181
|
return f"{self.unstructured_prefix}/{self._render_room_id(room_id)}"
|
180
182
|
|
181
|
-
def vector_prefix_for_room_id(self, room_id:
|
183
|
+
def vector_prefix_for_room_id(self, room_id: eorm.RoomID) -> str:
|
182
184
|
return f"{self.vector_prefix}/{self._render_room_id(room_id)}"
|
corvic/system_sqlite/client.py
CHANGED
@@ -13,7 +13,7 @@ import duckdb
|
|
13
13
|
import sqlalchemy as sa
|
14
14
|
|
15
15
|
import corvic.context
|
16
|
-
import corvic.
|
16
|
+
import corvic.eorm
|
17
17
|
import corvic.system
|
18
18
|
from corvic.result import NotFoundError
|
19
19
|
from corvic.system_sqlite.fs_blob_store import FSBlobClient
|
@@ -26,7 +26,7 @@ VECTOR_PREFIX = "vectors"
|
|
26
26
|
|
27
27
|
|
28
28
|
@contextlib.contextmanager
|
29
|
-
def _context_requester_org_id_is(value: str | corvic.
|
29
|
+
def _context_requester_org_id_is(value: str | corvic.eorm.OrgID) -> Iterator[None]:
|
30
30
|
old_requester = corvic.context.get_requester()
|
31
31
|
new_requester = corvic.context.Requester(org_id=str(value))
|
32
32
|
corvic.context.update_context(new_requester=new_requester)
|
@@ -60,19 +60,19 @@ def _initialize_db_from_empty(engine: sa.Engine):
|
|
60
60
|
is Postgres-specific. This initialization process is at the ORM level so it will
|
61
61
|
work for any compatible backend, assuming no state needs to be migrated.
|
62
62
|
"""
|
63
|
-
with _context_requester_org_is_superuser(), corvic.
|
64
|
-
new_org = corvic.
|
63
|
+
with _context_requester_org_is_superuser(), corvic.eorm.Session(engine) as session:
|
64
|
+
new_org = corvic.eorm.Org(id=corvic.eorm.OrgID("default_org"))
|
65
65
|
session.add(new_org)
|
66
66
|
|
67
67
|
session.commit()
|
68
68
|
|
69
|
-
new_room = corvic.
|
69
|
+
new_room = corvic.eorm.Room(name="default_room")
|
70
70
|
new_room.org_id = new_org.id
|
71
71
|
session.add(new_room)
|
72
72
|
|
73
73
|
session.commit()
|
74
74
|
|
75
|
-
new_default_entry = corvic.
|
75
|
+
new_default_entry = corvic.eorm.DefaultObjects(
|
76
76
|
default_org=new_org.id,
|
77
77
|
default_room=new_room.id,
|
78
78
|
)
|
@@ -82,10 +82,10 @@ def _initialize_db_from_empty(engine: sa.Engine):
|
|
82
82
|
|
83
83
|
|
84
84
|
def _get_default_org_id(engine: sa.Engine):
|
85
|
-
with corvic.
|
85
|
+
with corvic.eorm.Session(engine) as session:
|
86
86
|
defaults_row = session.scalars(
|
87
|
-
sa.select(corvic.
|
88
|
-
.order_by(corvic.
|
87
|
+
sa.select(corvic.eorm.DefaultObjects)
|
88
|
+
.order_by(corvic.eorm.DefaultObjects.version.desc())
|
89
89
|
.limit(1)
|
90
90
|
).one_or_none()
|
91
91
|
if not defaults_row:
|
@@ -143,7 +143,7 @@ class Client(corvic.system.Client):
|
|
143
143
|
tabular_prefix=TABULAR_PREFIX,
|
144
144
|
vector_prefix=VECTOR_PREFIX,
|
145
145
|
)
|
146
|
-
corvic.
|
146
|
+
corvic.eorm.Base.metadata.create_all(self._sa_engine)
|
147
147
|
duck_db_conn = duckdb.connect(":memory:")
|
148
148
|
if staging_db_maker:
|
149
149
|
self._staging_db = staging_db_maker(self.storage_manager)
|
corvic/table/table.py
CHANGED
@@ -24,7 +24,7 @@ import pyarrow.parquet as pq
|
|
24
24
|
import structlog
|
25
25
|
from google.protobuf import struct_pb2
|
26
26
|
|
27
|
-
from corvic import
|
27
|
+
from corvic import eorm, op_graph
|
28
28
|
from corvic.op_graph import Encoder, Schema
|
29
29
|
from corvic.result import (
|
30
30
|
InternalError,
|
@@ -379,7 +379,7 @@ class Table:
|
|
379
379
|
return self.op_graph.to_bytes()
|
380
380
|
|
381
381
|
async def to_polars(
|
382
|
-
self, room_id:
|
382
|
+
self, room_id: eorm.RoomID, *, flatten_single_field: bool = False
|
383
383
|
) -> (
|
384
384
|
Ok[Iterable[pl.DataFrame]]
|
385
385
|
| InvalidArgumentError
|
@@ -457,7 +457,7 @@ class Table:
|
|
457
457
|
)
|
458
458
|
|
459
459
|
async def to_batches(
|
460
|
-
self, room_id:
|
460
|
+
self, room_id: eorm.RoomID
|
461
461
|
) -> (
|
462
462
|
Ok[pa.RecordBatchReader]
|
463
463
|
| InvalidArgumentError
|
@@ -11,46 +11,46 @@ corvic/embedding_metric/__init__.py,sha256=8a-QKSQNbiksueHk5LdkugjZr6wasP4ff8A-J
|
|
11
11
|
corvic/embedding_metric/embeddings.py,sha256=XCiMzoGdRSmCOJnBDnxm3xlU0L_vrXwUxEjwdMv1FMI,14036
|
12
12
|
corvic/embedding_metric/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
corvic/engine/__init__.py,sha256=XL4Vg7rNcBi29ccVelpeFizR9oJtGYXDn84W9zok9d4,975
|
14
|
-
corvic/engine/_native.pyd,sha256=
|
14
|
+
corvic/engine/_native.pyd,sha256=BnJ0aIVFyA4rV9MW1QJgQzI0sGDfe1Gbsl5lyG3C4N8,438272
|
15
15
|
corvic/engine/_native.pyi,sha256=KYMPtvXqHZ-jMgZohLf4se3rr-rBpCihmjANcr6s8ag,1390
|
16
16
|
corvic/engine/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
+
corvic/eorm/__init__.py,sha256=b4dFnu4fW7wj3Y0SMNVXOp8KoKOp_HAL4GyDN-S8fOY,13704
|
17
18
|
corvic/model/__init__.py,sha256=ZtMq8LTJE013v-OoVq0muo0aqomNGrjmXwKfS8wd4CU,3075
|
18
|
-
corvic/model/_base_model.py,sha256=
|
19
|
-
corvic/model/_completion_model.py,sha256=
|
20
|
-
corvic/model/_defaults.py,sha256=
|
19
|
+
corvic/model/_base_model.py,sha256=BBcpX792AC8zb1_Jq_aFQ7KwB3H5Mn4z1NE9sAoReqA,10328
|
20
|
+
corvic/model/_completion_model.py,sha256=e6vGrON3NTc9vXweunJ4hp9byMvMd-igMzaul-genK4,7643
|
21
|
+
corvic/model/_defaults.py,sha256=OnROutSYhCuNuIvJbWdp4NZyamYtWRjwc4BE2ZqNAm8,1529
|
21
22
|
corvic/model/_errors.py,sha256=Ctlq04SDwHzJPvLaL1rzqzwVqf2b50EILfW3cH4vnh8,261
|
22
23
|
corvic/model/_feature_type.py,sha256=Y-_-wa9fv7XaCAkxfjjoCLxxK2Ftfba-PMefD7bNXzs,917
|
23
|
-
corvic/model/_feature_view.py,sha256=
|
24
|
-
corvic/model/_pipeline.py,sha256=
|
25
|
-
corvic/model/_proto_orm_convert.py,sha256=
|
26
|
-
corvic/model/_resource.py,sha256=
|
27
|
-
corvic/model/_room.py,sha256=
|
28
|
-
corvic/model/_source.py,sha256=
|
29
|
-
corvic/model/_space.py,sha256=
|
24
|
+
corvic/model/_feature_view.py,sha256=3-MK8i6bVPp2wU24LHsjTLA7HnVJZ9MU4BrcmkDB_wI,49715
|
25
|
+
corvic/model/_pipeline.py,sha256=LlKUbz4ZaWugfdGbHpL5flfrXizS7Bsyh_npesGyU38,18797
|
26
|
+
corvic/model/_proto_orm_convert.py,sha256=czEE6qYjg4s73IMSA_mGYAyh9s2FKc2ofjE6YV2FMKc,24072
|
27
|
+
corvic/model/_resource.py,sha256=3eeYJf8M8063Go0QVOM03QqRAshyChInqqdpSxRx8mQ,8519
|
28
|
+
corvic/model/_room.py,sha256=OqceFrRZVt4OcHHbhAgCj0s77ErmIcaXRsf8Lv0nfrM,2868
|
29
|
+
corvic/model/_source.py,sha256=f62oLSv3qdOmfVhEjqL5ie55YiDdGDq0IhSAfFvrkBw,9803
|
30
|
+
corvic/model/_space.py,sha256=ffEIPWXTtuAp9kBA7J45h95OMwe0vFUlb-Hbot40AC0,36497
|
30
31
|
corvic/model/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
32
|
corvic/op_graph/__init__.py,sha256=1DMrQfuuS3FkLa9DXYDjSDLurdxxpG5H1jB2ctaa9xo,1444
|
32
|
-
corvic/op_graph/_schema.py,sha256=
|
33
|
+
corvic/op_graph/_schema.py,sha256=rDZt6xAFpvhBZlp54uvXlqTqOxO8uFtTtukBGSUylqA,5688
|
33
34
|
corvic/op_graph/_transformations.py,sha256=tROo0uR0km06LAsx4CSrR0OWPhFbvToFEowGcuAuRAs,9606
|
34
35
|
corvic/op_graph/aggregation.py,sha256=8X6vqXD7dLHrhYJU0BqmhUsWGbzD1zSP5Db5VHdIru4,6187
|
35
36
|
corvic/op_graph/encoders.py,sha256=93wYoBCn_us5lRCkqvjaP0LTg3LBB3yEfhzICv06bB0,10460
|
36
37
|
corvic/op_graph/errors.py,sha256=I4NE5053d0deGm5xx5EmyP4f98qx42xnIsW1IA-2hy4,163
|
37
|
-
corvic/op_graph/feature_types.py,sha256=
|
38
|
-
corvic/op_graph/ops.py,sha256=
|
38
|
+
corvic/op_graph/feature_types.py,sha256=YVbPzvMnHHmUfR5QAMSvQ6hjQcOrIjqR-su0VypYWFA,9627
|
39
|
+
corvic/op_graph/ops.py,sha256=vKs6lXvXWUqJusp0SKp0y94OOvtJ5KAITejoPMb810w,111833
|
39
40
|
corvic/op_graph/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
41
|
corvic/op_graph/row_filters/__init__.py,sha256=1sibH_kLw7t_9bpRccnEGWqdCiN0VaUh9LMMIMCRyL8,575
|
41
42
|
corvic/op_graph/row_filters/_jsonlogic.py,sha256=0UdwOZmIGp4yuExHM3qqAnJYmcGv7iuc3vLub3GD-9Y,7685
|
42
43
|
corvic/op_graph/row_filters/_row_filters.py,sha256=p3O7tJbLsy65Vs7shAiDjpdM4RzYA4-fyzwskt15pPk,9469
|
43
44
|
corvic/op_graph/sample_strategy.py,sha256=DrbtJ3ORkIRfyIE_FdlOh_UMnCW_K9jL1LeonVYb3bU,3007
|
44
|
-
corvic/orm/__init__.py,sha256=
|
45
|
+
corvic/orm/__init__.py,sha256=YGBnwYtPGop9-MWHTMetILlwse9FStTDcme28VCrHHE,9006
|
45
46
|
corvic/orm/_proto_columns.py,sha256=tcOu92UjFJFYZLasS6sWJQBDRK26yrnmpTii_LDY4iw,913
|
46
|
-
corvic/orm/
|
47
|
+
corvic/orm/_soft_delete.py,sha256=TolZ0j-1yL8yQW39Obe0c0af0jyT3sluk1oInqzxmGU,7919
|
47
48
|
corvic/orm/errors.py,sha256=uFhFXpVG6pby1lndJZHGHxv3Y0Fbt0RiaZ-CqDfuY1o,545
|
48
49
|
corvic/orm/func/__init__.py,sha256=X47bbG7G-rDGmRkEGMq4Vn7mPKePdx724xQIwd_pUc0,471
|
49
50
|
corvic/orm/func/utc_func.py,sha256=-FC6w9wBWXejMv1AICT2Gg7tdkSo7gqL2dFT-YKPGQ4,4518
|
50
51
|
corvic/orm/func/uuid_func.py,sha256=oXPjDGAl3mvlNtvcvBrLmRRHPJgtKffShIPbHm-EswA,1152
|
51
|
-
corvic/orm/ids.py,sha256=
|
52
|
+
corvic/orm/ids.py,sha256=tC5vfTJVEPSbJpBy4FD-e-qPE4EXC9ZBaON1cBsNJQU,5183
|
52
53
|
corvic/orm/keys.py,sha256=Ag6Xbpvxev-VByT1KJ8ChUn9vKVEzkkMXxrjvtADCtY,2182
|
53
|
-
corvic/orm/mixins.py,sha256=tBsXLdP_7vuNmyVe70yCfIzrPz9oX7dM67IToChzPBs,17995
|
54
54
|
corvic/orm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
55
55
|
corvic/pa_scalar/__init__.py,sha256=1nfc0MFGpw78RQEI13VE5hpHuyw_DoE7sJbmzqx5pws,1063
|
56
56
|
corvic/pa_scalar/_const.py,sha256=1nk6w3Y7crd3J5jSCq7DRVa1lcGk4H1RUr1l4NjnlzE,868
|
@@ -71,32 +71,32 @@ corvic/sql/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
71
71
|
corvic/system/__init__.py,sha256=U28LyDwpirtG0WDXqE6dzkx8PipvY2rtZSex03C7xlY,2792
|
72
72
|
corvic/system/_column_encoding.py,sha256=feSWIv4vKstVq-aavWPk53YucUiq7rZvuyofqTicXBE,7574
|
73
73
|
corvic/system/_dimension_reduction.py,sha256=2tg5SIHY4P480DJQj6PSjW1VgAJCAVJAH8D3BY-ZYXA,2964
|
74
|
-
corvic/system/_embedder.py,sha256=
|
74
|
+
corvic/system/_embedder.py,sha256=Jr-f4rwNdFRZuMaW-prPCDtjNkkNZVn7zCGMNi_hEYw,5424
|
75
75
|
corvic/system/_image_embedder.py,sha256=i595n22L8rmiZQ0sT3JTu_RBJrcU_5Vl95K2HPJtGGw,10447
|
76
76
|
corvic/system/_planner.py,sha256=ecL-HW8PVz5eWJ1Ktf-RAD2IdZkHu3GuBtXdqElo4ts,8210
|
77
77
|
corvic/system/_text_embedder.py,sha256=NDi--3_tzwIWVImjhFWmp8dHmydGGXNu6GYH8qODsIc,4000
|
78
78
|
corvic/system/client.py,sha256=JcA-fPraqDkl9f8BiClS0qeGY6wzKcEDPymutWrJo54,812
|
79
79
|
corvic/system/in_memory_executor.py,sha256=Ds2A_RLoQeGVMpvKDz4IXTq0r5SgPcpMKHYm8vW6R7k,66622
|
80
|
-
corvic/system/op_graph_executor.py,sha256=
|
80
|
+
corvic/system/op_graph_executor.py,sha256=tSKro-yb_y1_sgajZluM-6FCvDqO1oUPsiWw2DRxyMQ,3641
|
81
81
|
corvic/system/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
82
82
|
corvic/system/staging.py,sha256=K5P5moiuAMfPx7lxK4mArxeURBwKoyB6x9HGu9JJ16E,1846
|
83
|
-
corvic/system/storage.py,sha256=
|
83
|
+
corvic/system/storage.py,sha256=bp9llPmE6PwFta_9bhZ6d785ba3wbEysaL_0EzdAjPs,5575
|
84
84
|
corvic/system_sqlite/__init__.py,sha256=F4UN9vFsXiDY2AKk1jYZPuWWJpSugKHS7ghXeZYlbZs,390
|
85
|
-
corvic/system_sqlite/client.py,sha256=
|
85
|
+
corvic/system_sqlite/client.py,sha256=OqX2-3sjYzzkuZXRDTBDjfiDzzLx1jNSud7fXp8CO0A,7486
|
86
86
|
corvic/system_sqlite/fs_blob_store.py,sha256=NTLzLFd56QNqA-iCxNjFAC-YePfXqWWTO9i_o1dJRr0,8563
|
87
87
|
corvic/system_sqlite/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
88
88
|
corvic/system_sqlite/rdbms_blob_store.py,sha256=gTP_tQfTVb3wzZkzo8ys1zaz0rSrERzb57rqMHVpuBA,10563
|
89
89
|
corvic/system_sqlite/staging.py,sha256=9WjXT_XT3wGCFgx9dieOGjHcuu2ZEaFWMChQaISMEIs,17332
|
90
90
|
corvic/table/__init__.py,sha256=Gj0IR8BQF5PZK92Us7PP0ZigMsVyrfWJupzH8TgzRQk,588
|
91
91
|
corvic/table/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
92
|
-
corvic/table/table.py,sha256=
|
92
|
+
corvic/table/table.py,sha256=fvt6G20Jz1Cfhf9zrmYIDPjUR4lGAWKjlx4eWKvoqtk,25815
|
93
93
|
corvic/version/__init__.py,sha256=JlkRLvKXsu3zIxhdynO_0Ub5NfQOvGjfwCRkNnaOu9U,1125
|
94
94
|
corvic/version/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
95
95
|
corvic/well_known_types/__init__.py,sha256=Btbeqieik2AcmijeOXeqBptzueBpgNitvH9J5VNm12w,1289
|
96
96
|
corvic/well_known_types/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
97
|
-
corvic_engine-0.3.
|
98
|
-
corvic_engine-0.3.
|
99
|
-
corvic_engine-0.3.
|
97
|
+
corvic_engine-0.3.0rc78.dist-info/METADATA,sha256=h3-wxx4uit-9adJbG11D8-YSOvmTM_4ZSRK6bFYjQpc,1814
|
98
|
+
corvic_engine-0.3.0rc78.dist-info/WHEEL,sha256=qo08K5WTt1v9liGoFGXfI182ciKs5521XAErJtzFynQ,94
|
99
|
+
corvic_engine-0.3.0rc78.dist-info/licenses/LICENSE,sha256=DSS1OD0oIgssKOmAzkMRBv5jvvVuZQbrIv8lpl9DXY8,1035
|
100
100
|
corvic_generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
101
101
|
corvic_generated/algorithm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
102
102
|
corvic_generated/algorithm/graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -207,4 +207,4 @@ corvic_generated/status/v1/service_pb2.py,sha256=CKXPX2ahq8O4cFhPpt6wo6l--6VZcgj
|
|
207
207
|
corvic_generated/status/v1/service_pb2.pyi,sha256=iXLR2FOKQJpBgvBzpD2kVwcYOCksP2aRwK4JYaI9CBw,558
|
208
208
|
corvic_generated/status/v1/service_pb2_grpc.py,sha256=y-a5ldrphWlNJW-yKswyjNmXokK4-5bbEEfczjagJHo,2736
|
209
209
|
corvic_generated/status/v1/service_pb2_grpc.pyi,sha256=OoAnaZ64FD0UTzPoRhYvQU8ecoilhHj3ySjSfHbVDaU,1501
|
210
|
-
corvic_engine-0.3.
|
210
|
+
corvic_engine-0.3.0rc78.dist-info/RECORD,,
|