upload
This commit is contained in:
commit
ec95220f9b
41
LabelHandler.py
Normal file
41
LabelHandler.py
Normal file
@ -0,0 +1,41 @@
|
||||
from sqlalchemy import Table, Column, Integer, String,MetaData,select,insert,NVARCHAR
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.ext.declarative import declarative_base;
|
||||
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()
|
||||
meta = MetaData()
|
||||
meta.reflect(bind=self.engine)
|
||||
listDeployedLabels=meta.tables['ListDeployedLabels']
|
||||
class ListDeployedLabels(Base):
|
||||
__table__=listDeployedLabels
|
||||
__mapper_args__ = {
|
||||
'primary_key':[listDeployedLabels.c.Project]
|
||||
}
|
||||
|
||||
|
||||
res=session.query(ListDeployedLabels).join(PropertyNamesChecked,PropertyNamesChecked.Project==ListDeployedLabels.Project)
|
||||
listOfUncheckedPropertyNames = []
|
||||
for r in res:
|
||||
listOfUncheckedPropertyNames.append(r)
|
||||
return listOfUncheckedPropertyNames
|
||||
|
||||
|
||||
def markAsChecked():
|
||||
pass
|
||||
21
RepositoryAutoCheck.py
Normal file
21
RepositoryAutoCheck.py
Normal file
@ -0,0 +1,21 @@
|
||||
from sqlalchemy import create_engine
|
||||
import urllib
|
||||
from LabelHandler import LabelHandler
|
||||
|
||||
server = 'bi-dsa-udv\dsa' # to specify an alternate port
|
||||
database = 'udv_denker'
|
||||
username = 'admindenker'
|
||||
password = 'biadmin#kode4meO9'
|
||||
|
||||
connection_string = "DRIVER={SQL Server};Database="+database+";SERVER="+server
|
||||
connection_string = urllib.parse.quote_plus(connection_string)
|
||||
connection_string = "mssql+pyodbc:///?odbc_connect=%s" % connection_string
|
||||
engine = create_engine(connection_string, echo = True)
|
||||
|
||||
labelHandler = LabelHandler(engine)
|
||||
newReleases=labelHandler.getNewReleases()
|
||||
|
||||
|
||||
print("done")
|
||||
|
||||
|
||||
41
TfsHandler.py
Normal file
41
TfsHandler.py
Normal file
@ -0,0 +1,41 @@
|
||||
from pathlib import Path
|
||||
class TfsHandler():
|
||||
def __init__(self,path):
|
||||
self.path=Path(path)
|
||||
def checkPropertyName(self):
|
||||
pass
|
||||
def updateRepository(self):
|
||||
pass
|
||||
def checkFile(file):
|
||||
f=open(file,"r", encoding='utf-8')
|
||||
for x in f:
|
||||
if(x.find("DTS:ObjectName")>-1):
|
||||
propertyNameTokens=x.split('=')
|
||||
count=0
|
||||
propertyNameToken=None
|
||||
while count < len(propertyNameTokens):
|
||||
if(propertyNameTokens[count].find("DTS:ObjectName")>-1):
|
||||
propertyNameToken=propertyNameTokens[count+1].split('"')[1]
|
||||
break
|
||||
count+=2
|
||||
if(propertyNameToken==None):
|
||||
print(f"propertyNameToken findes ikke i {file.name}")
|
||||
continue
|
||||
if(file.stem!=propertyNameToken):
|
||||
ssisproject=[a for a in file.parts if a.find("SSIS_")>-1]
|
||||
if(len(ssisproject)>0):
|
||||
#insertOrUpdateTable(ssisproject[0],str(file.parent),str(file.stem),propertyNameToken)
|
||||
insertIntoTable(ssisproject[0],str(file.parent),str(file.stem),propertyNameToken)
|
||||
print(ssisproject[0] + ' ' + str(file.parent) + ' ' + file.stem + ' ' + propertyNameToken)
|
||||
print(x)
|
||||
break
|
||||
else:
|
||||
continue
|
||||
f.close()
|
||||
|
||||
# def traverseDirectory(x):
|
||||
# if (x.name=='obj' or x.name.strip()=='DataPresentationArea' or x.name=='FastTrack' or x.name=='Undervisning' or x.name=='Udvikling'):
|
||||
# # print(x.name)
|
||||
# return
|
||||
# [checkFile(z) for z in x.iterdir() if z.is_file and z.name.endswith('.dtsx')]
|
||||
# [traverseDirectory(y) for y in x.iterdir() if y.is_dir()]
|
||||
BIN
__pycache__/LabelHandler.cpython-37.pyc
Normal file
BIN
__pycache__/LabelHandler.cpython-37.pyc
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user