Sindbad~EG File Manager
from sqlalchemy import create_engine, MetaData, Table, insert, select,update,delete,text
from sqlalchemy.sql import and_, or_
from sqlalchemy import asc, desc
from core import app
import json
# engine = create_engine(app.config['DATABASE_URI'],pool_size=5000,pool_pre_ping=True,pool_recycle=3600)
engine = create_engine(app.config['DATABASE_URI'],
pool_size=10, # Maximum number of connections in the pool
max_overflow=5, # Maximum number of additional connections to be created if pool is exhausted
pool_timeout=30, # Seconds to wait before giving up when trying to connect to the pool
pool_recycle=3600, # Time in seconds after which a connection will be recycled
)
class NoticeBoardModel():
def __init__(self):
try:
self.meta = MetaData()
self.ex_comm_members = Table("ex_comm_members", self.meta, autoload_with=engine)
self.gbm_minutes = Table("gbm_minutes", self.meta, autoload_with=engine)
self.ex_comm_meetings = Table("ex_comm_meetings", self.meta, autoload_with=engine)
except Exception as e:
print(e)
def get_ex_comm_members(self):
with engine.connect() as conn:
stmt = text("select * from ex_comm_members")
results = conn.execute(stmt).all()
result= [dict(r._mapping) for r in results] if results else None
conn.close()
return result
def get_gbm_minutes(self,society_id):
with engine.connect() as conn:
stmt = text(f"select * from gbm_minutes where society_id = {society_id} and is_visible = 1 ;")
results = conn.execute(stmt).all()
results = [dict(r._mapping) for r in results] if results else None
conn.close()
if results :
return results
else:
return None
def get_ex_comm_meetigs(self,society_id):
with engine.connect() as conn:
stmt = text(f"select * from ex_comm_meetings where society_id = {society_id} and is_visible = 1 ;")
results = conn.execute(stmt).all()
results = [dict(r._mapping) for r in results] if results else None
conn.close()
if results :
return results
else:
return None
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists