corvic-engine 0.3.0rc77__cp38-abi3-win_amd64.whl → 0.3.0rc79__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/model/_room.py CHANGED
@@ -5,9 +5,7 @@ from __future__ import annotations
5
5
  from collections.abc import Sequence
6
6
  from typing import TypeAlias
7
7
 
8
- import structlog
9
-
10
- from corvic import orm, system
8
+ from corvic import eorm, system
11
9
  from corvic.model._base_model import BelongsToOrgModel
12
10
  from corvic.model._defaults import Defaults
13
11
  from corvic.model._proto_orm_convert import (
@@ -18,37 +16,35 @@ from corvic.model._proto_orm_convert import (
18
16
  from corvic.result import InvalidArgumentError, NotFoundError, Ok
19
17
  from corvic_generated.model.v1alpha import models_pb2
20
18
 
21
- _logger = structlog.get_logger()
22
-
23
- OrgID: TypeAlias = orm.OrgID
24
- RoomID: TypeAlias = orm.RoomID
25
- FeatureViewID: TypeAlias = orm.FeatureViewID
19
+ OrgID: TypeAlias = eorm.OrgID
20
+ RoomID: TypeAlias = eorm.RoomID
21
+ FeatureViewID: TypeAlias = eorm.FeatureViewID
26
22
 
27
23
 
28
- class Room(BelongsToOrgModel[RoomID, models_pb2.Room, orm.Room]):
24
+ class Room(BelongsToOrgModel[RoomID, models_pb2.Room, eorm.Room]):
29
25
  """Rooms contain conversations and tables."""
30
26
 
31
27
  @classmethod
32
28
  def orm_class(cls):
33
- return orm.Room
29
+ return eorm.Room
34
30
 
35
31
  @classmethod
36
32
  def id_class(cls):
37
33
  return RoomID
38
34
 
39
35
  @classmethod
40
- def orm_to_proto(cls, orm_obj: orm.Room) -> models_pb2.Room:
36
+ def orm_to_proto(cls, orm_obj: eorm.Room) -> models_pb2.Room:
41
37
  return room_orm_to_proto(orm_obj)
42
38
 
43
39
  @classmethod
44
40
  def proto_to_orm(
45
- cls, proto_obj: models_pb2.Room, session: orm.Session
46
- ) -> Ok[orm.Room] | InvalidArgumentError:
41
+ cls, proto_obj: models_pb2.Room, session: eorm.Session
42
+ ) -> Ok[eorm.Room] | InvalidArgumentError:
47
43
  return room_proto_to_orm(proto_obj, session)
48
44
 
49
45
  @classmethod
50
46
  def delete_by_ids(
51
- cls, ids: Sequence[RoomID], session: orm.Session
47
+ cls, ids: Sequence[RoomID], session: eorm.Session
52
48
  ) -> Ok[None] | InvalidArgumentError:
53
49
  return room_delete_orms(ids, session)
54
50
 
corvic/model/_source.py CHANGED
@@ -13,7 +13,7 @@ import sqlalchemy as sa
13
13
  import sqlalchemy.orm as sa_orm
14
14
  from sqlalchemy.orm.interfaces import LoaderOption
15
15
 
16
- from corvic import op_graph, orm, system
16
+ from corvic import eorm, op_graph, system
17
17
  from corvic.model._base_model import BelongsToRoomModel
18
18
  from corvic.model._defaults import Defaults
19
19
  from corvic.model._proto_orm_convert import (
@@ -26,9 +26,9 @@ from corvic.result import InvalidArgumentError, NotFoundError, Ok
26
26
  from corvic.table import Table
27
27
  from corvic_generated.model.v1alpha import models_pb2
28
28
 
29
- SourceID: TypeAlias = orm.SourceID
30
- RoomID: TypeAlias = orm.RoomID
31
- PipelineID: TypeAlias = orm.PipelineID
29
+ SourceID: TypeAlias = eorm.SourceID
30
+ RoomID: TypeAlias = eorm.RoomID
31
+ PipelineID: TypeAlias = eorm.PipelineID
32
32
 
33
33
 
34
34
  def foreign_key(
@@ -45,7 +45,7 @@ def foreign_key(
45
45
  )
46
46
 
47
47
 
48
- class Source(BelongsToRoomModel[SourceID, models_pb2.Source, orm.Source]):
48
+ class Source(BelongsToRoomModel[SourceID, models_pb2.Source, eorm.Source]):
49
49
  """Sources describe how resources should be treated.
50
50
 
51
51
  Example:
@@ -56,25 +56,25 @@ class Source(BelongsToRoomModel[SourceID, models_pb2.Source, orm.Source]):
56
56
 
57
57
  @classmethod
58
58
  def orm_class(cls):
59
- return orm.Source
59
+ return eorm.Source
60
60
 
61
61
  @classmethod
62
62
  def id_class(cls):
63
63
  return SourceID
64
64
 
65
65
  @classmethod
66
- def orm_to_proto(cls, orm_obj: orm.Source) -> models_pb2.Source:
66
+ def orm_to_proto(cls, orm_obj: eorm.Source) -> models_pb2.Source:
67
67
  return source_orm_to_proto(orm_obj)
68
68
 
69
69
  @classmethod
70
70
  def proto_to_orm(
71
- cls, proto_obj: models_pb2.Source, session: orm.Session
72
- ) -> Ok[orm.Source] | InvalidArgumentError:
71
+ cls, proto_obj: models_pb2.Source, session: eorm.Session
72
+ ) -> Ok[eorm.Source] | InvalidArgumentError:
73
73
  return source_proto_to_orm(proto_obj, session)
74
74
 
75
75
  @classmethod
76
76
  def delete_by_ids(
77
- cls, ids: Sequence[SourceID], session: orm.Session
77
+ cls, ids: Sequence[SourceID], session: eorm.Session
78
78
  ) -> Ok[None] | InvalidArgumentError:
79
79
  return source_delete_orms(ids, session)
80
80
 
@@ -197,8 +197,8 @@ class Source(BelongsToRoomModel[SourceID, models_pb2.Source, orm.Source]):
197
197
  @classmethod
198
198
  def orm_load_options(cls) -> list[LoaderOption]:
199
199
  return [
200
- sa_orm.selectinload(orm.Source.pipeline_ref).selectinload(
201
- orm.PipelineOutput.source
200
+ sa_orm.selectinload(eorm.Source.pipeline_ref).selectinload(
201
+ eorm.PipelineOutput.source
202
202
  ),
203
203
  ]
204
204
 
@@ -224,13 +224,13 @@ class Source(BelongsToRoomModel[SourceID, models_pb2.Source, orm.Source]):
224
224
  return NotFoundError("resource not found", resource_id=resource_id)
225
225
  case Ok(resource):
226
226
 
227
- def resource_filter(query: sa.Select[tuple[orm.Source]]):
227
+ def resource_filter(query: sa.Select[tuple[eorm.Source]]):
228
228
  return query.where(
229
- orm.Source.id.in_(
230
- sa.select(orm.PipelineOutput.source_id)
231
- .join(orm.Pipeline)
232
- .join(orm.PipelineInput)
233
- .where(orm.PipelineInput.resource_id == resource.id)
229
+ eorm.Source.id.in_(
230
+ sa.select(eorm.PipelineOutput.source_id)
231
+ .join(eorm.Pipeline)
232
+ .join(eorm.PipelineInput)
233
+ .where(eorm.PipelineInput.resource_id == resource.id)
234
234
  )
235
235
  )
236
236
 
corvic/model/_space.py CHANGED
@@ -13,7 +13,7 @@ import pyarrow as pa
13
13
  import sqlalchemy as sa
14
14
  from sqlalchemy import orm as sa_orm
15
15
 
16
- from corvic import op_graph, orm, system
16
+ from corvic import eorm, op_graph, system
17
17
  from corvic.model._base_model import BelongsToRoomModel
18
18
  from corvic.model._defaults import Defaults
19
19
  from corvic.model._feature_view import FeatureView, FeatureViewEdgeTableMetadata
@@ -29,9 +29,9 @@ from corvic_generated.embedding.v1 import models_pb2 as embedding_models_pb2
29
29
  from corvic_generated.model.v1alpha import models_pb2
30
30
  from corvic_generated.orm.v1 import space_pb2
31
31
 
32
- FeatureViewID: TypeAlias = orm.FeatureViewID
33
- RoomID: TypeAlias = orm.RoomID
34
- SpaceID: TypeAlias = orm.SpaceID
32
+ FeatureViewID: TypeAlias = eorm.FeatureViewID
33
+ RoomID: TypeAlias = eorm.RoomID
34
+ SpaceID: TypeAlias = eorm.SpaceID
35
35
 
36
36
  _DEFAULT_CONCAT_SEPARATOR = " "
37
37
 
@@ -61,7 +61,7 @@ name_to_proto_image_model = {
61
61
  }
62
62
 
63
63
 
64
- class Space(BelongsToRoomModel[SpaceID, models_pb2.Space, orm.Space]):
64
+ class Space(BelongsToRoomModel[SpaceID, models_pb2.Space, eorm.Space]):
65
65
  """Spaces apply embedding methods to FeatureViews.
66
66
 
67
67
  Example:
@@ -70,35 +70,35 @@ class Space(BelongsToRoomModel[SpaceID, models_pb2.Space, orm.Space]):
70
70
 
71
71
  @classmethod
72
72
  def orm_class(cls):
73
- return orm.Space
73
+ return eorm.Space
74
74
 
75
75
  @classmethod
76
76
  def id_class(cls):
77
77
  return SpaceID
78
78
 
79
79
  @classmethod
80
- def orm_to_proto(cls, orm_obj: orm.Space) -> models_pb2.Space:
80
+ def orm_to_proto(cls, orm_obj: eorm.Space) -> models_pb2.Space:
81
81
  return space_orm_to_proto(orm_obj)
82
82
 
83
83
  @classmethod
84
84
  def proto_to_orm(
85
- cls, proto_obj: models_pb2.Space, session: orm.Session
86
- ) -> Ok[orm.Space] | InvalidArgumentError:
85
+ cls, proto_obj: models_pb2.Space, session: eorm.Session
86
+ ) -> Ok[eorm.Space] | InvalidArgumentError:
87
87
  return space_proto_to_orm(proto_obj, session)
88
88
 
89
89
  @classmethod
90
90
  def delete_by_ids(
91
- cls, ids: Sequence[SpaceID], session: orm.Session
91
+ cls, ids: Sequence[SpaceID], session: eorm.Session
92
92
  ) -> Ok[None] | InvalidArgumentError:
93
93
  return space_delete_orms(ids, session)
94
94
 
95
95
  @classmethod
96
96
  def orm_load_options(cls) -> list[sa.LoaderOption]:
97
97
  return [
98
- sa_orm.selectinload(orm.Space.feature_view)
99
- .selectinload(orm.FeatureView.feature_view_sources)
100
- .selectinload(orm.FeatureViewSource.source)
101
- .selectinload(orm.Source.pipeline_ref)
98
+ sa_orm.selectinload(eorm.Space.feature_view)
99
+ .selectinload(eorm.FeatureView.feature_view_sources)
100
+ .selectinload(eorm.FeatureViewSource.source)
101
+ .selectinload(eorm.Source.pipeline_ref)
102
102
  ]
103
103
 
104
104
  @property
@@ -227,10 +227,10 @@ class Space(BelongsToRoomModel[SpaceID, models_pb2.Space, orm.Space]):
227
227
  cls,
228
228
  *,
229
229
  limit: int | None = None,
230
- room_id: orm.RoomID | None = None,
230
+ room_id: eorm.RoomID | None = None,
231
231
  created_before: datetime.datetime | None = None,
232
232
  client: system.Client | None = None,
233
- ids: Iterable[orm.SpaceID] | None = None,
233
+ ids: Iterable[eorm.SpaceID] | None = None,
234
234
  existing_session: sa_orm.Session | None = None,
235
235
  ) -> Ok[list[SpecificSpace]] | InvalidArgumentError | NotFoundError:
236
236
  client = client or Defaults.get_default_client()
@@ -367,7 +367,7 @@ class RelationalSpace(Space):
367
367
  feature_view: FeatureView,
368
368
  parameters: Node2VecParameters,
369
369
  client: system.Client | None = None,
370
- room_id: orm.RoomID | None = None,
370
+ room_id: eorm.RoomID | None = None,
371
371
  *,
372
372
  auto_sync: bool = False,
373
373
  ) -> Ok[RelationalSpace] | InvalidArgumentError:
@@ -556,7 +556,7 @@ class SemanticSpace(Space):
556
556
  feature_view: FeatureView,
557
557
  parameters: ConcatAndEmbedParameters,
558
558
  client: system.Client | None = None,
559
- room_id: orm.RoomID | None = None,
559
+ room_id: eorm.RoomID | None = None,
560
560
  *,
561
561
  auto_sync: bool = False,
562
562
  ) -> Ok[SemanticSpace] | InvalidArgumentError:
@@ -691,7 +691,7 @@ class TabularSpace(Space):
691
691
  feature_view: FeatureView,
692
692
  parameters: EmbedAndConcatParameters,
693
693
  client: system.Client | None = None,
694
- room_id: orm.RoomID | None = None,
694
+ room_id: eorm.RoomID | None = None,
695
695
  *,
696
696
  auto_sync: bool = False,
697
697
  ) -> Ok[Self] | InvalidArgumentError:
@@ -943,7 +943,7 @@ class ImageSpace(Space):
943
943
  def output_source(self):
944
944
  return self.feature_view.output_sources[0]
945
945
 
946
- def _sub_orm_objects(self, orm_object: orm.Space) -> Iterable[orm.Base]:
946
+ def _sub_orm_objects(self, orm_object: eorm.Space) -> Iterable[eorm.Base]:
947
947
  return []
