13
13
# limitations under the License.
14
14
15
15
16
+ from objectbox .logger import logger
16
17
from objectbox .model .entity import _Entity
17
18
from objectbox .model .properties import *
18
19
from objectbox .c import *
19
- import logging
20
20
21
21
22
22
class IdUid :
@@ -50,11 +50,12 @@ def _set_hnsw_params(self, index: HnswIndex):
50
50
if index .distance_type is not None :
51
51
obx_model_property_index_hnsw_distance_type (self ._c_model , index .distance_type )
52
52
if index .reparation_backlink_probability is not None :
53
- obx_model_property_index_hnsw_reparation_backlink_probability (self ._c_model , index .reparation_backlink_probability )
53
+ obx_model_property_index_hnsw_reparation_backlink_probability (self ._c_model ,
54
+ index .reparation_backlink_probability )
54
55
if index .vector_cache_hint_size_kb is not None :
55
56
obx_model_property_index_hnsw_vector_cache_hint_size_kb (self ._c_model , index .vector_cache_hint_size_kb )
56
57
57
- def entity (self , entity : _Entity , last_property_id : IdUid , last_index_id : Optional [ IdUid ] = None ):
58
+ def entity (self , entity : _Entity , last_property_id : IdUid ):
58
59
if not isinstance (entity , _Entity ):
59
60
raise Exception ("Given type is not an Entity. Are you passing an instance instead of a type or did you "
60
61
"forget the '@Entity' annotation?" )
@@ -63,12 +64,12 @@ def entity(self, entity: _Entity, last_property_id: IdUid, last_index_id: Option
63
64
64
65
obx_model_entity (self ._c_model , c_str (entity .name ), entity .id , entity .uid )
65
66
66
- logging .debug (f"Creating entity \" { entity .name } \" (ID={ entity .id } , { entity .uid } )" )
67
+ logger .debug (f"Creating entity \" { entity .name } \" (ID={ entity .id } , { entity .uid } )" )
67
68
68
69
for property_ in entity .properties :
69
70
obx_model_property (self ._c_model , c_str (property_ ._name ), property_ ._ob_type , property_ ._id , property_ ._uid )
70
71
71
- logging .debug (f"Creating property \" \" (ID={ property_ ._id } , UID={ property_ ._uid } )" )
72
+ logger .debug (f"Creating property \" { property_ . _name } \" (ID={ property_ ._id } , UID={ property_ ._uid } )" )
72
73
73
74
if property_ ._flags != 0 :
74
75
obx_model_property_flags (self ._c_model , property_ ._flags )
@@ -77,9 +78,9 @@ def entity(self, entity: _Entity, last_property_id: IdUid, last_index_id: Option
77
78
index = property_ ._index
78
79
if isinstance (index , HnswIndex ):
79
80
self ._set_hnsw_params (index )
80
- logging .debug (f" HNSW index (ID={ index .id } , UID{ index .uid } ); Dimensions: { index .dimensions } " )
81
+ logger .debug (f" HNSW index (ID={ index .id } , UID{ index .uid } ); Dimensions: { index .dimensions } " )
81
82
else :
82
- logging .debug (f" Index (ID={ index .id } , UID{ index .uid } ); Type: { index .type } " )
83
+ logger .debug (f" Index (ID={ index .id } , UID{ index .uid } ); Type: { index .type } " )
83
84
obx_model_property_index_id (self ._c_model , index .id , index .uid )
84
85
85
86
obx_model_entity_last_property_id (self ._c_model , last_property_id .id , last_property_id .uid )
0 commit comments