Skip to content

Commit 28c1302

Browse files
committed
Optimize columns loading: lazy create row locator
1 parent 968e8da commit 28c1302

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/gino/crud.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ def __init__(self, instance: "CRUDModel"):
8787
self._props = {}
8888
self._literal = True
8989
self._locator = None
90-
if instance.__table__ is not None:
90+
if self._instance.__table__ is not None:
9191
try:
92-
self._locator = instance.lookup()
92+
self._locator = self._instance.lookup()
9393
except LookupError:
9494
# apply() will fail anyway, but still allow update()
9595
pass
@@ -435,7 +435,8 @@ class CRUDModel(Model):
435435
def __init__(self, **values):
436436
super().__init__()
437437
self.__profile__ = None
438-
self._update_request_cls(self).update(**values)
438+
if values:
439+
self._update_request_cls(self).update(**values)
439440

440441
@classmethod
441442
def _init_table(cls, sub_cls):

0 commit comments

Comments
 (0)