forked from CMSCompOps/WmAgentScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdataLock.py
29 lines (24 loc) · 816 Bytes
/
dataLock.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import sys
from sqlalchemy import Column, ForeignKey, Integer, String, PickleType, Float, Boolean
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
Base = declarative_base()
class Lock(Base):
__tablename__ = 'lock'
id = Column(Integer, primary_key=True)
item = Column(String(500))
lock = Column(Boolean)
is_block = Column(Boolean)
site = Column(String(400))
time = Column(Integer)
reason = Column(String(400))
try:
lockengine = create_engine('sqlite:///Unified/lockRecord.db')
Base.metadata.create_all(lockengine)
from sqlalchemy.orm import sessionmaker
lDBSession = sessionmaker(bind=lockengine)
locksession = lDBSession()
except:
print "ignoring dataLock"