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
engine = create_engine(app.config['DATABASE_URI'],pool_size=5000,pool_pre_ping=True,pool_recycle=3600)
class KitDashboardModel():
def __init__(self):
try:
self.meta = MetaData()
self.conference = Table("conference", self.meta, autoload_with=engine)
except Exception as e:
print("Table not found",e)
def get_conf_dashboard_data(self,conf_id,conf_schema_):
with engine.connect() as conn:
stmt = text("select * from "+conf_schema_+".conference_active where conf_id = "+str(conf_id)+";")
result = conn.execute(stmt).all()
return [dict(r._mapping) for r in result] if result else None
def get_kc_count(self,conf_id,conf_schema):
with engine.connect() as conn:
stmt = text("select s.session_id,s.session_name,session_key,s.start_time,s.end_time,count(e.session_id) as count from "+conf_schema+".kc_sessions s left join "+conf_schema+".kc_sessions_entry e on e.session_id = s.session_id where s.conf_id ="+str(conf_id)+" and s.dashboard_is_active = 1 group by s.session_id;")
result = conn.execute(stmt).all()
return [dict(r._mapping) for r in result] if result else None
def GetConf(self,conf_id,conf_key):
with engine.connect() as conn:
stmt = text("select * from conference c inner join society_applications s on s.conf_id = c.conf_id and app_type_id = 2 inner join mail_setting m on s.mail_setting_id = m.mail_setting_id where c.conf_id = "+str(conf_id)+" and c.conf_key = '"+conf_key+"' limit 1;")
result = conn.execute(stmt)
result = result.one_or_none()
return dict(result._mapping) if result else None
def GetKitReport(self,session_id,conf_id,conf_key,conf_schema):
connection = engine.raw_connection()
cursor = connection.cursor()
cursor.callproc("usp_get_conf_kc_reports",[session_id,conf_id,conf_key])
if cursor.description :
columns = [column[0] for column in cursor.description]
results = []
for row in cursor.fetchall():
results.append(dict(zip(columns, row)))
cursor.close()
connection.commit()
if results :
return results
else :
return None
else :
cursor.close()
connection.commit()
return None
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists