Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
nose2
coverage
codeclimate-test-reporter
greenlet>=3.1
tox
mypy==1.1.1
sqlalchemy[mypy] >= 2.0
Expand Down
6 changes: 3 additions & 3 deletions sqlalchemy_mixins/activerecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ def destroy(cls, *ids, commit=True):

@classmethod
def all(cls):
return cls.query.all()
return cls.session.query(cls).all()

@classmethod
def first(cls):
return cls.query.first()
return cls.session.query(cls).first()

@classmethod
def find(cls, id_):
"""Find record by the id
:param id_: the primary key
"""
return cls.query.get(id_)
return cls.session.query(cls).get(id_)

@classmethod
def find_or_fail(cls, id_):
Expand Down