Skip to content

Commit

Permalink
Optimize columns loading: lazy create row locator
Browse files Browse the repository at this point in the history
  • Loading branch information
Reskov committed Oct 10, 2021
1 parent 968e8da commit 28c1302
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/gino/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ def __init__(self, instance: "CRUDModel"):
self._props = {}
self._literal = True
self._locator = None
if instance.__table__ is not None:
if self._instance.__table__ is not None:
try:
self._locator = instance.lookup()
self._locator = self._instance.lookup()
except LookupError:
# apply() will fail anyway, but still allow update()
pass
Expand Down Expand Up @@ -435,7 +435,8 @@ class CRUDModel(Model):
def __init__(self, **values):
super().__init__()
self.__profile__ = None
self._update_request_cls(self).update(**values)
if values:
self._update_request_cls(self).update(**values)

@classmethod
def _init_table(cls, sub_cls):
Expand Down

0 comments on commit 28c1302

Please sign in to comment.