948
948
 
949
949
  @property
@@ -958,7 +958,7 @@ class ImageSpace(Space):
958
958
  feature_view: FeatureView,
959
959
  parameters: EmbedImageParameters,
960
960
  client: system.Client | None = None,
961
- room_id: orm.RoomID | None = None,
961
+ room_id: eorm.RoomID | None = None,
962
962
  *,
963
963
  auto_sync: bool = False,
964
964
  ) -> Ok[Self] | InvalidArgumentError:
@@ -6,7 +6,7 @@ import polars as pl
6
6
  import pyarrow as pa
7
7
 
8
8
  import corvic.op_graph.feature_types as feature_type
9
- from corvic import orm
9
+ from corvic import eorm
10
10
  from corvic.op_graph.feature_types import FeatureType
11
11
 
12
12
 
@@ -20,7 +20,7 @@ def _infer_possible_feature_types(
20
20
  feature_type.identifier(),
21
21
  feature_type.primary_key(),
22
22
  feature_type.categorical(),
23
- feature_type.foreign_key(referenced_source_id=orm.SourceID()),
23
+ feature_type.foreign_key(referenced_source_id=eorm.SourceID()),
24
24
  feature_type.unknown(),
25
25
  ]
26
26
  if pa.types.is_decimal(data_type) | pa.types.is_floating(data_type):
