Sindbad~EG File Manager
from sqlalchemy import create_engine, MetaData, Table, insert, select,update,delete,text
from sqlalchemy.sql import and_, or_
from core import app
import json
from .. import engine
# engine = create_engine(app.config['DATABASE_URI'],pool_pre_ping=True,pool_recycle=3600)
class OfflineModel():
def __init__(self):
try:
self.meta = MetaData()
self.states = Table("states", self.meta, autoload_with=engine)
self.self_spot_register = Table("self_spot_register",self.meta, autoload_with= engine)
self.conference = Table("conference",self.meta, autoload_with= engine)
self.delegates = Table("delegates",self.meta, autoload_with= engine)
self.badge_role = Table("badge_role",self.meta, autoload_with= engine)
except Exception as e:
print(e)
def get_member_details(self,user_id,curr_dt):
with engine.connect() as conn:
stmt = text("select u.*,s.state_name,a.display_name,a.amount from users u "
+" left join states s on s.state_id = u.state_id"
+" inner join addons a on find_in_set(u.member_type_id,a.show_member_types)"
+" left join user_types ut on ut.user_type_id = a.user_type_id"
+" where u.user_id= "+ str(user_id)+" and a.is_visible=1 AND '"+curr_dt+"' between a.start_by and a.end_by"
+" order by a.addon_id limit 1;")
result = conn.execute(stmt).one_or_none()
return dict(result._mapping) if result else None
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists