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'])
# 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=5000,max_overflow=100,pool_pre_ping=True,pool_recycle=3600)
# engine = create_engine(app.config['DATABASE_URI'], poolclass=None,pool_size=5000,max_overflow=100,pool_pre_ping=True,pool_recycle=3600)
class MWorkType():
def __init__(self):
try:
self.meta = MetaData()
self.m_work_type = Table("m_work_type", self.meta, autoload_with=engine)
self.m_position_type = Table("m_position_type", self.meta, autoload_with=engine)
except Exception as e:
print(e)
def get_work_type(self,society_id):
with engine.connect() as conn:
stmt = text("select * from m_work_type where society_id=:society_id")
results = conn.execute(stmt.bindparams(society_id=society_id)).all()
conn.close()
return [dict(r._mapping) for r in results] if results else None
def get_work_type_by_user(self,user_id):
with engine.connect() as conn:
stmt=text("select * from m_work_type as mw inner join user_works as uw on mw.work_type_id=uw.work_type_id left join m_position_type mp on mp.position_type_id=uw.position_type_id where user_id= "+str(user_id)+";")
results = conn.execute(stmt).all()
conn.close()
return [dict(r._mapping) for r in results] if results else None
def get_position_type(self,society_id):
with engine.connect() as conn:
stmt = text("select * from m_position_type where society_id=:society_id order by position_type ")
results = conn.execute(stmt.bindparams(society_id=society_id)).all()
conn.close()
return [dict(r._mapping) for r in results] if results else None
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists