This commit is contained in:
Dennis Kerschus 2022-10-03 12:56:48 +02:00
parent c6483fc621
commit 513aba2a49
2 changed files with 30 additions and 1 deletions

15
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}

View File

@ -16,14 +16,19 @@ def checkFile(file):
if(x.find("DTS:ObjectName")>-1): if(x.find("DTS:ObjectName")>-1):
propertyNameTokens=x.split('=') propertyNameTokens=x.split('=')
count=0 count=0
propertyNameToken=None
while count < len(propertyNameTokens): while count < len(propertyNameTokens):
if(propertyNameTokens[count].find("DTS:ObjectName")>-1): if(propertyNameTokens[count].find("DTS:ObjectName")>-1):
propertyNameToken=propertyNameTokens[count+1].split('"')[1] propertyNameToken=propertyNameTokens[count+1].split('"')[1]
break break
count+=2 count+=2
if(propertyNameToken==None):
print(f"propertyNameToken findes ikke i {file.name}")
continue
if(file.stem!=propertyNameToken): if(file.stem!=propertyNameToken):
ssisproject=[a for a in file.parts if a.find("SSIS_")>-1] ssisproject=[a for a in file.parts if a.find("SSIS_")>-1]
if(len(ssisproject)>0): if(len(ssisproject)>0):
#insertOrUpdateTable(ssisproject[0],str(file.parent),str(file.stem),propertyNameToken)
insertIntoTable(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(ssisproject[0] + ' ' + str(file.parent) + ' ' + file.stem + ' ' + propertyNameToken)
print(x) print(x)
@ -33,7 +38,16 @@ def checkFile(file):
f.close() f.close()
def insertIntoTable(ssisproject,tfspath,packagename,packagenameproperty): def insertIntoTable(ssisproject,tfspath,packagename,packagenameproperty):
curser.execute("insert into [UDV_denker].[dbo].[ssispackages](SSISProject,tfspath,PackageName,PackageNameProperty,ITPUpdate,ITUUpdate) values (?,?,?,?,?,?)",(ssisproject,tfspath,packagename,packagenameproperty,0,0)) curser.execute("insert into [UDV_denker].[dbo].[ssispackages](SSISProject,tfspath,PackageName,PackageNameProperty,ITPUpdate,ITUUpdate) values (?,?,?,?,?,?)",(ssisproject,tfspath,packagename,packagenameproperty,0,0))
def insertOrUpdateTable(ssisproject,tfspath,packagename,packagenameproperty):
return
def updateTableIndex():
curser.execute("select id,tfspath from [UDV_denker].[dbo].[ssispackages]")
return
curser=cnxn.cursor() curser=cnxn.cursor()
updateTableIndex()
[traverseDirectory(x) for x in p.iterdir() if x.is_dir()] [traverseDirectory(x) for x in p.iterdir() if x.is_dir()]
cnxn.commit() cnxn.commit()
cnxn.close()