{"id":3416,"date":"2023-04-12T15:33:06","date_gmt":"2023-04-12T15:33:06","guid":{"rendered":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/"},"modified":"2026-01-16T15:13:31","modified_gmt":"2026-01-16T15:13:31","slug":"spss-modeler-advanced-stream-automation","status":"publish","type":"post","link":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/","title":{"rendered":"How Do I Use IBM SPSS Modeler Advanced Stream Automation to Automate Analytic Workflows?"},"content":{"rendered":"<p>If you\u2019re just starting scripting in modeler, please read the <strong>Basic Stream Automation<\/strong> article before this one!<\/p>\n<p>In this article, we\u2019ll talk through three more advanced topics including:<\/p>\n<ul>\n<li>Setting properties of nodes<\/li>\n<li>Looping through nodes to set connection properties on multiple nodes at once<\/li>\n<\/ul>\n<p>These are extremely common use cases that can be combined to truly automate a stream \u2013 giving you the tools to dynamically set properties of nodes. This will allow you to automatically connect to databases or adjust values throughout the stream based on stream parameters.<\/p>\n<p><span style=\"color: #3366ff;\"><strong>Setting Node Properties<\/strong><\/span><br \/>\nA node property is anything that you would set when you open a node. For a flat file source node this might be the source filepath, or in a filler node the script\/logic you write to fill values. All properties can be set via scripting with the simple function \u2018setPropertyValue\u2019. This takes two arguments, a property and a value.<\/p>\n<p>To set a property, first find the node using one of the find functions, such as findByType. You can then call the setPropertyValue function after referencing the node:<\/p>\n<p style=\"padding-left: 80px;\">import modeler.api<br \/>\nstream = modeler.script.stream()<br \/>\nexportNode1 = stream.findByType(None,&#8217;Export_1&#8242;)<br \/>\nexportNode1.setPropertyValue( )<\/p>\n<p>We can then pass in the property and value that we want to set for the node. In this case, exportNode1 is a database source node, which has a property of \u201cquery\u201d \u2013 a SQL query that hits the connected database.<\/p>\n<p style=\"padding-left: 80px;\">exportNode1.setPropertyValue(\u201cquery\u201d,\u201dselect * from table\u201d)<\/p>\n<p>Remember to put the property name in double-quotes, along with the property value if it is a string. This script would result in setting the query in the source node:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1140\" src=\"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2020\/07\/SPSSStream.jpg\" alt=\"\" width=\"1634\" height=\"365\" \/><\/p>\n<p>You can look up the list of properties for any node in the IBM documentation (linked at the bottom of this article), along with examples:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1141\" src=\"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2020\/07\/SPSSStream2.jpg\" alt=\"\" width=\"698\" height=\"868\" \/><\/p>\n<p><em><strong>The values in the \u2018databasenode properties\u2019 column can be passed in as the first argument of setPropertyValue, while the \u2018Data type\u2019 column is the expected datatype of the value in the second argument.<\/strong><\/em><\/p>\n<p><span style=\"color: #3366ff;\"><strong>Looping\/Modifying Multiple Nodes Simultaneously<\/strong><\/span><br \/>\nSelecting multiple nodes of the same type or name can be extremely useful if you want to perform simultaneous operations. One of the most common use cases is to set database credentials for all sources or export nodes so that they do not need to be manually input each time the stream is run. We\u2019ll walk through this example and show how this method can be used.<\/p>\n<p>Instead of the findByType function that finds a single node, we can use the findAll function to find all nodes of a type or name. This takes in two arguments just like findByType, a node type and\/or a node name respectively. In the following example we\u2019re finding all database source nodes, with a type of \u201cdatabase\u201d, and of any name, so we can pass in None for name:<\/p>\n<p style=\"padding-left: 80px;\">dbnodes = stream.findAll(&#8220;database&#8221;,None)<\/p>\n<p>This will create an object called dbnodes (any name can be used here) that contains a list of all database source nodes regardless of their name. If we wanted to search solely by name, we could pass in None for the type and a string for the name:<\/p>\n<p style=\"padding-left: 80px;\">dbnodes = stream.findAll(None,\u201dnode_name\u201d)<\/p>\n<p>You can also search for a specific type and name by putting values in both arguments.<\/p>\n<p>Once this object of multiple nodes has been created, we can loop through the nodes and perform operations on them. This can be done with a simple FOR loop:<\/p>\n<p style=\"padding-left: 80px;\">for dbnode in dbnodes:<\/p>\n<p>This allows you to refer to each node as \u2018dbnode\u2019 within the loop. Any name can be used in place of dbnode. Then, inside the loop, we can set properties of the nodes. If we wanted to set the datasources, names, and passwords of each node, we can use a combination of the functions described above and set the property values:<\/p>\n<p style=\"padding-left: 80px;\">dbnodes = stream.findAll(&#8220;database&#8221;,None)<br \/>\nfor dbnode in dbnodes:<br \/>\ndbnode.setPropertyValue(&#8220;datasource&#8221;,\u201dODBC1\u201d)<br \/>\ndbnode.setPropertyValue(&#8220;username&#8221;,\u201dUSER1\u201d)<br \/>\ndbnode.setPropertyValue(&#8220;password&#8221;,\u201dPASSWORD\u201d)<\/p>\n<p><strong>Note<\/strong> that in all python code, white space is important and denotes what is inside\/outside of the loop. Everything inside the loop must be at the same level of indentation.<br \/>\nUsing code like this will allow Modeler to automatically set its database credentials. This enables you to call the stream from an external source (like Modeler Batch or C&amp;DS) and have the stream run on its own without any user interaction, connecting to databases as it needs.<br \/>\nAll other python functionality, including basic looping, is also available within the scripting tool!<\/p>\n<p>IBM\u2019s documentation can be extremely useful to expand your knowledge of scripting and automation of streams, you can find it here:<br \/>\nftp:\/\/public.dhe.ibm.com\/software\/analytics\/spss\/documentation\/modeler\/18.1\/en\/ModelerScriptingAutomation.pdf<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you\u2019re just starting scripting in modeler, please read the Basic Stream Automation article before this one! In this article, we\u2019ll talk through three more advanced topics including: Setting properties of nodes Looping through nodes to set connection properties on multiple nodes at once These are extremely common use cases that can be combined to&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[24],"tags":[38,44,57],"class_list":["post-3416","post","type-post","status-publish","format-standard","hentry","category-ibm","tag-how-tos","tag-spss","tag-spss-how-tos"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How Do I Use IBM SPSS Modeler Advanced Stream Automation to Automate Analytic Workflows? - QueBIT<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How Do I Use IBM SPSS Modeler Advanced Stream Automation to Automate Analytic Workflows? - QueBIT\" \/>\n<meta property=\"og:description\" content=\"If you\u2019re just starting scripting in modeler, please read the Basic Stream Automation article before this one! In this article, we\u2019ll talk through three more advanced topics including: Setting properties of nodes Looping through nodes to set connection properties on multiple nodes at once These are extremely common use cases that can be combined to&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/\" \/>\n<meta property=\"og:site_name\" content=\"QueBIT\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-12T15:33:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-16T15:13:31+00:00\" \/>\n<meta name=\"author\" content=\"agoddard\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"agoddard\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/\"},\"author\":{\"name\":\"agoddard\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/#\\\/schema\\\/person\\\/e52d72da0fd2f5f70d189343fe4f5084\"},\"headline\":\"How Do I Use IBM SPSS Modeler Advanced Stream Automation to Automate Analytic Workflows?\",\"datePublished\":\"2023-04-12T15:33:06+00:00\",\"dateModified\":\"2026-01-16T15:13:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/\"},\"wordCount\":805,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/SPSSStream.jpg\",\"keywords\":[\"How To\u2019s\",\"SPSS\",\"SPSS How To's\"],\"articleSection\":[\"IBM\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/\",\"url\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/\",\"name\":\"How Do I Use IBM SPSS Modeler Advanced Stream Automation to Automate Analytic Workflows? - QueBIT\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/SPSSStream.jpg\",\"datePublished\":\"2023-04-12T15:33:06+00:00\",\"dateModified\":\"2026-01-16T15:13:31+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/#\\\/schema\\\/person\\\/e52d72da0fd2f5f70d189343fe4f5084\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/#primaryimage\",\"url\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/SPSSStream.jpg\",\"contentUrl\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/SPSSStream.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/spss-modeler-advanced-stream-automation\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How Do I Use IBM SPSS Modeler Advanced Stream Automation to Automate Analytic Workflows?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/#website\",\"url\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/\",\"name\":\"QueBIT\",\"description\":\"QueBIT\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/#\\\/schema\\\/person\\\/e52d72da0fd2f5f70d189343fe4f5084\",\"name\":\"agoddard\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g\",\"caption\":\"agoddard\"},\"sameAs\":[\"https:\\\/\\\/quebit.com\\\/askquebit\"],\"url\":\"https:\\\/\\\/quebit.com\\\/askquebit\\\/author\\\/agoddard\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How Do I Use IBM SPSS Modeler Advanced Stream Automation to Automate Analytic Workflows? - QueBIT","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/","og_locale":"en_US","og_type":"article","og_title":"How Do I Use IBM SPSS Modeler Advanced Stream Automation to Automate Analytic Workflows? - QueBIT","og_description":"If you\u2019re just starting scripting in modeler, please read the Basic Stream Automation article before this one! In this article, we\u2019ll talk through three more advanced topics including: Setting properties of nodes Looping through nodes to set connection properties on multiple nodes at once These are extremely common use cases that can be combined to&hellip;","og_url":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/","og_site_name":"QueBIT","article_published_time":"2023-04-12T15:33:06+00:00","article_modified_time":"2026-01-16T15:13:31+00:00","author":"agoddard","twitter_card":"summary_large_image","twitter_misc":{"Written by":"agoddard","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/#article","isPartOf":{"@id":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/"},"author":{"name":"agoddard","@id":"https:\/\/quebit.com\/askquebit\/#\/schema\/person\/e52d72da0fd2f5f70d189343fe4f5084"},"headline":"How Do I Use IBM SPSS Modeler Advanced Stream Automation to Automate Analytic Workflows?","datePublished":"2023-04-12T15:33:06+00:00","dateModified":"2026-01-16T15:13:31+00:00","mainEntityOfPage":{"@id":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/"},"wordCount":805,"commentCount":0,"image":{"@id":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/#primaryimage"},"thumbnailUrl":"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2020\/07\/SPSSStream.jpg","keywords":["How To\u2019s","SPSS","SPSS How To's"],"articleSection":["IBM"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/","url":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/","name":"How Do I Use IBM SPSS Modeler Advanced Stream Automation to Automate Analytic Workflows? - QueBIT","isPartOf":{"@id":"https:\/\/quebit.com\/askquebit\/#website"},"primaryImageOfPage":{"@id":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/#primaryimage"},"image":{"@id":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/#primaryimage"},"thumbnailUrl":"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2020\/07\/SPSSStream.jpg","datePublished":"2023-04-12T15:33:06+00:00","dateModified":"2026-01-16T15:13:31+00:00","author":{"@id":"https:\/\/quebit.com\/askquebit\/#\/schema\/person\/e52d72da0fd2f5f70d189343fe4f5084"},"breadcrumb":{"@id":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/#primaryimage","url":"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2020\/07\/SPSSStream.jpg","contentUrl":"https:\/\/quebit.com\/askquebit\/wp-content\/uploads\/2020\/07\/SPSSStream.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/quebit.com\/askquebit\/spss-modeler-advanced-stream-automation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/quebit.com\/askquebit\/"},{"@type":"ListItem","position":2,"name":"How Do I Use IBM SPSS Modeler Advanced Stream Automation to Automate Analytic Workflows?"}]},{"@type":"WebSite","@id":"https:\/\/quebit.com\/askquebit\/#website","url":"https:\/\/quebit.com\/askquebit\/","name":"QueBIT","description":"QueBIT","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/quebit.com\/askquebit\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/quebit.com\/askquebit\/#\/schema\/person\/e52d72da0fd2f5f70d189343fe4f5084","name":"agoddard","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d817b364cff1d66116debde8d1c85e5e76eeece9c5ae731b19276a6040231455?s=96&d=mm&r=g","caption":"agoddard"},"sameAs":["https:\/\/quebit.com\/askquebit"],"url":"https:\/\/quebit.com\/askquebit\/author\/agoddard\/"}]}},"_links":{"self":[{"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/posts\/3416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/comments?post=3416"}],"version-history":[{"count":2,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/posts\/3416\/revisions"}],"predecessor-version":[{"id":4949,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/posts\/3416\/revisions\/4949"}],"wp:attachment":[{"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/media?parent=3416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/categories?post=3416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/quebit.com\/askquebit\/wp-json\/wp\/v2\/tags?post=3416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}