I have 8 SSIS packages in a project with different variables. Is there an easy way to print all variables names, scope, DataType, Value, Expression for the whole project?
At this time I am manually typing each variable sheet into excel for audit.
Thank you for your help
Are you open to using C# or a .Net language? If so, you can use the SSIS Object Model to iterate over the variables as needed.
All Control Flow Task Hosts inherit from DtsContainer. DtsContainer contains a property called Variables, which is a collection of variables in the scope of that container.
So by starting with a Package object, you can get the Package object and all the children (and children of those children, if needed, recursively) as DtsContainer objects. You can get the children of the current object by casting it to IDTSSequence and then accessing the Executables property. Once you have the collection of all the Executables (the package, and children of children) as DtsContainers, you can then access the Variables property of each Container object, over which you can then iterate as you need.
I have uploaded a C# script that does the above here. https://gist.github.com/samskolli/974eaaf9d1bd72fb3ee8bb202e49a058
Related
I'm experimenting with the loop 'hack' to iterate the same workflow over a list of of values and I am trying to load that list at run-time.
The list contains a number of files that I would like to process and so this list will change every time.
In the example the value is passed via the job.properties file and I can also pass it in the workflow itself as a key/value pair but than the values are hard-coded in my workflow and I would like to prevent that (as the list will change every time).
I found a similar question:
OOZIE: properties defined in file referenced in global job-xml not visible in workflow.xml
and the answer there explains also my initial mistakes (parameters vs properties) where I tried to pass it via a global job.xml file (which is only for properties and not for parameters) but a good solution is not provided.
One solution would be to read the parameter from a file via a shell action and capturing the output but I think there could be a more elegant way of reading this parameter in my workflow?
I'm trying to write a common test module for a localized application.
The first issue I'm having is the fact that MenuItems do not support controlname attributes. Currently my menu items are located via text or accessiblename attribute. Is there a way to support controlname attribute?
I've tried to make text and accessiblename attribute point to a variable and then bind the variable to some external dictionary. As I understand the external data sources are treated as rows which contain various data items for a single variable. I don't see a way to use external data sources that treat first column as variable name and second column as variable value. Is there a way to achieve such functionality?
I've thought about a way to extend RanorexXPath to accept functions. Then I could write something like ...menuitem[text=localizationService.Translate("#ADMINISTRATION") and have Ranorex find the menu item based on the result of localizationService.Translate function. Is there a way to do this?
Finally I've somewhat managed to get the result I need by using global variables and module variables. What I did was create a module that uses localizationService to fill module variables with correct data. Next I bind the module variables to global parameters and use the data in subsequent test. This is quite error prone and difficult to implement for large number of variables. Is there a way to access and set global variables directly from code (without the need to use binding)?
If any of the 4. points is possible please let me know.
The recomendation from Ranorex support team:
In general only the whole menu is a control in WinForms. The elements within that control (MenuItems) can only be recognized via MSAA.
The problem is that the "Name" attribute of the MenuItems is not accessible.
As workaround I would suggest to use the attribute "AccessibleDescription" in your application in order to automate the menu. This attribute can also be used for language independent names.
I`m learning the concepts of composite applications.
I created prism application using unity container.
One of my regions configed as content control - In this Region, I want show just single view.
I`m using view injection in the next way:
object lastView;
// View injection
IRegion region = regionManager.Regions["MainRegion"];
var ordersView = container.Resolve<OrdersView>();
lastView = ordersView;
region.Add(ordersView, "OrdersView");
region.Activate(ordersView);
This the views in this region are switched frequently.
Before Im switching view Im using region.remove(lastView)
and than adding the next view like the code above.
Im not sure that its a good implementation, I have a few questions:
When I`m using region.remove method, Is the removed view being disposed?
Because if not after long run I will have serious memory leaks.
What is the best way implement single view in a region while avoiding memory leaks?
Thanks
By memory leaks I guess you're talking about whether the Garbage Collector is going to collect that view or not - e.g. is the container still referencing it when you remove it.
The decision on whether to keep a reference of the object after it's resolved is based on the type of the LifeTime Manager you used when you registered that object.
To answer your question shortly - The default LifeTime manager used with RegisterType is the TransientLifetimeManager, in which Unity creates a new instance of the requested type for each call to the Resolve or ResolveAll method.
What you're probably looking for is the ExternallyControlledLifetimeManager:
This lifetime manager allows you to register type mappings and existing objects with the container so that it maintains only a weak reference to the objects it creates when you call the Resolve or ResolveAll method or when the dependency mechanism injects instances into other classes based on attributes or constructor parameters within that class. This allows other code to maintain the object in memory or dispose it and enables you to maintain control of the lifetime of existing objects or allow some other mechanism to control the lifetime.
If you want to control the lifetime of your views, consider using the RegisterType with this LifeTime Manager.
Also, according to this article - The only lifetime managers which calls Dispose on resolved instances are ContainerControlledLifetimeManager (which creates singelton instances) and HierarchicalLifetimeManager. In these cases, the Dispose is only called when the lifetime manager is disposed.
This is something I have been struggling about for some time now. The thing is: I have many (20 or so) static arrays of values. I say static because that is how I'm actually storing them, as static arrays inside some domains. For example, if I have a list of known websites, I do:
class Website {
...
static websites = ["web1", "web2" ...]
}
But I do this just while developing, because I can easily change the arrays if needed, but what I'm going to do when the application is ready for deployment? In my project it is very probable that, at some point, these arrays of values change. I've been researching on that matter, one can store application properties inside an external .properties file, but it will be impossible to store an array, even futile, because if some array gets an additional value, the application can't recognize it until the name of the new property is added where needed.
Another approach is to store this information in the database, but for some reason it seems like a waste to add 20 or more tables that will have just two rows, an id and a name.
And the last option, as far as I know, would be an XML, but I'm not very experienced with those. It seems groovy has a way of creating and reading XML files relatively easy, but I don't know how difficult would be to modify an XML whose layout is predefined in the application.
Needless to say that storing them in the config.groovy is not an option since any change will require to recompile.
I haven't come across some "standard" (maybe a best practice?) way of dealing with these.
So the questions is: Where to store these arrays?
Use Enum for a fixed set of attributes. Do this, if you rely at some places in your code on some concrete values.
If you do not rely on the attributes within your code (which you obviously don't), use a String-type. In this case, if you need to provide a select box, just do a distinct-query on this property in your database.
Default: Use a domain class per dynamic set of attributes. Another table is OK.
For something as simple as arrays you should use groovy own type of property files. They allow you too define properties as proper groovy variables (not just strings) and obviously loading them would be done dinamically in a simple way by using ConfigSlurper. For an example on how to use this kind of file you can have a look at the following ConfigSlurper:
For defining properties:
my.property.array=[1,2,3,4]
For loading property files:
def config = new ConfigSlurper().parse(new File('myconfig.groovy').toURL())
assert [1,2,3,4] == config.my.property.array
Tip: When you want to access the property files you want to do it in a way that can work for any environment. To make paths environment-independent use the following path as the root path:
import org.codehaus.groovy.grails.commons.ApplicationHolder
def ctx = ApplicationHolder.application.mainContext.servletContext
def rootPath = ctx.contextPath
If you use an object database, what happens when you need to change the structure of your object model?
For instance, I'm playing around with the Google App Engine. While I'm developing my app, I've realized that in some cases, I mis-named a class, and I want to change the name. And I have two classes that I think I need to consolidate.
However,I don't think I can, because the name of the class in intuitively tied into the datastore, and there is actual data stored under those class names.
I suppose the good thing about the "old way" of abstracting the object model from the data storage is that the data storage doesn't know anything about the object model --it's just data. So, you can change your object model and just load the data out of the datastore differently.
So, in general, when using a datastore which is intimate with your data model...how do you change things around?
If it's just class naming you're concerned about, you can change the class name without changing the kind (the identifier that is used in the datastore):
class Foo(db.Model):
#classmethod
def kind(cls):
return 'Bar'
If you want to rename your class, just implement the kind() method as above, and have it return the old kind name.
If you need to make changes to the actual representation of data in the datastore, you'll have to run a mapreduce to update the old data.
The same way you do it in relational databases, except without a nice simple SQL script: http://code.google.com/appengine/articles/update_schema.html
Also, just like the old days, objects without properties don't automatically get defaults and properties that don't exist in the schema still hang around as phantoms in the objects.
To rename a property, I expect you can remove the old property (the phantom hangs around) add the new name, populate the data with a copy from the old (phantom) property. The re-written object will only have the new property
You may be able to do it the way we are doing it in our project:
Before we update the object-model (schema), we export our data to a file or blob in json format using a custom export function and version tag on top. After the schema has been updated we import the json with another custom function which creates new entities and populates them with old data. Of course the import version needs to know the json format associated with each version number.