<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Gobán Saor &#187; Python</title>
	<atom:link href="http://blog.gobansaor.com/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.gobansaor.com</link>
	<description>A country datasmith.</description>
	<lastBuildDate>Fri, 10 Feb 2012 11:24:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.gobansaor.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/67e164f5d51c2b3115a7819b84505c13?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Gobán Saor &#187; Python</title>
		<link>http://blog.gobansaor.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.gobansaor.com/osd.xml" title="Gobán Saor" />
	<atom:link rel='hub' href='http://blog.gobansaor.com/?pushpress=hub'/>
		<item>
		<title>HAMMER Alongside, as a COM Server</title>
		<link>http://blog.gobansaor.com/2011/10/07/hammer-alongside-as-a-com-server/</link>
		<comments>http://blog.gobansaor.com/2011/10/07/hammer-alongside-as-a-com-server/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 16:09:00 +0000</pubDate>
		<dc:creator>gobansaor</dc:creator>
				<category><![CDATA[ETL]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[HAMMER]]></category>
		<category><![CDATA[PowerPivot]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[.NET Com Server]]></category>
		<category><![CDATA[PowerPivot ETL]]></category>

		<guid isPermaLink="false">http://blog.gobansaor.com/?p=2242</guid>
		<description><![CDATA[Although it has always been possible to call HAMMER from within VBA via the Application.Run method, this is a somewhat clunky way of doing so and it can also be very inefficient, particularly for tight loops. But now, with this release &#8230; <a href="http://blog.gobansaor.com/2011/10/07/hammer-alongside-as-a-com-server/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=2242&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.gobansaor.com/2011/10/07/hammer-alongside-as-a-com-server/alongside_clear/" rel="attachment wp-att-2244"><img class="alignleft size-medium wp-image-2244" title="Alongside_clear" src="http://gobansaor.files.wordpress.com/2011/10/alongside_clear.png?w=225&#038;h=300" alt="" width="225" height="300" /></a>Although it has always been <a href="http://blog.gobansaor.com/2011/07/18/vba-multithreading-net-integration-via-hammer/">possible to call HAMMER from within VBA</a> via the Application.Run method, this is a somewhat clunky way of doing so and it can also be very inefficient, particularly for tight loops. But now, with this release (V 1.2.0 (Beta) ) core functionality is exposed as a COM Server, which means easier and more efficient interfacing between VBA and the .NET multi-threaded enabled world of the datasmith&#8217;s HAMMER.</p>
<p>I call this &#8220;HAMMER Alongside&#8221;, to differentiate it from <a href="http://blog.gobansaor.com/2011/08/14/hammer-inside/">HAMMER Inside</a> where I use HAMMER internals to craft stand alone XLLs. With this COM Server method, the standard HAMMER add-in (installed or just-in-time registered) is needed alongside either a VBA add-in or a VBA enabled workbook. The extra &#8220;moving parts&#8221; are easily justified by the extra flexibility that this method allows (particularly to those with a reasonable grasp of VBA, but perhaps lacking any familiarity with the .NET world).</p>
<p>By learning a small amount of IronPython (<a href="http://www.ironpython.info/index.php/Main_Page">here&#8217;s a good starting place</a>) it&#8217;s relatively easy to hook up VBA to any .NET library through HAMMER, without having to invest time and money in learning heavy duty development environments such as Visual Studio. Using <a href="http://blog.gobansaor.com/2011/06/17/hammer-and-threads/">&#8220;Internal Threads</a>, it&#8217;s also possible to take advantage of .NETs multi-threading capability from VBA. (Note: both these options require .NET4).</p>
<p>So with VBA becoming a first-class language with regards to HAMMER, why offer Python as an alternative scripting choice? Well, one reason is to offer a means to access .NET&#8217;s power as per the last paragraph. But, the primary reason, is related to the ability of HAMMER transformations to be &#8220;detached&#8221; from Excel and run via HAMMER&#8217;s command line tools. The .NET 4 version of the command line tool supports Python, so it is possible to initially build out a micro-ETL transformation within Excel (using Python to perform the business logic alongside SQL) and then transfer that logic to the command-line tools with a minimum of modification.</p>
<p>This could be useful , for example, when a PowerPivot model moves to the server, its related HAMMER-powered micro-ETL processing could do likewise (most enterprise ETL tools support call-outs to command-line processes).</p>
<p>The <a class="zem_slink" title="Component Object Model" href="http://en.wikipedia.org/wiki/Component_Object_Model" rel="wikipedia">COM server</a> can be accessed from VBA only via late-binding like so:</p>
<p style="padding-left:30px;"><span class="Apple-style-span" style="font-size:14px;line-height:23px;">Set comServ = CreateObject(&#8220;hammerCOMServerV1&#8243;)</span></p>
<p>The server&#8217;s methods are:</p>
<ul>
<li>hammer(&#8230;) &#8211; works the same way as the UDF version.</li>
<li>hammerVersion() &#8211; returns HAMMER version, again the same as UDF version.</li>
<li>hammerVersionOK(version) &#8211; e.g.  isOK= comServ.hammerVersionOK(120) will return TRUE if the current version is &gt;= V1.2.0</li>
<li>arrayResize(anArray) enables the creation of &#8220;toFit&#8221; UDFs.</li>
<li>arrayToSheet(anArray) likewise for &#8220;toSheet&#8221; UDFs.</li>
<li>arrayToRange(anArray,pasteToWhereString)<a href="http://blog.gobansaor.com/2011/10/04/hammer-on-the-range/"> enables &#8220;toRange&#8221; UDF</a>s.</li>
<li>hammer_ppRefresh_inline(optional table,optional timeout) &#8211; refreshes a PowerPivot model, again the same as its UDF equivalent.</li>
</ul>
<p><span class="Apple-style-span" style="color:#444444;font-size:14px;line-height:23px;"><a href="http://www.gobansaor.com/microetl">Download the latest version of HAMMER from here &#8230;</a></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gobansaor.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gobansaor.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gobansaor.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gobansaor.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gobansaor.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gobansaor.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gobansaor.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gobansaor.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gobansaor.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gobansaor.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gobansaor.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gobansaor.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gobansaor.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gobansaor.wordpress.com/2242/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=2242&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gobansaor.com/2011/10/07/hammer-alongside-as-a-com-server/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<georss:point>53.204039 -6.574340</georss:point>
		<geo:lat>53.204039</geo:lat>
		<geo:long>-6.574340</geo:long>
		<media:content url="http://1.gravatar.com/avatar/b714f82b5e24beb3b74779615b6ad969?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">gobansaor</media:title>
		</media:content>

		<media:content url="http://gobansaor.files.wordpress.com/2011/10/alongside_clear.png?w=225" medium="image">
			<media:title type="html">Alongside_clear</media:title>
		</media:content>
	</item>
		<item>
		<title>Exposing an Excel PowerPivot model as a Web Service</title>
		<link>http://blog.gobansaor.com/2011/09/21/exposing-an-excel-powerpivot-model-as-a-web-service/</link>
		<comments>http://blog.gobansaor.com/2011/09/21/exposing-an-excel-powerpivot-model-as-a-web-service/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 16:30:33 +0000</pubDate>
		<dc:creator>gobansaor</dc:creator>
				<category><![CDATA[DAX]]></category>
		<category><![CDATA[Denali CTP3]]></category>
		<category><![CDATA[ETL]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[HAMMER]]></category>
		<category><![CDATA[PowerPivot]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Excel ATOM ODATA]]></category>
		<category><![CDATA[IronPython]]></category>
		<category><![CDATA[ODATA]]></category>

		<guid isPermaLink="false">http://blog.gobansaor.com/?p=2170</guid>
		<description><![CDATA[In my last post I demonstrated a simple way to interrogate an Excel based PowerPivot model using either MDX,DMV or the new DAX Query Table commands. This is a great way to dig deep into a PowerPivot model, for example, this &#8230; <a href="http://blog.gobansaor.com/2011/09/21/exposing-an-excel-powerpivot-model-as-a-web-service/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=2170&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.gobansaor.com/2011/09/21/exposing-an-excel-powerpivot-model-as-a-web-service/pp_web_service/" rel="attachment wp-att-2175"><img class="alignleft size-medium wp-image-2175" title="pp_web_service" src="http://gobansaor.files.wordpress.com/2011/09/pp_web_service.png?w=300&#038;h=160" alt="" width="300" height="160" /></a>In my last post<a href="http://blog.gobansaor.com/2011/09/15/dax-table-queries-in-excel/"> I demonstrated a simple way to interrogate an Excel based PowerPivot model using either MDX,DMV or the new DAX Query Table commands</a>. This is a great way to dig deep into a PowerPivot model, for example, this new Denali DMV <em><strong>discover_calc_dependency</strong></em> can be use to  <a href="http://cwebbbi.wordpress.com/2011/09/17/documenting-dependencies-between-dax-calculations/">describe the dependencies between a model&#8217;s DAX measures</a>.</p>
<p>Being able to directly access the PowerPivot model opens up all sorts of interesting options, one such is a web service.</p>
<p>In the past I&#8217;ve written about exposing Excel as a simple DIY web service, see <a href="http://blog.gobansaor.com/2011/02/06/excel-as-a-diy-web-service/">here for a JavaScript example</a> and <a href="http://blog.gobansaor.com/2011/02/12/python-powered-powerpivot/">here for a Python version</a>. Both were capable of serving PowerPivot data but they both had to trigger events in Excel to do so.</p>
<p>With this newly discovered ability to query the model directly, I figured a third attempt at a PowerPivot Web Service was overdue.  This time I&#8217;m using the new kid on the block, HAMMER, and in particular using its in-built <a class="zem_slink" title="IronPython" href="http://ironpython.net/" rel="homepage">IronPython</a> interpreter.</p>
<p>I could have built a simple server using VB.NET or C# and added it as a HAMMER command, but the nature of a web service makes it hard to frame as a parametrised command. It was for this type of requirement that I added the ability to script using Python, i.e. situations where a generic command would always come up  short, for example:</p>
<ul>
<li>Should the service allow only local connections?</li>
<li>Should it use authentication, and if so, what type?</li>
<li>Should it allow free-format commands or offer only packaged commands?</li>
<li>Should it use HTTPListener (which is in-built and very powerful, but requires Admin privileges) or use a more basic socket based utility that can run without Admin privileges.</li>
<li>Should it block or handle asynchronous requests. (For services that access the Excel Object Model, it has to be blocking, but perhaps if the service simply accessed the AS engine, it night support multi-threaded queries? Must try it sometime.)</li>
</ul>
<p>For this example I decided to use <a href="http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx">HTTPListener </a>(in blocking mode and without authentication) and to expose services that accept free-format MDX,DMV or (if Denali) DAX Table Queries.</p>
<p>See the PPWebService workbook example in the latest (V0.5.0) version of HAMMER. To activate, make sure latest version of HAMMER is installed (or use activate button on Hammer sheet) and click the <em>Expose PowerPivot Model as Web Service</em> button (again on Hammer sheet). This will start a server on port 8070.</p>
<div>The service exposes 6 endpoints:</div>
<div>
<ul>
<li>/exit &#8211; this will shutdown the service.</li>
<li>/html &#8211; this will return data as a <a class="zem_slink" title="HTML element" href="http://en.wikipedia.org/wiki/HTML_element" rel="wikipedia">HTML table</a> (ideal for importing into Excel using a <a href="http://www.techrepublic.com/article/pull-data-into-microsoft-excel-with-web-queries/6115870">Web Query</a>).</li>
<li>/xml &#8211; this returns a &#8216;canonical&#8217; XML table (ideal for importing to Excel as an XML Map).</li>
<li>/json &#8211; returns a JSON table (as a list of lists).</li>
<li>/odata &#8211; returns a ATOM-base ODATA feed suitable for direct import into PowerPivot using its Data Feed import facility.</li>
<li>/csv &#8211; returns in CSV format.</li>
</ul>
<p>Each service (except /exit) expects to be followed by a MDX, DMV or DAX command. e.g. /html/evaluate(InvoiceHeaders). In the case of /csv an optional file name may be specified e.g. /csv/invhead.csv/evaluate(InvoiceHeaders).</p>
<p>It&#8217;s also possible to issue a POST request with the command in the message body.</p>
<p>As with all URL requests, the commands may need to be URL encoded (use the HAMMER command &#8220;_URLENCODE&#8221; if need be).</p>
<p><span class="Apple-style-span" style="font-size:13px;line-height:22px;"><strong>For the latest versions and articles on HAMMER follow the <a href="http://blog.gobansaor.com/category/hammer/" rel="nofollow">HAMMER tag</a> on my blog …</strong></span></p>
<div><strong><br />
</strong></div>
<div><strong><a href="http://bit.ly/datasmith" rel="nofollow">To download the latest version of HAMMER, use this link</a>.</strong></div>
<div><strong><br />
</strong></div>
<div><strong><a href="http://www.gobansaor.com/hammer" rel="nofollow">To see a list of commands implemented by HAMMER see here.</a></strong></div>
</div>
<div></div>
<div><a href='http://twitter.com/gobansaor' class='twitter-follow-button' data-text-color='#333333' data-link-color='#0060ff'>Follow @gobansaor</a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gobansaor.wordpress.com/2170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gobansaor.wordpress.com/2170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gobansaor.wordpress.com/2170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gobansaor.wordpress.com/2170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gobansaor.wordpress.com/2170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gobansaor.wordpress.com/2170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gobansaor.wordpress.com/2170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gobansaor.wordpress.com/2170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gobansaor.wordpress.com/2170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gobansaor.wordpress.com/2170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gobansaor.wordpress.com/2170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gobansaor.wordpress.com/2170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gobansaor.wordpress.com/2170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gobansaor.wordpress.com/2170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=2170&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gobansaor.com/2011/09/21/exposing-an-excel-powerpivot-model-as-a-web-service/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<georss:point>53.204039 -6.574340</georss:point>
		<geo:lat>53.204039</geo:lat>
		<geo:long>-6.574340</geo:long>
		<media:content url="http://1.gravatar.com/avatar/b714f82b5e24beb3b74779615b6ad969?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">gobansaor</media:title>
		</media:content>

		<media:content url="http://gobansaor.files.wordpress.com/2011/09/pp_web_service.png?w=300" medium="image">
			<media:title type="html">pp_web_service</media:title>
		</media:content>
	</item>
		<item>
		<title>VBA Multithreading, .NET integration via HAMMER</title>
		<link>http://blog.gobansaor.com/2011/07/18/vba-multithreading-net-integration-via-hammer/</link>
		<comments>http://blog.gobansaor.com/2011/07/18/vba-multithreading-net-integration-via-hammer/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 17:00:22 +0000</pubDate>
		<dc:creator>gobansaor</dc:creator>
				<category><![CDATA[excel]]></category>
		<category><![CDATA[HAMMER]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[IronPython]]></category>
		<category><![CDATA[Threads]]></category>
		<category><![CDATA[VBA .NET integration]]></category>
		<category><![CDATA[VBA Multithreaded]]></category>

		<guid isPermaLink="false">http://blog.gobansaor.com/?p=1978</guid>
		<description><![CDATA[In a previous post I urged all potential datasmiths to learn a scripting language (I suggested Python). But what of VBA, the granddaddy of the scripting world? Well yes, if you have a need to automate Excel then you must learn &#8230; <a href="http://blog.gobansaor.com/2011/07/18/vba-multithreading-net-integration-via-hammer/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1978&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.gobansaor.com/2011/07/18/vba-multithreading-net-integration-via-hammer/vbaxl/" rel="attachment wp-att-1979"><img class="alignleft size-full wp-image-1979" title="vbaXL" src="http://gobansaor.files.wordpress.com/2011/07/vbaxl.png?w=500" alt=""   /></a>In a<a href="http://blog.gobansaor.com/2011/06/29/those-with-a-datasmiths-hammer-see-every-problem-as-a-table/"> previous post</a> I urged all potential datasmiths to learn a scripting language (I suggested Python). But what of VBA, the granddaddy of the scripting world? Well yes, if you have a need to automate Excel then you must learn VBA. VBA is to Excel as JavaScript is to the modern browser, its tight integration with Excel&#8217;s Object Model and its superb debugging facilities makes it the optimal choice for automating Excel.</p>
<p>VBA is now a one trick pony (Office automation), but Python opens all sorts of API scripting and product automation doors. My use of <a class="zem_slink" title="IronPython" href="http://ironpython.net/" rel="homepage">IronPython</a> as HAMMER&#8217;s scripting language is one such door, a door to the otherwise mainly-closed-to-VBA world of multi-threading and easy .NET library integration.</p>
<p>The HAMMER function can be called from VBA using the Application.Run command like so&#8230;</p>
<p><em>retArray = Application.Run(&#8220;DATASMITH.HAMMER&#8221;,inArray,&#8221;Select dept,count(*) from table1&#8243;,&#8221;SQL&#8221;)</em></p>
<p>&#8230; the 1st parameter is the function name, parameter two is the 1st argument to the function, parameter three is the 2nd and so on.</p>
<p>By utilising HAMMER&#8217;s IronPython functionality (requires NET 4.0 runtime), VBA routines can access the full power of the <a class="zem_slink" title=".NET Framework" href="http://msdn.microsoft.com/netframework" rel="homepage">.NET platform</a> with data passed back and forth using tables. Admittedly for many complex .NET utilities utilising VB.NET or C# may be a better approach (due to better IDE and debugging features of such languages) but for standard library calls, IronPython is an ideal option. It also has the benefit that the &#8220;code&#8221; can be stored within the workbook.</p>
<p>HAMMER also offers the power of multi-threading to VBA via its<a href="http://blog.gobansaor.com/2011/06/17/hammer-and-threads/"> internal threading functionality</a> (requires Excel &gt;= 2007 and Net4.0 runtime). The multi-threading example in the hammerThreads.xlsx workbook could easily be wrapped in VBA code, perhaps to allow it to be controlled by a user-form.</p>
<p>I&#8217;ve added two new commands specially designed for use within VBA scripted HAMMER scenarios:</p>
<ul>
<li>APPDB &#8211; Opens an application-wide shared in-memory database. This will allow tables (and Python objects) created in one function call to be accessible in an other function call (assuming both issue the APPDB command as their 1st command). This replicates the functionality of microETL which by default exposes a application-wide SQLite in-memory instance and a common Python workspace.</li>
<li>CLOSEAPPDB &#8211; This will close and clear the shared c#-SQLite and IronPython instances. Equivalent of microETL&#8217;s xLiteReset() function.</li>
</ul>
<p>Be careful not to&#8230;</p>
<ul>
<li>use the APPDB instance from in-cell UDF calls to HAMMER that are likely to be scheduled as multi-threaded (the helper functions HammerToSheet &amp; HammerToFit are safe, as they are always single-threaded),</li>
<li>or use within &#8220;internal threaded&#8221; HAMMER commands</li>
</ul>
<p><span class="Apple-style-span" style="color:#444444;font-family:Georgia, 'Bitstream Charter', serif;font-size:14px;line-height:23px;">&#8230;as although c#-SQLite is thread safe, the implementation logic is not.</span></p>
<p><a href="http://www.gobansaor.com/hammer">Here’s a list of the HAMMER commands implemented so far …</a></p>
<p><a href="http://bit.ly/datasmith">You can download the latest version of HAMMER here …</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gobansaor.wordpress.com/1978/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gobansaor.wordpress.com/1978/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gobansaor.wordpress.com/1978/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gobansaor.wordpress.com/1978/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gobansaor.wordpress.com/1978/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gobansaor.wordpress.com/1978/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gobansaor.wordpress.com/1978/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gobansaor.wordpress.com/1978/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gobansaor.wordpress.com/1978/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gobansaor.wordpress.com/1978/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gobansaor.wordpress.com/1978/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gobansaor.wordpress.com/1978/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gobansaor.wordpress.com/1978/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gobansaor.wordpress.com/1978/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1978&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gobansaor.com/2011/07/18/vba-multithreading-net-integration-via-hammer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<georss:point>53.204039 -6.574340</georss:point>
		<geo:lat>53.204039</geo:lat>
		<geo:long>-6.574340</geo:long>
		<media:content url="http://1.gravatar.com/avatar/b714f82b5e24beb3b74779615b6ad969?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">gobansaor</media:title>
		</media:content>

		<media:content url="http://gobansaor.files.wordpress.com/2011/07/vbaxl.png" medium="image">
			<media:title type="html">vbaXL</media:title>
		</media:content>
	</item>
		<item>
		<title>Those with  a datasmith&#8217;s hammer, see every problem as a table.</title>
		<link>http://blog.gobansaor.com/2011/06/29/those-with-a-datasmiths-hammer-see-every-problem-as-a-table/</link>
		<comments>http://blog.gobansaor.com/2011/06/29/those-with-a-datasmiths-hammer-see-every-problem-as-a-table/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 15:50:54 +0000</pubDate>
		<dc:creator>gobansaor</dc:creator>
				<category><![CDATA[ETL]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[HAMMER]]></category>
		<category><![CDATA[microETL]]></category>
		<category><![CDATA[PowerPivot]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Extract transform load]]></category>
		<category><![CDATA[IronPython]]></category>
		<category><![CDATA[sql engine in excel]]></category>

		<guid isPermaLink="false">http://blog.gobansaor.com/?p=1916</guid>
		<description><![CDATA[I picked the name HAMMER for my new micro ETL tool to capture the spirit of how it&#8217;s intended to be used. It&#8217;s an everyday tool, sufficient for many of the tasks a datasmith faces and when not, will help &#8230; <a href="http://blog.gobansaor.com/2011/06/29/those-with-a-datasmiths-hammer-see-every-problem-as-a-table/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1916&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.gobansaor.com/2011/06/29/those-with-a-datasmiths-hammer-see-every-problem-as-a-table/hamme_and_nail_clear/" rel="attachment wp-att-1922"><img class="alignleft size-full wp-image-1922" title="hammer and nail" src="http://gobansaor.files.wordpress.com/2011/06/hamme_and_nail_clear.png?w=500" alt=""   /></a>I picked the name HAMMER for my new micro ETL tool to capture the spirit of how it&#8217;s intended to be used. It&#8217;s an everyday tool, sufficient for many of the tasks a datasmith faces and when not, will help (or at least not get in the way of) with the marshalling of data that needs to be processed by more powerful tools.</p>
<p>The saying &#8220;If you only have a <em>hammer</em>, you tend to see <em>every problem</em> as a nail<em>&#8220; </em>could be rephrased as &#8221;If you only have a datasmith&#8217;s <em>HAMMER</em>, you tend to see <em>every problem</em> as a table<em>&#8220;!. </em>But that&#8217;s OK, as nearly every commercial IT problem can be expressed as a set of tables, and in any case, HAMMER is not intended to be a datasmith&#8217;s only tool. Its close integration with Excel, recognises the prime importance of spreadsheets to most data wranglers and its use of CSV &amp; the SQLite database format as its persistence &amp; transport mechanism, (<em>à la</em> <a href="http://blog.gobansaor.com/2009/03/14/sqlite-as-the-mp3-of-data/">&#8220;SQLite as the MP3 of data</a>&#8220;) recognises that datasets will often need to be shared with other tools.</p>
<p>Finding the perfect tool for the job it an IT obsession that most of our customer&#8217;s care little for; it&#8217;s only when our choice of tool affects their bottom-line (i.e excessive cost or wasted time) that end users take much notice of the backroom technology. The most important skill for a datasmith, is the ability to understand the structures and forms that data can take and to be able to derive and build business value from that data. The technology is an aid, nothing more, technology (and indeed  applications) will come and go, data lives on.</p>
<p>HAMMER encapsulates the  minimum set of technical skills an aspiring datasmith should learn:</p>
<ul>
<li>Spreadsheets, in particular Excel. No need to know every nook and cranny, nor expect it to handle every task. But do learn about pivot tables and array formulas; if you have Excel &gt;= 2007, learn about <a href="http://msdn.microsoft.com/en-us/library/bb693324(v=office.11).aspx">Excel  tables (aka Lists)</a>. If you have Excel 2010, make sure to download <a class="zem_slink" title="PowerPivot" href="http://www.powerpivot.com/" rel="homepage">PowerPivot</a>. Become comfortable with &#8220;formula programming&#8221;, don&#8217;t expect  a ribbon command to solve every problem.</li>
<li><a href="http://blog.gobansaor.com/2008/12/18/sql-does-exactly-what-it-says-on-the-tin/">SQL</a> &#8211; learn the basics of selecting, joining and group-by; again no need to become a master; SQLite is not only an excellent way to learn SQL, it&#8217;s also a powerful tool to have once you&#8217;ve picked up the basics.</li>
<li>Learn a scripting language &#8211;  Python is one of the best and is relatively easy to learn. Again, mastery is nice, but not essential, learn the basics of IF-THEN-ELSE logic, loops and iterations, array and list handling and string manipulation.  Your efforts at coding do not have to be pretty or elegant, just functional. Python skills will also transfer across platforms, <a class="zem_slink" title="CPython" href="http://www.python.org/" rel="homepage">CPython</a> (the original and the best), <a class="zem_slink" title="IronPython" href="http://ironpython.net/" rel="homepage">IronPython</a> (.NET and HAMMER) and Jython (JVM, <a href="http://sikuli.org/">here&#8217;s an cool example of Python as a scripting language to automate GUIs</a>).</li>
</ul>
<p>All this talk of picking the right tools brings to mind the old golf pro-am story where the amateur was constantly pointing out to the pro (Jack Nicklaus I think) what club to play. At a particularly tricky shot to the green, the pro had enough when his choice of club was again “criticised”. So, he proceeded to take out every club including woods &amp; putters, placed a ball for each one and hit every ball on to the green.</p>
<p>We&#8217;re not all as talented as Jack Nicklaus, so having at least an <em>good enough</em> tool for the job at hand  is important. But it does show, that focusing on the end-game is what matters, not becoming fixated with a  particular way of doing things.</p>
<p>Enough of the moralising, and talking of being fixated on a particular tool  ;) here&#8217;s this week&#8217;s list of new features to be found in HAMMER:</p>
<h5>New commands:</h5>
<p>TXT &#8211; will load a text file such that each line is a new row in a single columned (column named &#8220;text&#8221;) table.</p>
<p>LOADDB &#8211; like OPENDB, opens the named database but only if the database file exists (OPENDB will create a new empty database if file not found). Intended primarily as end-point to request-process-response loop, see DELEGATE/SUBMIT  below.</p>
<p>SAVEDB &#8211; saves the current &#8220;main&#8221; database using the previous argument as it&#8217;s name. (shorthand for &#8230; &#8220;main&#8221;,&#8221;filename.db&#8221;,&#8221;SAVENAMEDDB&#8221;).</p>
<p>SUBMIT &#8211; same as SAVEDB, but the value of the prior argument has a &#8220;.request&#8221; appended to make a file name in the format &#8220;databasename.request&#8221; for saving to. Also, if the previous argument = &#8220;&#8221; or &#8220;{GUID}&#8221; will generated a globally unique name using  a GUID. The main use-case for this command is to send the saved database for processing by an external program, maybe a Talend or Keetle ETL job , or a HAMMER.EXE job.</p>
<p>DELEGATE &#8211; same a SUBMIT, but doesn&#8217;t do any processing (i.e. all commands other than DELEGATE, which is expected to be the last command, are ignored), instead it&#8217;ll package the request in the saved database with the expectation that an external HAMMER.EXE, or another Excel-based HAMMER call, with do the processing.</p>
<h5>Changes and helper functions to support DELEGATE/SUBMIT processing:</h5>
<p>The DELEGATE and SUBMIT commands are how HAMMER implements its version of <a href="http://blog.gobansaor.com/2011/03/16/steam-powered-powerpivot/">steam-powered servers</a>.</p>
<p>The intention is that databases named with extensions of &#8220;.request&#8221; are picked up and processed by &#8220;servers&#8221; waiting for such files. (The transport of such files between server and the served is a separate issue, might be simply a matter of placing files on a shared drives, or <a href="http://www.dropbox.com/">DropBox</a>!) Theses servers may then populate that database with new data ( or not, e.g. might generate a CSV). When finished, a text file of the same name but with the &#8220;.request&#8221; replaced by a &#8220;.response&#8221; is written to indicate that processing is complete.</p>
<p>Both the Excel udf HAMMER and HAMMER.EXE (non-excel command line version of UDF function), have been changed such that when a single argument is passed, that argument is expected to be a DELEGATE generated &#8220;.request&#8221; database. The database&#8217;s &#8220;pickled&#8221; arguments and data will then unpacked and the &#8220;delegated request&#8221; processed.</p>
<p>HAMMER.exe, if started with no arguments, implements a simple DELEGATE &#8220;server&#8221;, i.e. will wait for &#8220;.requests&#8221; files in its default folder and process each file as above.</p>
<h5>Three<a href="http://support.microsoft.com/kb/289150"> RTD helper functions</a> have been added to HAMMER udf:</h5>
<p><em>waitOnHammerResponse(database (without the .response),[folder name])</em> &#8211; will return &#8220;Waiting&#8221; until it finds a database.response file, will then return the original .request filename (i.e. not the response file as it&#8217;s simply a marker, the database.request will  contain original data and any new data generated).</p>
<p><em>waitOnHammerRequest(database (without the .request),[folder name])</em> &#8211; will return &#8220;Waiting&#8221; until it finds a database.request file, will then then return the request filename.</p>
<p><em>waitOnFile(filenaname,[folder name])</em> &#8211; like the functions above but without the response/request expectations.</p>
<p><a href="http://www.gobansaor.com/hammer">Here&#8217;s a list of the HAMMER commands implemented so far &#8230;</a></p>
<p><a href="http://bit.ly/datasmith">Get the latest version of HAMMER here &#8230;</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gobansaor.wordpress.com/1916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gobansaor.wordpress.com/1916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gobansaor.wordpress.com/1916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gobansaor.wordpress.com/1916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gobansaor.wordpress.com/1916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gobansaor.wordpress.com/1916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gobansaor.wordpress.com/1916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gobansaor.wordpress.com/1916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gobansaor.wordpress.com/1916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gobansaor.wordpress.com/1916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gobansaor.wordpress.com/1916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gobansaor.wordpress.com/1916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gobansaor.wordpress.com/1916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gobansaor.wordpress.com/1916/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1916&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gobansaor.com/2011/06/29/those-with-a-datasmiths-hammer-see-every-problem-as-a-table/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>53.204039 -6.574340</georss:point>
		<geo:lat>53.204039</geo:lat>
		<geo:long>-6.574340</geo:long>
		<media:content url="http://1.gravatar.com/avatar/b714f82b5e24beb3b74779615b6ad969?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">gobansaor</media:title>
		</media:content>

		<media:content url="http://gobansaor.files.wordpress.com/2011/06/hamme_and_nail_clear.png" medium="image">
			<media:title type="html">hammer and nail</media:title>
		</media:content>
	</item>
		<item>
		<title>Using PowerPivot to Hammer home some facts</title>
		<link>http://blog.gobansaor.com/2011/06/24/using-powerpivot-to-hammer-home-some-facts/</link>
		<comments>http://blog.gobansaor.com/2011/06/24/using-powerpivot-to-hammer-home-some-facts/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 17:47:41 +0000</pubDate>
		<dc:creator>gobansaor</dc:creator>
				<category><![CDATA[ETL]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[HAMMER]]></category>
		<category><![CDATA[microETL]]></category>
		<category><![CDATA[PowerPivot]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://blog.gobansaor.com/?p=1893</guid>
		<description><![CDATA[From my previous post&#8217;s example of a Hammer use-case, it&#8217;s obvious I primarily see Hammer (and indeed microETL) as a tool for shaping dimensional type data; i.e. relatively low volume, often very &#8216;dirty&#8217;, but very high (business) value. Fact (aka &#8230; <a href="http://blog.gobansaor.com/2011/06/24/using-powerpivot-to-hammer-home-some-facts/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1893&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.gobansaor.com/2011/06/24/using-powerpivot-to-hammer-home-some-facts/hammer-and-chisel-c/" rel="attachment wp-att-1905"><img class="alignleft size-full wp-image-1905" title="hammer-and-chisel-c" src="http://gobansaor.files.wordpress.com/2011/06/hammer-and-chisel-c.png?w=500" alt=""   /></a>From <a href="http://blog.gobansaor.com/2011/06/21/hammer-a-new-excel-etl-tool-for-the-powerpivot-age/">my previous post&#8217;s example of a Hammer use-case</a>, it&#8217;s obvious I primarily see Hammer (and indeed microETL) as a tool for shaping dimensional type data; i.e. relatively low volume, often very &#8216;dirty&#8217;, but very high (business) value.</p>
<p>Fact (aka transactional data) can of course be handled, particularly when already reduced or when by-nature low volume, such facts will in many cases fit easily in-memory.</p>
<p>But when facts start to run into the millions of records, traditional in-memory manipulation becomes a problem. Obviously such large volumes datasets should in the first instance be handled IT-side utilising tools that are designed to handle such volumes, i.e. enterprise-class databases. But sometimes data, even large transactional databases, are &#8220;thrown-over-the-wall&#8221; with limited support offered (or accepted). But again, there&#8217;s plenty of cut-down versions of enterprise RDBMS available (SQL Express, Oracle Express etc.) plus the FOSS offerings such as MySQL or PostgresSQL, that can be configured user-side to help tame these beasts.</p>
<p>If you&#8217;re using PowerPivot, you have another option, PowerPivot itself. With its ability to quickly load and compress large volumes of data and its ability to perform many data cleansing tasks by means of row-context DAX formulas, often that&#8217;s all that will be required.</p>
<p>The typical problems that a transactional dataset can throw up, such as data split over two tables (header and detail) or needing to replace a surrogate date key with an actual date (to <a href="http://mdxdax.blogspot.com/2011/01/dax-time-intelligence-functions.html">enable certain DAX date functionality to work</a>) can easily be fixed within PowerPivot.</p>
<p>One thing to note about fact data presented as a Header-Detail set, is that traditional star-schema design requires that such data be flattened to the lower &#8220;grain&#8221; of the detail line, but PowerPivot doesn&#8217;t actually require you to do that. Some dimensions can link to the header (example Customer on Invoice Header) and others to the line (example Product on Invoice Line). The detail line table is still the &#8220;hub&#8221; of the &#8220;star&#8221; but one of its dimensions (the header table) is its route to a multiple other dimensions. Not classic star schema design, but it&#8217;ll work , and good for quick and dirty analysis (might be situations though where things might not pan-out as expected <a href="http://mdxdax.blogspot.com/2011/03/logic-behind-magic-of-dax-cross-table.html">see this</a>, perhaps best stick with pure star-schemas for complex work).</p>
<p>There&#8217;ll come a time however, when you&#8217;ll be faced with the problem of manipulating large datasets outside of traditional  RDBMS servers and outside of PowerPivot. Combining sets of data from multiple sources, as in my previous post, would be a prime example. Such projects often operate on a &#8220;need-to-know-basis&#8221; often with those supplying the data &#8216;outside the loop&#8217;. Today&#8217;s additions to HAMMER should help.</p>
<p>Three new commands, ATTACHDB, ATTACHDBINMEMORY and SAVENAMEDB, will allow external disk-based databases to be attached to the default HAMMER database.</p>
<p>ATTACHDB requires a filename  followed by an alias name for the attached db. Having an attached external database would allow, for example, a large fact table in CSV format to be loaded (and indexed) without touching memory. This could also be done using the previously introduced OPENDB command, but the benefit of ATTACHDB is that other non-memory-threatening processing can continue to take place in-memory.</p>
<p>The ATTACHDBINMEMORY also attaches an external database, but this time loads it into memory, so any changes made will not be automatically persisted back to disk. To do that, use the SAVENAMEDDB command.</p>
<p>This requires an attached database alias, followed by the file name to save the database to. SAVEASNAMEDB has other uses such as making backups or making copies of data for use in an external debugging platform (it can be much easier to debug Python using a proper IDE).</p>
<p>Along side the facility to load data via CSV/TSV, I&#8217;ve also added an ADO command. This requires a valid ADO connection string, followed by either a table/view name or a SQL Select statement. <del>It uses ADODB 2.7, to enable handling of modern Access file formats, I&#8217;ll eventually make an ADO.NET version to remove this dependency.</del></p>
<p>Finally, I&#8217;ve managed to get a DBAPI compliant SQLite provider working in the PYTHON step. The provider is called XLite (it&#8217;s a modified version of J<a href="https://bitbucket.org/jdhardy/ironpython.sqlite/wiki/Home">eff Hardy&#8217;s SQLite3 library</a>) and exposes most of the same functionality as<a href="http://docs.python.org/library/sqlite3.html"> CPython&#8217;s SQlite3 provider</a>.</p>
<p>The library can open external SQLite databases, so offering another means of accessing non in-memory data and accesses the HAMMER default databases via the pre-connected pyDB variable. Having the ability to lazy-load rows via a cursor loop is also very useful in reducing memory foot-print when dealing with large tables. (see the IrelandFOIExample_hammer_test2.xlsx for an example of using XLite).</p>
<p>Update:</p>
<p>I&#8217;ve removed the dependency on a specific ADODB library (figured out how do equivalent of CreateObject in .NET for COM libraries). Also included is a first pass at a command line version (hammer.exe). Example:</p>
<p>hammer.exe mydata.csv CSV myotherdata.csv CSV JOIN &gt; new.csv</p>
<p>hammer.exe inv.csv &#8220;CSV&#8221; &#8220;sum(qty)&#8221; REDUCE sum.csv TOCSV</p>
<p><a href="http://www.gobansaor.com/hammer">Here’s a list of the HAMMER commands implemented so far …</a></p>
<p><a href="http://bit.ly/datasmith">Download  the latest version of HAMMER from here &#8230;</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gobansaor.wordpress.com/1893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gobansaor.wordpress.com/1893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gobansaor.wordpress.com/1893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gobansaor.wordpress.com/1893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gobansaor.wordpress.com/1893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gobansaor.wordpress.com/1893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gobansaor.wordpress.com/1893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gobansaor.wordpress.com/1893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gobansaor.wordpress.com/1893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gobansaor.wordpress.com/1893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gobansaor.wordpress.com/1893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gobansaor.wordpress.com/1893/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gobansaor.wordpress.com/1893/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gobansaor.wordpress.com/1893/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1893&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gobansaor.com/2011/06/24/using-powerpivot-to-hammer-home-some-facts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>53.204039 -6.574340</georss:point>
		<geo:lat>53.204039</geo:lat>
		<geo:long>-6.574340</geo:long>
		<media:content url="http://1.gravatar.com/avatar/b714f82b5e24beb3b74779615b6ad969?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">gobansaor</media:title>
		</media:content>

		<media:content url="http://gobansaor.files.wordpress.com/2011/06/hammer-and-chisel-c.png" medium="image">
			<media:title type="html">hammer-and-chisel-c</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL noSQL no Python no VBA.</title>
		<link>http://blog.gobansaor.com/2011/06/20/sql-nosql-no-python-no-vba/</link>
		<comments>http://blog.gobansaor.com/2011/06/20/sql-nosql-no-python-no-vba/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 19:13:23 +0000</pubDate>
		<dc:creator>gobansaor</dc:creator>
				<category><![CDATA[ETL]]></category>
		<category><![CDATA[HAMMER]]></category>
		<category><![CDATA[microETL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[noVBA]]></category>
		<category><![CDATA[SQLite Excel]]></category>

		<guid isPermaLink="false">http://blog.gobansaor.com/?p=1848</guid>
		<description><![CDATA[I&#8217;ve uploaded another version of HAMMER; this adds some new features and also takes some away. The removed features are Python and multi-threading support from the 2003 version of the add-in. Calling it the 2003 version isn&#8217;t entirely accurate (it&#8217;s actually called &#8230; <a href="http://blog.gobansaor.com/2011/06/20/sql-nosql-no-python-no-vba/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1848&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.gobansaor.com/2011/06/20/sql-nosql-no-python-no-vba/thor-clear/" rel="attachment wp-att-1850"><img class="alignleft size-full wp-image-1850" title="Thor-clear" src="http://gobansaor.files.wordpress.com/2011/06/thor-clear.png?w=500" alt=""   /></a>I&#8217;ve uploaded another version of HAMMER; this adds some new features and also takes some away. The removed features are Python and multi-threading support from the 2003 version of the add-in. Calling it the 2003 version isn&#8217;t entirely accurate (it&#8217;s actually called datasmith-noPython.xll) as this version will also work for Excel 2007/2010 32bit and for older versions (maybe even &#8217;97!). It should really be called the .NET 2.0 version as the features removed from this version depend on the NET 4.0 runtime (IronPython 2.7 and multi-threading). I&#8217;ll eventually build a .NET4 version for Excel 97-2003 with Python included, but this will still be missing the multi-threading features.</p>
<p>So, the version that the setup.xls will install if it detects a sub-2007 version of Excel, will offer<strong> SQL</strong> and <strong>noSQL</strong> (JOIN,UNION etc.) but <strong>no Python</strong> or <strong>multi-threading</strong>.</p>
<p>So what about new features? <a href="http://blog.gobansaor.com/2010/03/02/excel-as-a-document-oriented-nosql-database/">Excel being the original noSQL  database</a>, I continue to add more noSQL commands for those who wish to avoid SQL or find its syntax somewhat long-winded. The JOIN  &amp; LOJOIN (outer join) commands are good examples, simply load two tables with the column names that you wish to join on, sharing the same names, simple.  Another example is the REDUCE (aka GROUPBY aka DISTINCT) command I&#8217;ve added this version. It essentially performs a SELECT &#8230; FROM &#8230; GROUP BY; again load or generate a table, then follow with a list of the columns you wish to &#8216;reduce&#8217; the table by, plus any aggregates you wish to perform. Examples:</p>
<ul>
<li>=HAMMER(myHugeList,&#8221;dept,sum(overtime)&#8221;,&#8221;REDUCE&#8221;)</li>
<li>=HAMMER(AccessLogs!A1:C9999,&#8221;areaAccessed,byWhom&#8221;,&#8221;REDUCE&#8221;)</li>
<li>=HAMMER(invHead,invLine,&#8221;JOIN&#8221;,&#8221;count(invID),sum(netAmt)&#8221;,&#8221;REDUCE&#8221;)</li>
</ul>
<p><span class="Apple-style-span" style="font-size:14px;line-height:23px;">If noSQL is not your cup of tea and you wish to utilise the full power of a SQL database; a new command &#8220;OPENDB&#8221; will allow you to open an existing (or create a new) SQLite database file. This will allow SQLite data sources to be accessed and written to via standard in-cell formula, no VBA required! The command expects the previous argument to be the database name. If no such argument exists it will create a temporary on-disk database. This command usually only makes sense as the 1st command as it&#8217;ll close and wipe any previously opened databases. If no &#8220;OPENDB&#8221; command is issued (i.e. the default) an in-memory database (aka :memory:)  is used . Examples:</span></p>
<ul>
<li>=HAMMER(&#8220;C:\data\myDB.db&#8221;,&#8221;OPENDB&#8221;,A10:C:9910) will copy the data for range A10:C9910 and save in a table called table3 in the myDB.db SSQLite database.</li>
<li>=HAMMER(&#8220;C:\data\myDB.db&#8221;,&#8221;OPENDB&#8221;,&#8221;SELECT * from table3&#8243;) will fetch the same data back into Excel.</li>
</ul>
<p><span class="Apple-style-span" style="font-size:14px;line-height:23px;">Wow steady on, what if there&#8217;s a need to store or fetch data from disk without using SQLite? No problem, use the &#8220;TOCSV&#8221; command, outputs the last table loaded or generated in CSV format to the file name specified. (There&#8217;s also a &#8220;SQLTOCVS&#8221; command which expects a SQL statement to specify the data to extract followed by the file name to extract to).</span></p>
<p><span class="Apple-style-span" style="font-size:14px;line-height:23px;">Two other commands &#8220;CSV&#8221; and &#8220;TSV&#8221; will load comma and tab separated data into HAMMER.  Although the CSV functionality is useful within Excel, the main driver for these command is to enable HAMMER to work outside Excel as a command-line data processor; you heard it here first folks! </span></p>
<p><span class="Apple-style-span" style="font-size:14px;line-height:23px;">I&#8217;ve also added the 1st set of my helper functions, these two functions are only available in the 2007/2010 versions as they use multi-threading. The two functions are:</span></p>
<ul>
<li>hammerToFit &#8211; wraps HAMMER, but will auto-resize the array area (or create a brand new array-selection if none) to fit the returned table. Note: to achieve this, the HAMMER function will be called twice if the existing array area needs adjusting.</li>
<li>hammerToSheet &#8211; again wraps HAMMER, but will paste the resulting table to a new sheet.</li>
</ul>
<p><span class="Apple-style-span" style="font-size:14px;line-height:23px;">Although both helper functions utilise threads to achieve these little tricks (hence they&#8217;re not available sub-2007) when HAMMER functionality is called via these wrappers the function operates as a single threaded function &#8211; there&#8217;s a good reason for this which I&#8217;ll explain some other time.<a href="http://blog.gobansaor.com/2011/06/17/hammer-and-threads/"> Internal HAMMER threading</a> does however still work.</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://www.gobansaor.com/hammer">Here’s a list of the HAMMER commands implemented so far …</a></p>
<p><a href="http://bit.ly/datasmith">Download the latest version of HAMMER here &#8230;</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gobansaor.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gobansaor.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gobansaor.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gobansaor.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gobansaor.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gobansaor.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gobansaor.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gobansaor.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gobansaor.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gobansaor.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gobansaor.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gobansaor.wordpress.com/1848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gobansaor.wordpress.com/1848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gobansaor.wordpress.com/1848/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1848&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gobansaor.com/2011/06/20/sql-nosql-no-python-no-vba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>53.204039 -6.574340</georss:point>
		<geo:lat>53.204039</geo:lat>
		<geo:long>-6.574340</geo:long>
		<media:content url="http://1.gravatar.com/avatar/b714f82b5e24beb3b74779615b6ad969?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">gobansaor</media:title>
		</media:content>

		<media:content url="http://gobansaor.files.wordpress.com/2011/06/thor-clear.png" medium="image">
			<media:title type="html">Thor-clear</media:title>
		</media:content>
	</item>
		<item>
		<title>The Datasmith&#8217;s Hammer &#8211; 1st cut &#8230;</title>
		<link>http://blog.gobansaor.com/2011/06/13/the-datasmiths-hammer-1st-cut/</link>
		<comments>http://blog.gobansaor.com/2011/06/13/the-datasmiths-hammer-1st-cut/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 13:12:13 +0000</pubDate>
		<dc:creator>gobansaor</dc:creator>
				<category><![CDATA[ETL]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[HAMMER]]></category>
		<category><![CDATA[microETL]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.gobansaor.com/?p=1809</guid>
		<description><![CDATA[This is just a quick update to say, that having fixed the last minute bug, there&#8217;s now an initial version of the add-in available (see previous post for download link). Included is an example using the same Irish FOI request &#8230; <a href="http://blog.gobansaor.com/2011/06/13/the-datasmiths-hammer-1st-cut/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1809&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.gobansaor.com/2011/06/13/the-datasmiths-hammer-1st-cut/datasmithshammer-2/" rel="attachment wp-att-1812"><img class="alignleft size-medium wp-image-1812" title="datasmithshammer-2" src="http://gobansaor.files.wordpress.com/2011/06/datasmithshammer-2.png?w=253&#038;h=300" alt="" width="253" height="300" /></a>This is just a quick update to say, that having fixed the last minute bug, there&#8217;s now an initial version of the add-in available (see <a href="http://blog.gobansaor.com/2011/06/10/the-datasmiths-hammer/">previous post</a> for download link). Included is an example using the same Irish FOI request data as used in <a href="http://blog.gobansaor.com/2011/06/04/data-wrangler/">my Data Wrangler post</a>. Interesting to compare the speed between the <a href="http://ww.gobansaor.com/microetl">microETL</a> approach of the Data Wrangler post and the HAMMER approach. The HAMMER version is slower, which is to be expected as it&#8217;s a totally .NET managed solution, while microETL relies mainly on C based libraries to do the heavy lifting; internally HAMMER also makes far more copies of the data compared to microETL. But, on a fast machine (i.e  no shortage of RAM or spare CPU power) the HAMMER&#8217;s response is very acceptable, and that&#8217;s the environment that HAMMER is aimed at that; in other words don&#8217;t try this on your 128K Windows 2000 machine <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gobansaor.wordpress.com/1809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gobansaor.wordpress.com/1809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gobansaor.wordpress.com/1809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gobansaor.wordpress.com/1809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gobansaor.wordpress.com/1809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gobansaor.wordpress.com/1809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gobansaor.wordpress.com/1809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gobansaor.wordpress.com/1809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gobansaor.wordpress.com/1809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gobansaor.wordpress.com/1809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gobansaor.wordpress.com/1809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gobansaor.wordpress.com/1809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gobansaor.wordpress.com/1809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gobansaor.wordpress.com/1809/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1809&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gobansaor.com/2011/06/13/the-datasmiths-hammer-1st-cut/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>53.204039 -6.574340</georss:point>
		<geo:lat>53.204039</geo:lat>
		<geo:long>-6.574340</geo:long>
		<media:content url="http://1.gravatar.com/avatar/b714f82b5e24beb3b74779615b6ad969?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">gobansaor</media:title>
		</media:content>

		<media:content url="http://gobansaor.files.wordpress.com/2011/06/datasmithshammer-2.png?w=253" medium="image">
			<media:title type="html">datasmithshammer-2</media:title>
		</media:content>
	</item>
		<item>
		<title>The Datasmith&#8217;s Hammer</title>
		<link>http://blog.gobansaor.com/2011/06/10/the-datasmiths-hammer/</link>
		<comments>http://blog.gobansaor.com/2011/06/10/the-datasmiths-hammer/#comments</comments>
		<pubDate>Fri, 10 Jun 2011 17:47:38 +0000</pubDate>
		<dc:creator>gobansaor</dc:creator>
				<category><![CDATA[ETL]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[HAMMER]]></category>
		<category><![CDATA[microETL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[Excel MapReduce]]></category>
		<category><![CDATA[IronPython Excel]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.gobansaor.com/?p=1782</guid>
		<description><![CDATA[Although my microETL add-in is very powerful, it can be a bit intimidating for those without a programming background. It was after all, designed for my needs primarily and being a professional programmer I tend to see the world from that perspective. &#8230; <a href="http://blog.gobansaor.com/2011/06/10/the-datasmiths-hammer/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1782&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.gobansaor.com/2011/06/10/the-datasmiths-hammer/datasmithhammer/" rel="attachment wp-att-1788"><img class="alignleft size-full wp-image-1788" title="datasmithhammer" src="http://gobansaor.files.wordpress.com/2011/06/datasmithhammer.png?w=500" alt=""   /></a>Although my <a href="http://www.gobansaor.com/microetl">microETL</a> add-in is very powerful, it can be a bit intimidating for those without a programming background. It was after all, designed for my needs primarily and being a professional programmer I tend to see the world from that perspective. Hence microETL&#8217;s ability to forge vast and complex datasets in parallel to those of Excel; to share those datasets not just with Excel and VBA but also with the powerful tool that is <a class="zem_slink" title="CPython" href="http://en.wikipedia.org/wiki/CPython" rel="wikipedia">CPython</a>. But microETLs genesis was not as an all-powerful ETL tool but as means to quickly and accurately handle tabular data in Excel. The original xLite (which begat microETL) started out with just two functions, Join two tables or Left Outer Join two tables. That was it, but it was still useful.</p>
<p>I&#8217;ve been intending for some time to build an offshoot of microETL that would be less powerful but perhaps more approachable and have fewer moving parts. This week I finished it, still needs some more testing, but the basic product is in place. It&#8217;s a single file add-in (a .xll) , called DATASMITH. At its heart is a single function called HAMMER, there will be other helper functions that in the main will wrap the HAMMER function, but in essence it is the datasmith&#8217;s HAMMER.</p>
<p>If microETL is a datasmith&#8217;s forge or indeed a mirco-foundry,HAMMER is a datasmith&#8217;s everyday portable tool (with perhaps Excel as the anvil, and your CPUs as the fire?). Talking of CPUs; multi-core CPUs are now the norm and since version 2007, Excel can utilise such multi-cores. MicroETL being VBA-based cannot however take advantage of this, to do so requires an .xll add-in; another reason to build the HAMMER.</p>
<p>So what will this new functionality look like:</p>
<h4>Examples:</h4>
<p>=<strong>HAMMER(Invoices[#All],InvoiceLine[#All],&#8221;JOIN&#8221;)</strong></p>
<p>&#8230;will take the two ranges (you need the [#All] to pick-up the header and data sections of a 2007/2010 Excel Table) and join them using the columns with the same name as the join fields. The JOIN command expects the last two preceding arguments to be tables (aka arrays with a header line).</p>
<p>=<strong>HAMMER(&#8220;SALES&#8221;,DeptSales!A1:F2101,&#8221;SELECT * from table2 where dept=&#8217;:1&#8242;&#8221;,&#8221;SQL&#8221;)</strong></p>
<p>&#8230; the 1st argument is loaded as Arg(1) (:1 in SQL), the 2nd argument is loaded (being an array) into a table named<em> table2</em>; if they were the other way round, it would be<em> table1</em> and Arg(2). The 3rd argument is loaded as Arg(3) and the 4th is a command: SQL. SQL looks back at the preceding argument (Arg(3) in this case) and executes its contents as SQLite SQL. If the preceding argument was a table, it would expect to find a list of SQL statements for execution in the first column. The output of the last issued SELECT statement is then returned to Excel as an array.</p>
<p>=<strong>HAMMER(DeptTargets!A1:D20,DeptSales!A1:F2101,SalesTagetScript,&#8221;PYTHON&#8221;)</strong></p>
<p>&#8230;this is similar to the previous SQL example but this time the command is PYTHON which will execute the Python Script passed in via the command&#8217;s preceding argument. The script will most likely return a table to Excel, but it could also, if not the last argument, create a table associated with its position, in this case <em>table4</em>, which could then be accessed by subsequent PYTHON or SQL scripts.</p>
<p>Up to 25 arguments can be passed, the last table produced is returned to Excel (either via a load, which wouldn&#8217;t be terribly useful, or more likely as a result of a command such as JOIN, SQL or PYTHON). HAMMER functions can of course be nested and can also issue <a href="http://blog.gobansaor.com/2011/06/17/hammer-and-threads/">&#8220;internal&#8221; HAMMER requests</a>. The &#8220;flow&#8221; of commands is from left to right, with the preceding args usually setting the stage for subsequent commands. Alongside the all-powerful SQL and PYTHON commands, I&#8217;ll most likely add a set of &#8220;noSQL&#8221; offerings such as JOIN, LOJOIN (left-outer), DISTINCT, REDUCE (a SELECT .. GROUP BY&#8230; with PYTHON as the MAP?), UNION, INTERSECT. These will likely also be available through helper functions such as =JOIN(ThisTable,ThatTable).</p>
<p>Unlike microETL, there&#8217;s no persistence across function calls i.e. HAMMER will play by Excel&#8217;s Functions <strong><em>no-side-effects</em></strong> rule. Each call to a function will build up and tear down its in-memory SQLite environment (including calls to HAMMER from within PYTHON).(UPDATE: Specify the 1st COMMAND as &#8220;APPDB&#8221; to simulate microETL&#8217;s persistence across function calls) <del> Likewise each call to PYTHON will be a separate engine instance</del>. Likewise each call to a HAMMER function will create its own PYTHON engine. Tables  and Python artefacts created by prior &#8220;steps&#8221; in a single HAMMER call are available to subsequent steps.</p>
<p>HAMMER embeds Python under the guise of <a class="zem_slink" title="IronPython" href="http://ironpython.net/" rel="homepage">IronPython</a>, so a lot of the power and speed of CPython will not be available, but on the other hand, the full power of the .NET CLR will be, not a bad swap.</p>
<p>And a huge advantage, HAMMER will be an asynchronous function (i.e. will run in its own thread). This will allow multiple long running transforms to be handled within the same Excel instance, a major shortcoming of microETL. This requires Excel 2007 or 2010, but will still work synchronously for Excel 97-2003. Having said that, there&#8217;s a requirement for Net4.o for IronPython so this add-in is more suited for modern versions of Excel and for OS &gt;= XP SP3.</p>
<p>HAMMER is <a href="http://office.microsoft.com/en-us/excel-help/introducing-array-formulas-in-excel-HA001087290.aspx">an array function</a>, yeah I know, normal folk tend to steer clear of Excel arrays. Which is to be expected, they&#8217;re not the most intuitive end-user-facing construct that the industry has ever come up with. But, they are the &#8220;Excel way&#8221; for passing tables in and out of formulas and, once mastered, open up a new world of power to Excel users. I will be adding helper functions to make using arrays a bit easier (an autoSize wrapper function, that&#8217;ll resize the selection area if it&#8217;s too small or too big, at the cost of a 2nd pass at the enclosed functions, might also port microETL&#8217;s SQL &#8220;paste&#8221; functionality).</p>
<p><del>I had intended to have an example to download with this post, but have discovered a last-minute bug that needs fixing. So it&#8217;ll be most likely next week before I&#8217;ve a version to show.</del></p>
<p>UPDATE:</p>
<p>I&#8217;ve managed to sort out the bug, so here&#8217;s an example&#8230;</p>
<p><a href="http://bit.ly/datasmith">http://bit.ly/datasmith</a></p>
<p><a href="http://www.gobansaor.com/hammer">Here’s a list of the HAMMER commands implemented so far …</a></p>
<p>Use setup.xls to install (or simply open in Excel), see IrelandFOIexample_hammer (2007/2010) for examples (there&#8217;s also a copy of the same functionality via microETL in IrelandFOIexample_microETL.xls &#8211; note the speed difference).  There&#8217;s Excel 2007/2010 32bit and  Excel 2010 64bit versions included and there&#8217;s also an un-tested 2003 version.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gobansaor.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gobansaor.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gobansaor.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gobansaor.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gobansaor.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gobansaor.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gobansaor.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gobansaor.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gobansaor.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gobansaor.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gobansaor.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gobansaor.wordpress.com/1782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gobansaor.wordpress.com/1782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gobansaor.wordpress.com/1782/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1782&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gobansaor.com/2011/06/10/the-datasmiths-hammer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<georss:point>53.204039 -6.574340</georss:point>
		<geo:lat>53.204039</geo:lat>
		<geo:long>-6.574340</geo:long>
		<media:content url="http://1.gravatar.com/avatar/b714f82b5e24beb3b74779615b6ad969?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">gobansaor</media:title>
		</media:content>

		<media:content url="http://gobansaor.files.wordpress.com/2011/06/datasmithhammer.png" medium="image">
			<media:title type="html">datasmithhammer</media:title>
		</media:content>
	</item>
		<item>
		<title>Data Wrangler</title>
		<link>http://blog.gobansaor.com/2011/06/04/data-wrangler/</link>
		<comments>http://blog.gobansaor.com/2011/06/04/data-wrangler/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 13:57:29 +0000</pubDate>
		<dc:creator>gobansaor</dc:creator>
				<category><![CDATA[ETL]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[Ireland]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[microETL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[data wrangler]]></category>

		<guid isPermaLink="false">http://blog.gobansaor.com/?p=1754</guid>
		<description><![CDATA[A few weeks ago I came across (thanks to @lismiss) Data Wrangler; a very promising data cleansing tool from the Stanford Visualization Group. Not only is Data Wrangler a web-service (which the group intend to open source) but it also allows transformations to &#8230; <a href="http://blog.gobansaor.com/2011/06/04/data-wrangler/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1754&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.gobansaor.com/2011/06/04/data-wrangler/data-wrangler/" rel="attachment wp-att-1755"><img class="alignleft size-full wp-image-1755" title="data-wrangler" src="http://gobansaor.files.wordpress.com/2011/06/data-wrangler.jpg?w=500" alt=""   /></a>A few weeks ago I came across (thanks to <a href="http://www.twitter.com/lismiss">@lismiss</a>) <a href="http://vis.stanford.edu/wrangler/">Data Wrangler</a>; a very promising data cleansing tool from the <a href="http://vis.stanford.edu/">Stanford Visualization Group</a>. Not only is Data Wrangler a web-service (which the group intend to open source) but it also allows transformations to be &#8220;recorded&#8221; in either Python or JavaScript (<a href="http://vis.stanford.edu/wrangler/blog/2/">see here</a>). It was this Python scripting feature that really caught my attention; would be very useful to be able to hack away at a dataset using the service, then transfer the script to microETL&#8217;s PyScript to adjust and integrate with Excel and SQL.</p>
<p>The demo video and test datasets give a good overview of the tool but the proof of the pudding is in trying out some real world dirty data; I chose a fine example of the art of Freedom Of Information datasets, issued by a Republic of Ireland government department. As an example of how not to do something (unless your intention is to make the recipient regret asking for the FOI in the first place) this is excellent. (I suppose we should be grateful it&#8217;s in Excel not Word or PDF or even PowerPoint). You can download it here <a href="http://bit.ly/Ireland_FOI_example" target="_blank">http://bit.ly/Ireland_FOI_example</a> (the data as released is in the FOI sheet).</p>
<p>As I said, Data Wrangler is promising, but needs some more work (to be fair, the group warns it&#8217;s a work in progress). The tool choked on the FOI dataset, too many columns I think, so not ready for the real world yet but I&#8217;ll be keeping an eye on its progress. Don&#8217;t let my experience put you off, it looks more than capable of handling smaller but still quite messy datasets.</p>
<p>If you&#8217;ve downloaded my example workbook, you&#8217;ll see how I managed to cleanse the data using <a href="http://www.gobansaor.com/microetl">microETL&#8217;s</a> Python &amp; SQL scripting functionality (the PyScript is in the Python sheet, with the SQLScript in the Control sheet). I could have cleansed the data using pure Excel and some VBA  and perhaps I would have if this was a format requiring parsing on a regular basis; I could then save the transformation as a single file macro-enabled workbook, ideal for sharing, no need for add-ins etc. But it was a once-off, and even if it wasn&#8217;t, it&#8217;s quite likely the format supplied in answer to a subsequent FOI request would be different. This is the sort of work that microETL&#8217;s Python &amp; SQL scripting is designed for; quick and dirty data wrangling, but with the ability ro persist, and modify the resulting transformations if so required.</p>
<p>If you wish to try out this example, there&#8217;s<a href="http://bit.ly/microetl_latest"> a new version of microETL (Alpha1.08) available for download</a>. You&#8217;ll notice a new folder structure (the usual sub-folders are now under a single sub-folder call microETL) to make installation of the add-in somewhat neater; and there&#8217;s also a setup.xls that&#8217;ll do all the hard work of installing (and un-installing) the microETL add-in. Note: you still need to manually install Python 2.7 to enable the PyScript&#8217;ing functionality.</p>
<p style="text-align:left;padding-left:30px;"><a href="http://www.gobansaor.com?dw-post" target="_blank">If you need help with your Excel, ETL or  data cleansing tasks, I can help</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gobansaor.wordpress.com/1754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gobansaor.wordpress.com/1754/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gobansaor.wordpress.com/1754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gobansaor.wordpress.com/1754/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gobansaor.wordpress.com/1754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gobansaor.wordpress.com/1754/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gobansaor.wordpress.com/1754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gobansaor.wordpress.com/1754/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gobansaor.wordpress.com/1754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gobansaor.wordpress.com/1754/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gobansaor.wordpress.com/1754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gobansaor.wordpress.com/1754/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gobansaor.wordpress.com/1754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gobansaor.wordpress.com/1754/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1754&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gobansaor.com/2011/06/04/data-wrangler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<georss:point>53.204039 -6.574340</georss:point>
		<geo:lat>53.204039</geo:lat>
		<geo:long>-6.574340</geo:long>
		<media:content url="http://1.gravatar.com/avatar/b714f82b5e24beb3b74779615b6ad969?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">gobansaor</media:title>
		</media:content>

		<media:content url="http://gobansaor.files.wordpress.com/2011/06/data-wrangler.jpg" medium="image">
			<media:title type="html">data-wrangler</media:title>
		</media:content>
	</item>
		<item>
		<title>S3 as an Excel hub</title>
		<link>http://blog.gobansaor.com/2011/03/30/s3-as-an-excel-hub/</link>
		<comments>http://blog.gobansaor.com/2011/03/30/s3-as-an-excel-hub/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 16:11:08 +0000</pubDate>
		<dc:creator>gobansaor</dc:creator>
				<category><![CDATA[cloud]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[ETL]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[xlAWS]]></category>
		<category><![CDATA[AWS IAM]]></category>
		<category><![CDATA[boto]]></category>

		<guid isPermaLink="false">http://blog.gobansaor.com/?p=1497</guid>
		<description><![CDATA[In my Steam Powered PowerPivot post I explained the concept of powered-spoke based Excel systems. One of the hub options was Amazon&#8217;s Simple Storage Service, S3. I&#8217;ve been using S3 both as a simple backup service and as a &#8220;systems &#8230; <a href="http://blog.gobansaor.com/2011/03/30/s3-as-an-excel-hub/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1497&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://gobansaor.files.wordpress.com/2011/03/amazons3_bucket.jpg"><img class="alignleft size-medium wp-image-1500" title="amazons3_bucket" src="http://gobansaor.files.wordpress.com/2011/03/amazons3_bucket.jpg?w=300&#038;h=216" alt="" width="300" height="216" /></a>In my <a href="http://blog.gobansaor.com/2011/03/16/steam-powered-powerpivot/">Steam Powered PowerPivo</a>t post I explained the concept of powered-spoke based Excel systems. One of the hub options was <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/gsg/?ref=get-started">Amazon&#8217;s Simple Storage Service, S3</a>. I&#8217;ve been using S3 both as a simple backup service and as a &#8220;systems hub&#8221; since the service began in 2006. Back then, it was not necessarily the easiest to use or the most suitable, but it was cheap and reliable. The code I used to access S3 from Excel can be found here <a href="http://blog.gobansaor.com/2008/02/22/xlaws-excel-vba-code-for-accessing-amazons-s3-and-simpledb/">http://blog.gobansaor.com/2008/02/22/xlaws-excel-vba-code-for-accessing-amazons-s3-and-simpledb/</a></p>
<p>Over the years, lots of new features have been added to S3 that have made the service more useful and easier. The final big missing, for me at least, was the lack of multiple  authorisation credentials  for a single account i.e. the ability to set-up multiple users with their own access policies. Last year, with the launch of <a href="http://aws.amazon.com/iam/">IAM (Identity &amp; Access Management) Service</a>, that last major problem was removed.</p>
<p>Although currently IAM is accessible only by the API that&#8217;s not a problem as my favourite tool for managing S3 (and AWS in general) is Python&#8217;s boto package, and it has <a href="http://www.elastician.com/2010/09/using-identity-access-management-iam.html">that, and everything else you might wish to do S3 -wise, covered</a>.<a href="http://blog.gobansaor.com/2008/02/22/xlaws-excel-vba-code-for-accessing-amazons-s3-and-simpledb/"></a></p>
<p>Although Boto does most of my heavy lifting (particularly on the server-side), I still have need for a VBA based S3 utility. Boto is fine for situations where I&#8217;m using microETL with Python enabled, but in many situations this is not ideal or even possible, particularly on the client-side of systems. Here, even a single file add-in may not be possible which often means a macro-enabled workbook is the only option.</p>
<p>MicroETL has a noSQL compile option which enables a lot of the code to operate without the SQLite libraries, thus allowing it to be used as a single-file VBA add-in or embedded in a workbook.</p>
<p>Up until now my S3 code depended on the xliteSha1Hmac.dll to provide SHA1-HMAC hashing (necessary to authorise access to S3) meaning that only pre-signed S3 URLS could be used in single-file deliverables. Even if this was not the case, prior to IAM, pre-signed URLs (usually with time limits) were often the only option as sharing an S3 account&#8217;s single authorisation credentials with all and sundry was not ideal from a security point of view. But post IAM, being able to set-up sub-accounts with specific access policies means the full power of S3 can now be used at client-level.</p>
<p>I&#8217;m in the process of adding a pure VBA HMAC-SHA1 facility (32 bit only at the moment, 64 bit continues to require the xliteSha1Hmac.dll). I&#8217;m also adding a JSON encode/decode module to allow tables to be more easily shared with non-Excel programs, currently I default to using tables encoded using ADO&#8217;s export XML schema to share via S3, but the JSON option will make it easier to share with a pure Python server (such as a PiClound based service, see my <a href="http://blog.gobansaor.com/2011/03/27/expand-excels-horizons-look-to-the-cloud/">Expand Excel&#8217;s Horizons &#8211; look to the cloud</a> post).</p>
<p>Cloud-shared tables can not only pass datasets back and forth but can pass <a href="http://blog.gobansaor.com/2011/03/04/sqlscript-microetls-sql-sequencer-utility/">SQLScripts</a> (which are, after all, simply tables) for processing elsewhere.</p>
<p>For example, client workbooks not having Python  (or SQLite ) functionality installed could write a script, post it to S3; that script table could then be picked up by a &#8220;server&#8221; microETL workbook (or by a pure Python server), executed, and the results posted back to S3 to be picked up by the client (possibly waiting a response using a <a href="http://blog.gobansaor.com/2011/03/27/expand-excels-horizons-look-to-the-cloud/">TIMER</a>).</p>
<p>Server processes could also do the opposite; passing down SQLScripts for client-side execution.</p>
<p>When people think of utilising the cloud, this sort of scenario is not what comes to mind, thinking that Excel is a desktop product so it cannot take advantage of the enormous cost-advantages of cloud-based solutions. Not so, it&#8217;s now very easy to integrate the likes of S3 into existing processes, adding that cloud magic but keeping those existing <em>works-so-don&#8217;t-fix-it</em> processes firmly on the ground.</p>
<p>If you need help figuring out how to take advantage of S3 (or other AWS services) and how to integrate them with your existing technology base <a href="http://blog.gobansaor.com/contact/">do contact me</a>. I&#8217;ve been working with this technology for over 5 years (and have 30 odd years of experience with good-old reliable &#8220;ground-based systems&#8221;,</p>
<h6><em>What&#8217;s with the bucket picture? S3 calls its primary data storage unit a bucket.</em></h6>
<p>UPDATE:</p>
<p><em>IAM is now available from the AWS Management Console <a href="http://aws.typepad.com/aws/2011/05/identity-and-access-management-console-support.html">http://aws.typepad.com/aws/2011/05/identity-and-access-management-console-support.html</a></em></p>
<p><em><br />
</em></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gobansaor.wordpress.com/1497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gobansaor.wordpress.com/1497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gobansaor.wordpress.com/1497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gobansaor.wordpress.com/1497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gobansaor.wordpress.com/1497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gobansaor.wordpress.com/1497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gobansaor.wordpress.com/1497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gobansaor.wordpress.com/1497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gobansaor.wordpress.com/1497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gobansaor.wordpress.com/1497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gobansaor.wordpress.com/1497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gobansaor.wordpress.com/1497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gobansaor.wordpress.com/1497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gobansaor.wordpress.com/1497/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gobansaor.com&amp;blog=110633&amp;post=1497&amp;subd=gobansaor&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gobansaor.com/2011/03/30/s3-as-an-excel-hub/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<georss:point>53.204039 -6.574340</georss:point>
		<geo:lat>53.204039</geo:lat>
		<geo:long>-6.574340</geo:long>
		<media:content url="http://1.gravatar.com/avatar/b714f82b5e24beb3b74779615b6ad969?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">gobansaor</media:title>
		</media:content>

		<media:content url="http://gobansaor.files.wordpress.com/2011/03/amazons3_bucket.jpg?w=300" medium="image">
			<media:title type="html">amazons3_bucket</media:title>
		</media:content>
	</item>
	</channel>
</rss>
