Sindbad~EG File Manager

Current Path : /home/numerotech/live.numerotech.com/common_user_dashboard/core/model/
Upload File :
Current File : //home/numerotech/live.numerotech.com/common_user_dashboard/core/model/Log.py

from sqlalchemy import create_engine, select, MetaData, Table
from sqlalchemy.sql import and_, or_
from core import app
from datetime import datetime

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
				)



# engine = create_engine('')
class Log():
	def __init__(self):
		try:
			self.meta = MetaData()
			self.logs = Table("logs", self.meta, autoload_with=engine)
		except Exception as e:
			print(e)

	def insert(self,data):
		with engine.connect() as conn:
			print("in logs insert")
			result = conn.execute(self.logs.insert(), data)
			conn.commit()
			return result

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists