Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused sqlservice requirement, partly revert and update Alchy class #56

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 8 additions & 3 deletions chanjo_report/server/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,20 @@ def __init__(
session_options = {}

session_options.setdefault("query_cls", QueryModel)
session_options.setdefault("scopefunc", get_ident)

self.Model = Model
self.make_declarative_base(Model)

super(Alchy, self).__init__(app, use_native_unicode, session_options, metadata=metadata)
super(Alchy, self).__init__(app=app, session_options=session_options, metadata=metadata)

self.Query = session_options["query_cls"]


def make_declarative_base(self, metadata=None):
"""Override parent function with alchy's"""
return make_declarative_base(self.session,
Model=self.Model,
metadata=metadata)

def __getattr__(self, attr):
"""Delegate all other attributes to self.session"""
return getattr(self.session, attr)
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ path.py
pymysql
pyscss
six
sqlservice
Flask-SQLAlchemy
tabulate
toml
Expand Down