45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
from sqlalchemy import Table, Column, Integer, String,MetaData,select,insert,NVARCHAR
|
|
from sqlalchemy.orm import sessionmaker
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
from sqlalchemy.orm import Session
|
|
Base = declarative_base()
|
|
|
|
|
|
class LabelHandler:
|
|
|
|
def __init__(self,engine) -> None:
|
|
self.engine=engine
|
|
|
|
def getNewReleases(self):
|
|
class PropertyNamesChecked(Base):
|
|
__tablename__ = 'PropertyNamesChecked'
|
|
id = Column(Integer, primary_key=True)
|
|
Project = Column(NVARCHAR(length=100))
|
|
CurrentVersion = Column(NVARCHAR(length=145))
|
|
|
|
Base.metadata.create_all(self.engine)
|
|
|
|
#Session = sessionmaker(bind=self.engine)
|
|
session = Session(self.engine, future=True)
|
|
meta = MetaData()
|
|
meta.reflect(bind=self.engine)
|
|
listDeployedLabels=meta.tables['ListDeployedLabels']
|
|
class ListDeployedLabels(Base):
|
|
__table__=listDeployedLabels
|
|
__mapper_args__ = {
|
|
'primary_key':[listDeployedLabels.c.Project]
|
|
}
|
|
|
|
statement=select(ListDeployedLabels).join(PropertyNamesChecked,PropertyNamesChecked.Project==ListDeployedLabels.Project)
|
|
|
|
listOfUncheckedPropertyNames=session.execute(statement).scalars().all()
|
|
return listOfUncheckedPropertyNames
|
|
|
|
|
|
def markAsChecked(self):
|
|
pass
|
|
|
|
def getLabel(self,listDeployedLabels:Base):
|
|
strLabel=""
|
|
strLabel=listDeployedLabels.CurrentVersion.split(':')[2].strip()
|
|
return strLabel |