Comments (8)
At the moment the commit for the repository is called once the analysis is complete.
It uses SqlBulkCopy to save the data, utilising the WriteToServer method. There is another overload on that method, that allows specifying a DataRowState. See the Repository.cs around line 261.
In theory, the commit could be modified to use the alternate WriteToServer(DataTable, DataRowState) and include only DataRowState of Added.
Then after each commit of a table, the rows would need updated to a DataRowState of Unchanged, via a call to AcceptChanges() against the table.
WriteToServer does not update the records in the associated DataTable's state.
Then the repository commit could be called many times, for just added records.
Some work to handle DataRowState.Modified will be required, as comments can be updated. But the vast majority of the execution is adding new records.
If this was done, then the various loops that are scanning items, could include a call to the repository commit.
from sqlservermetadata.
Hello...
I did a modifications see blow and it works for the context of ispac files
in program.cs :
public static void Commit_Intermediate(Repository repository)
{
Console.Write("Committing ISPAC analysis information to database...");
repository.Commit_Intermediate();
Console.WriteLine("Done for ISPAC File.");
}
in Repository.cs :
public void Commit_Intermediate()
{
// write each data table to the database
SqlBulkCopy bulkCopy = new SqlBulkCopy(repositoryConnection);
bulkCopy.DestinationTableName = "RunScan";
bulkCopy.WriteToServer(runScanTable);
runScanTable.Clear (); //in the final & next intermadiate commit mean nothing to add
bulkCopy.DestinationTableName = "Objects";
bulkCopy.WriteToServer(objectTable);
objectTable.Clear ();
bulkCopy.DestinationTableName = "ObjectDependencies";
bulkCopy.WriteToServer(objectDependenciesTable);
objectDependenciesTable.Clear ();
bulkCopy.DestinationTableName = "ObjectAttributes";
bulkCopy.WriteToServer(objectAttributesTable);
objectAttributesTable.Clear ();
bulkCopy.DestinationTableName = "ObjectTypes";
bulkCopy.WriteToServer(objectTypesTable);
objectTypesTable.Clear ();
bulkCopy.Close();
}
and in SsisEnumerator.cs ONLY for ISPAC FILES :
private void EnumerateProjects(string rootFolder, string pattern, bool recurseSubFolders, string locationName)
{
string[] filesToInspect;
Console.Write("Enumerating projects...");
filesToInspect = System.IO.Directory.GetFiles(rootFolder, pattern, (recurseSubFolders) ? System.IO.SearchOption.AllDirectories : System.IO.SearchOption.TopDirectoryOnly);
Console.WriteLine("done.");
foreach (string projectFileName in filesToInspect)
{
EnumerateIntegrationServicePack(projectFileName, locationName);
Program.Commit_Intermediate(repository);
}
}
from sqlservermetadata.
Your code will work.
It's just not quite the way I have implemented it. (I hadn't added a comment that I'd made changes, as I haven't finished regression testing everything.)
If you grab the latest commit you can see they way that I implemented it, which is slightly different, as I changed the main commit routine to handle both bulk insert and updates to change records.
I've also got significantly more commit's happening, on a "per folder basis", including where you have yours above.
from sqlservermetadata.
hello,
Ok i can see your change :-) glade to see you already work on it :-)
As is said can be very interesting in a big SSIS referential to avoid 2 hours treatment to go in the trash...
Of course the next step after this one would be to allow a new analyse to be done with the same run id avoiding to re analyse ISPAC already loaded.
And the cherry on the cake would be to allow the storage of the ISPAC filename + timestamp update date to allow a run upon a ispac referential and update only ISPAC file that have been updated without re analyse all the set...
this is the first milestone of the project for me to implement in order to have a daily updated SSIS metadata upon our 1200 dtsx with 100 Ispac files.
Hope you share the same roadmap :-) any way thank you for your work.
from sqlservermetadata.
If you could raise each of those ideas as a separate issues.
That way I can tag them as enhancements, and at least provide ideas on how they could be implemented.
from sqlservermetadata.
NO probs thank you again
from sqlservermetadata.
hello...we try this and found that if the project is in exception the commit happen...this corrupt the run cause the analysis is uncompleted.
This commit should only happen if there is no exception i guess ...
Anyway we are now looping on each isapc...meaning this intermediate commit may be not needed anymore.
Regards
from sqlservermetadata.
I have added Rollback capability, which removes any added records, when an exception happens whilst scanning an SSIS package. Each ssis package is now committed individually.
from sqlservermetadata.
Related Issues (20)
- No Installer - Please advise HOT 2
- 2017 Error Enumerating Database - Could not load file or assembly HOT 7
- The data from the scan is not being written to the repository database. HOT 3
- Unexpected error occurred: GenericArguments[0] HOT 1
- Hangs on some SSIS solutions HOT 6
- Execute SQL Task with project connection manager fails HOT 2
- How to avoid duplicate entries for same table in objects table? HOT 2
- Store ISPAC filename + analyse timestamp HOT 2
- Run an analysis upon a existing RUN scan ID with "Delta" Mode for ISPAC files analysis HOT 2
- tool cannot see variable defined at data flow task level and used by source HOT 7
- Avoid parsing other connections type than SQL Server HOT 1
- Execution result to be stored in db table. HOT 1
- sqlStatement.getTableNames() not returning all tables used HOT 1
- Long SQL code in variable expression : Objecname column size HOT 1
- SSIS Package more than 22 throw StackOverflowException HOT 1
- can't open this url : http://archive.msdn.microsoft.com/SqlServerMetadata HOT 1
- Please update DependencyAnalyzer for SQL Server 2019 HOT 1
- sqlStatement.getTableNames() not returning all tables used if you identify insert statement with nested derived tables HOT 1
- Error Number: 46010 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlservermetadata.