diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..17e15f2 --- /dev/null +++ b/.vscode/launch.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/NamePropertySearch.py b/NamePropertySearch.py index 543a2b5..7026254 100644 --- a/NamePropertySearch.py +++ b/NamePropertySearch.py @@ -16,14 +16,19 @@ def checkFile(file): 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) @@ -33,7 +38,16 @@ def checkFile(file): f.close() 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)) - + +def insertOrUpdateTable(ssisproject,tfspath,packagename,packagenameproperty): + return + +def updateTableIndex(): + curser.execute("select id,tfspath from [UDV_denker].[dbo].[ssispackages]") + return + curser=cnxn.cursor() +updateTableIndex() [traverseDirectory(x) for x in p.iterdir() if x.is_dir()] cnxn.commit() +cnxn.close() \ No newline at end of file