@@ -41,7 +41,7 @@ def _infer_possible_feature_types(
41
41
  feature_type.identifier(),
42
42
  feature_type.primary_key(),
43
43
  feature_type.categorical(),
44
- feature_type.foreign_key(referenced_source_id=orm.SourceID()),
44
+ feature_type.foreign_key(referenced_source_id=eorm.SourceID()),
45
45
  feature_type.image(),
46
46
  feature_type.unknown(),
47
47
  ]
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  from typing import Any, Final, overload
6
6
 
7
- from corvic import orm
7
+ from corvic import eorm
8
8
  from corvic.op_graph.errors import OpParseError
9
9
  from corvic.proto_wrapper import OneofProtoWrapper
10
10
  from corvic.result import InvalidArgumentError
@@ -200,8 +200,8 @@ class ForeignKey(_Base):
200
200
  __match_args__ = ("referenced_source_id",)
201
201
 
202
202
  @property
203
- def referenced_source_id(self) -> orm.SourceID:
204
- return orm.SourceID(self._proto.foreign_key.referenced_source_id)
203
+ def referenced_source_id(self) -> eorm.SourceID:
204
+ return eorm.SourceID(self._proto.foreign_key.referenced_source_id)
205
205
 
206
206
 
207
207
  class Identifier(_Base):
@@ -248,7 +248,7 @@ def primary_key(*, is_excluded: bool = False):
248
248
 
249
249
 
250
250
  def foreign_key(
251
- referenced_source_id: orm.SourceID, *, is_excluded: bool = False
251
+ referenced_source_id: eorm.SourceID, *, is_excluded: bool = False
252
252
  ) -> ForeignKey:
253
253
  """Build a ForeignKey FeatureType."""
254
254
  return from_proto(
corvic/op_graph/ops.py CHANGED
@@ -46,7 +46,7 @@ from google.protobuf import json_format, struct_pb2
46
46
  from more_itertools import flatten
47
47
 
48
48
  import corvic.op_graph.feature_types as feature_type
49
- from corvic import orm, pa_scalar
49
+ from corvic import eorm, pa_scalar
50
50
  from corvic.op_graph._schema import Field
51
51
  from corvic.op_graph.aggregation import Aggregation
52
52
  from corvic.op_graph.aggregation import from_proto as aggregation_from_proto
@@ -3290,7 +3290,7 @@ class Schema(Sequence[Field]):
3290
3290
  pass
3291
3291
  return None
3292
3292
 
3293
- def get_foreign_keys(self, source_id: orm.SourceID) -> list[Field]:
3293
+ def get_foreign_keys(self, source_id: eorm.SourceID) -> list[Field]:
3294
3294
  def generate_matching_fields():
3295
3295
  for field in self:
3296
3296
  match field.ftype: