<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Doug Eisenstein on Medium]]></title>
        <description><![CDATA[Stories by Doug Eisenstein on Medium]]></description>
        <link>https://medium.com/@doug.eisenstein?source=rss-1dd716fd0395------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4K3FxqcANzKWfcFHfaczNw@2x.jpeg</url>
            <title>Stories by Doug Eisenstein on Medium</title>
            <link>https://medium.com/@doug.eisenstein?source=rss-1dd716fd0395------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 07:07:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@doug.eisenstein/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Web3 Greenfield and the Future of Financial Market Data]]></title>
            <link>https://medium.com/@doug.eisenstein/web3-greenfield-and-the-future-of-financial-market-data-de1a3880c61f?source=rss-1dd716fd0395------2</link>
            <guid isPermaLink="false">https://medium.com/p/de1a3880c61f</guid>
            <category><![CDATA[market-data]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[decentralized-finance]]></category>
            <dc:creator><![CDATA[Doug Eisenstein]]></dc:creator>
            <pubDate>Sun, 05 Feb 2023 14:21:41 GMT</pubDate>
            <atom:updated>2023-02-05T14:21:41.133Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*biW-da_vfXdbQ9edlfTOqA.png" /><figcaption>Web3 Greenfield and Financial Market Data</figcaption></figure><h3>What is Financial Market Data?</h3><p>The financial market data industry has been around for decades.</p><p>The landscape consists primarily of: data producers, data aggregators, data providers, data vendors, and data exchanges.</p><p>They provide data like price or volume for a particular stock, foreign exchange rate, or other kinds of information, to various industries like hedge funds, asset managers, or investment banks.</p><p>However, the industry has its own set of problems, including a lengthy and complex buying process, data inaccuracies, and strict license restrictions.</p><h3>What is BNB Greenfield?</h3><p><a href="https://www.bnbchain.org/en/greenfield">BNB Greenfield</a> is a blockchain ₿ platform, built by Binance, designed as a decentralized data storage infrastructure, where users and dApps can create, store and exchange data.</p><p>It’s a quite a novel take on the blockchain, and I think it’s a matter of time until we start using it to address many of the systemic problems we see across the financial market data industry…</p><h3>Possible Use Cases</h3><p>Here’s how BNB Greenfield could solve some of the biggest problems in the financial market data industry:</p><h4>Easing the buying process</h4><p>Currently, buying market data at a financial company can take weeks or months due to the complex process. It’s possible with a decentralized platform that data retrieved in real-time and a smart contract can be used to make the purchase once the data is deemed useful.</p><h4>Reducing data inaccuracies</h4><p>Data providers often release data with errors, compromising its reliability. The blockchain is secure, immutable, and tamper-proof, reducing the risk of data inaccuracies and possible tampering.</p><h4>Increasing data accessibility</h4><p>Data license restrictions limit access to only authorized parties, making it difficult for others to access the data they need. Greenfield aims to bring freedom to how assets and valuable things are owned, exchanged, and transferred, making financial data more accessible to a wider audience.</p><h3>Reading Up</h3><p>For those interested in DeFi and Web3, BNB Greenfield is definitely worth exploring.</p><p>The recently released <a href="https://github.com/bnb-chain/greenfield-whitepaper/blob/main/overview.md">Greenfield White Paper</a> offers a comprehensive overview of the platform and its potential impact on the financial market data industry.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de1a3880c61f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Integrate PySpark, Snowflake, Azure, and Jupyter: Part 3]]></title>
            <link>https://medium.com/@doug.eisenstein/how-to-integrate-pyspark-snowflake-azure-and-jupyter-part-3-d9710cd4a46c?source=rss-1dd716fd0395------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9710cd4a46c</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Doug Eisenstein]]></dc:creator>
            <pubDate>Fri, 05 Jun 2020 13:28:35 GMT</pubDate>
            <atom:updated>2021-11-04T16:40:09.295Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Connect PySpark to Snowflake ❄️</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T6vxKytjgHVRTVISUvUv0Q.png" /></figure><h3>Background</h3><p><em>In part three of this three-part series, in </em><a href="https://medium.com/@doug.eisenstein/how-to-integrate-pyspark-snowflake-azure-and-jupyter-part-1-50595928ab8b"><em>Part 1</em></a><em> we learned about PySpark, Snowflake, Azure, and Jupyter Notebook, then in </em><a href="https://medium.com/@doug.eisenstein/how-to-integrate-pyspark-snowflake-azure-and-jupyter-part-2-14bbdda27359"><em>Part 2</em></a><em> we launched a PySpark cluster in Azure on HDInsight. In part three, we’ll learn how to connect to a Snowflake instance from PySpark an run a few exploratory queries to get you acclimated.</em></p><h3>Step 1: Get me some data!</h3><p>Snowflake provides a TPC-H <a href="https://docs.snowflake.com/en/user-guide/sample-data-tpch.html">dataset</a> that we’ll use for some exploration. Let’s copy it into a separate database by running a <a href="https://docs.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/sql-data-warehouse-develop-ctas">CTAS</a>:</p><pre>create table TPCH_SF10000_ORDERS as (select * from &quot;SNOWFLAKE_SAMPLE_DATA&quot;.&quot;TPCH_SF10000&quot;.&quot;ORDERS&quot;);</pre><h3>Step 2: Connect PySpark to Snowflake</h3><p>It’s wicked easy to connect from PySpark to Snowflake. There is one ❗️warning, and it’s that the versions must be 100% compatible. Please use the versions I’ve used here as a starting point.</p><p>Fire open Jupyter Notebook. Let’s import the Snowflake Connector:</p><pre>%%configure -f<br>{ &quot;conf&quot;: {<br>    &quot;spark.jars.packages&quot;: &quot;net.snowflake:spark-snowflake_2.11:2.5.1-spark_2.3&quot;}<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUKWpAXIZbu8L5eQmqeYvQ.png" /></figure><p>Create a Spark Session:</p><pre>from pyspark.sql import SparkSession</pre><pre>spark = (<br>    SparkSession.builder<br>    .appName(&#39;quickstart&#39;)<br>    .getOrCreate()<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x8tT2Xex_UK6vNExO8tUKw.png" /></figure><p>Enable Snowflake <a href="https://docs.snowflake.com/en/user-guide/spark-connector-use.html#pushdown">pushdown</a>, my 💛:</p><pre>spark._jvm.net.snowflake.spark.snowflake.SnowflakeConnectorUtils.enablePushdownSession(spark._jvm.org.apache.spark.sql.SparkSession.builder().getOrCreate())</pre><p>Now let’s enter our connection details. I’ve used environment variables, with defaults.</p><pre>import os</pre><pre>SNOWFLAKE_SOURCE_NAME = &quot;net.snowflake.spark.snowflake&quot;</pre><pre>SNOWFLAKE_OPTIONS = {<br>    &#39;sfURL&#39;: os.environ.get(&quot;SNOWFLAKE_URL&quot;, &quot;xz88991.east-us-2.azure.snowflakecomputing.com&quot;),<br>    &#39;sfAccount&#39;: os.environ.get(&quot;SNOWFLAKE_ACCOUNT&quot;, &quot;xz88991&quot;),<br>    &#39;sfUser&#39;: os.environ.get(&quot;SNOWFLAKE_USER&quot;, &quot;dougeisenstein&quot;),<br>    &#39;sfPassword&#39;: os.environ.get(&quot;SNOWFLAKE_PASSWORD&quot;, &quot;eA@!$W7%Z&quot;),<br>    &#39;sfDatabase&#39;: os.environ.get(&quot;SNOWFLAKE_DATABASE&quot;, &quot;QUICKSTART&quot;),<br>    &#39;sfSchema&#39;: os.environ.get(&quot;SNOWFLAKE_SCHEMA&quot;, &quot;TPCH_SF100&quot;),<br>    &#39;sfWarehouse&#39;: os.environ.get(&quot;SNOWFLAKE_WAREHOUSE&quot;, &quot;COMPUTE_WH_LARGE&quot;),<br>    &#39;sfRole&#39;:  os.environ.get(&quot;SNOWFLAKE_ROLE&quot;, &quot;accountadmin&quot;)<br>    }</pre><p>🥁 drum roll please, let’s get some data into a Spark frame:</p><pre>data_frame = spark.read.format(SNOWFLAKE_SOURCE_NAME) \<br>    .options(**SNOWFLAKE_OPTIONS) \<br>    .option(&#39;dbtable&#39;, &quot;ORDERS&quot;) \<br>    .load()</pre><p>Let’s show the first 5 rows:</p><pre>data_frame.show(5)</pre><p>You’ll see a beautiful data set like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L79U7uflLjNxN-VWyJMFRQ.png" /></figure><h3>Step 3: Let’s explore the push-down</h3><p>Many years ago, in a galaxy, far, far, away, when <a href="https://en.wikipedia.org/wiki/Massively_parallel">MPP</a> systems were coming to market, I worked on <a href="https://en.wikipedia.org/wiki/Netezza">Netezza</a> and <a href="https://en.wikipedia.org/wiki/Greenplum">Greenplum</a>, anyone remember those? These companies, and Snowflake, understand that performing the analytics, closest to the data, gives you the best performance, and that’s what I love about the analytical function push-down.</p><p>Let’s first take that that feature out for a spin. We’re going to run a group by and count function. The query below gets the count of orders across all customers by order date and then orders the result set in descending order.</p><pre>data_frame = spark.read.format(SNOWFLAKE_SOURCE_NAME) \<br>    .options(**SNOWFLAKE_OPTIONS) \<br>    .option(&#39;query&#39;, &quot;select o_orderdate, count(*) from TPCH_SF10000_ORDERS group by o_orderdate order by o_orderdate desc&quot;) \<br>    .option(&#39;partition_size_in_mb&#39;, 60) \<br>    .option(&#39;use_cached_result&#39;, &#39;true&#39;) \<br>    .option(&#39;use_copy_unload&#39;, &#39;false&#39;) \<br>    .option(&#39;parallelism&#39;, &#39;30&#39;) \<br>    .option(&#39;sfCompress&#39;, &#39;on&#39;) \<br>    .load()</pre><p>The query above returns this result set:</p><pre>+-----------+----------+<br>|O_ORDERDATE|&quot;COUNT(*)&quot;|<br>+-----------+----------+<br>| 1998-01-27|   6234107|<br>| 1998-01-26|   6234355|<br>| 1998-01-25|   6234326|<br>| 1998-01-24|   6234384|<br>| 1998-01-23|   6234281|<br>+-----------+----------+</pre><p>How do we know what the query looks like when executed inside of Snowflake? Simple. Execute this query to find that out.</p><pre>select * from snowflake.account_usage.query_history order by start_time desc;</pre><p>We can see, Snowflake, was smart, it indeed did evaluate the query, and determined that it could execute it as straight SQL, by wrapping it in an outer select statement, and returning a 1=0, so it know that the query can be evaluated correctly.</p><pre>select * from (select o_orderdate, count(*) from TPCH_SF10000_ORDERS group by o_orderdate order by o_orderdate desc) where 1 = 0</pre><p>You can also run <a href="https://github.com/snowflakedb/spark-snowflake/blob/86eb8306b3c8e927e64c9ff3bc9d3610b3b6b8db/src/main/scala/net/snowflake/spark/snowflake/Utils.scala#L273">getLastSelect</a> which will do the same for you, but I like to see every single command that is executed, you learn more that way.</p><pre>spark._jvm.net.snowflake.spark.snowflake.Utils.getLastSelect()</pre><h3>Conclusion</h3><p>You successfully ✔️were able to launch a PySpark cluster, customize your Python packages, connect to Snowflake and issue a table and query requests into PySpark pandas functions. The next steps for you to explore on your own is Pandas and PySpark Data Frame <a href="https://spark.apache.org/docs/latest/sql-pyspark-pandas-with-arrow.html">integration</a>, in particular using Pandas UDF’s. This will allow you to run the same functions on Pandas that you can on PySpark Data Frames, sweet!</p><h3>About</h3><p>Have any questions? Reach out to me on <a href="https://www.linkedin.com/in/douglaseisenstein/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9710cd4a46c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Integrate PySpark, Snowflake, Azure, and Jupyter: Part 2]]></title>
            <link>https://medium.com/@doug.eisenstein/how-to-integrate-pyspark-snowflake-azure-and-jupyter-part-2-14bbdda27359?source=rss-1dd716fd0395------2</link>
            <guid isPermaLink="false">https://medium.com/p/14bbdda27359</guid>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Doug Eisenstein]]></dc:creator>
            <pubDate>Fri, 05 Jun 2020 13:24:16 GMT</pubDate>
            <atom:updated>2020-06-05T14:26:49.552Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Launch 🚀 a PySpark Cluster</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZOXwCT9mFF7HCN3WoIJ7aA.png" /></figure><h3>Background</h3><p><em>This is part two, of a three-part series. In </em><a href="https://medium.com/@doug.eisenstein/how-to-integrate-pyspark-snowflake-azure-and-jupyter-part-1-50595928ab8b"><em>part one</em></a><em> we learned about PySpark, Snowflake, Azure, and Jupyter Notebook. Now in part two, we’ll learn how to launch a PySpark Cluster and connect to an existing Snowflake instance.</em></p><h3>Step 1: Prepare for cluster build-out</h3><h4>Precursor</h4><p>We will launch a production-grade PySpark Cluster, using an HDInsight image 💪, and then install external python packages, from PyPi, that don’t come pre-loaded with the base image, into the Python virtual environment across all of your cluster nodes. This means, if you wanted to install a special python package, then go right ahead, follow my steps and customize it for your needs.</p><h4>External Python Packages</h4><p>Make a list of python package you need on the cluster, this can be in the form of a requirements.txt file, or a simple list of names, I have only a couple of PyPi packages: <a href="https://seaborn.pydata.org/">seaborn</a>, <a href="https://arrow.apache.org/docs/python/">pyarrow</a>, and <a href="https://plotly.com/python/">plotly</a>.</p><p>You can also install your own internal proprietary packages, even if they aren’t in PyPi, you need to do use python <a href="https://packaging.python.org/tutorials/packaging-projects/">setup.py</a> sdist to create your package it into a tar.gz file, and then include it in a location that’s accessible by the cluster, like in a Azure BLOB store, you can even do S3 or GCS if you’d like.</p><h4>Pro Tip: Virtual Environment</h4><p>This tutorial will not cover the installation of a python virtual environment on your cluster, but I do recommend that this is done prior to going into production, it’s a best practice to create virtual environments and it’s best because its safer to manage your own virtual environment on the cluster, so you don’t mix and match with the HDInsight deployed one.</p><p>I recommend you familiarize yourself with <a href="https://docs.microsoft.com/en-us/azure/hdinsight/spark/apache-spark-python-package-installation">how to create</a> a new python virtual environment and configure the cluster to use it, while I’ll take you through these steps, if there is something I don’t cover, chances are it’ll be in in one of these references that I’m providing links to.</p><h3>Step 2: Launch PySpark Cluster</h3><p>You have two ways to build your PySpark cluster on Azure, using the Wizard or the CLI, I’ll show you both, but remember that if you’re doing this for real in production, then I’d recommend using <a href="https://www.terraform.io/docs/providers/azurerm/index.html">Terraform</a> (which in that case is better for you to go the CLI route).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*hb1AHlhMxQl1BOmU.jpg" /><figcaption>Two ways to build PySpark (A) Wizard or (B) CLI</figcaption></figure><p>Before you start, I’d recommend you have a quick read through <a href="https://docs.microsoft.com/en-us/azure/hdinsight/hdinsight-hadoop-provision-linux-clusters">this </a>article from Microsoft to familiarize yourself with the process of creating a PySpark cluster, after you’ve done this, then proceed.</p><h4>Launch using 🧙‍♂️ Wizard</h4><p>First, let’s fire up a browser to <a href="https://portal.azure.com/">https://portal.azure.com</a>, navigate to HDInsight, and click on Create HDInsight Cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RsiafB1-HmVBOfpvc8PdNw.png" /></figure><p>Then in basics, build up your cluster so it looks like this, choosing <a href="https://spark.apache.org/docs/2.3.0/">PySpark 2.3</a>, and HDInsight 3.6, and be sure to choose the region where your Snowflake instance is hosted and for me it’s in East US since I’m in Boston, you will need a username/password saved somewhere because you’ll be using this to later tossh , Jupyter to explore, and <a href="https://ambari.apache.org/">Ambari</a> to manage the cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*grpIByg5O34iqDHy5E1qtQ.png" /></figure><p>Next, in storage, choose a primary storage account that you’ll be using to store data used between PySpark and Snowflake. I’m not using any metadata store for this tutorial but feel free to configure it if you’d like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FPlmhnku6JM1C7ELNKLKfw.png" /></figure><p>Choose all of defaults for security + networking if you have a vanilla configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z5XuNpVv5mEgv0BIIBNRHQ.png" /></figure><p>Now in, configuration + pricing, you can chose a small configuration, like I’ve done with mine below, just remember to shut down the cluster, after you’re finished, so you are not paying for it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qudzhr-pLT3MNkgv7QsPlw.png" /></figure><p>The node sizes above are quite small, but if you’re in test mode, then this should be good, so pick what you think is appropriate and then finish off creating the cluster. You’ll need to wait 15–25 minutes and that assumes you haven’t built a huge cluster, so keep that in mind.</p><h4>CLI</h4><p>Now, we’ll move into how to launch a cluster from the command-line, you should take a look at <a href="https://docs.microsoft.com/en-us/azure/hdinsight/spark/apache-spark-create-cluster-cli">this</a> article as a point of reference for how to create the cluster using the CLI, also I need to assume you’ve already set-up your Azure CLI, if you didn’t go <a href="https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest">here</a> and get that done.</p><p>Next, pop open a terminal window:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vDoVKu_6m-0EMsRR4o9sLw.png" /><figcaption>Blank terminal window, clean!</figcaption></figure><p>Then login to Azure by running az login, it will open a browser tab, sign-in, and head back to terminal and you should see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wYy5zNhcEUoY-aTTBZittg.png" /><figcaption>AZ Login</figcaption></figure><p>Then copy/paste these environment variables into your favorite code editor like <a href="https://atom.io/">Atom</a>, <a href="https://code.visualstudio.com/">VS Code</a>, <a href="https://www.sublimetext.com/">Sublime</a>, <a href="https://notepad-plus-plus.org/">Notepad++</a>, vi, emacs, etc. More importantly, edit it, and customize it for your needs, be sure to save it somewhere so you remember all of these details, we recommend to our customers that they use <a href="https://www.lastpass.com/">LastPass</a> for storing private details like username/password.</p><pre>export RESOURCE_GROUP=Advanti<br>export CLUSTER_NAME=PySparkSnowflake<br>export CLUSTER_TYPE=spark<br>export COMPONENT_VERSION=Spark=2.3<br>export PASSWORD=&#39;P95th&amp;X%*8Q5RClX&amp;4&#39;<br>export LOCATION=&#39;East US&#39;<br>export CLUSTER_VERSION=3.6<br>export AZURE_STORAGE_ACCOUNT=pysparksfstore<br>export AZURE_STORAGE_CONTAINER=pysparksfstore-2020-05-29<br>export CLUSTER_SIZE_NODE=2</pre><p><strong><em>2020–06 Warning</em></strong><em>: At the time of writing this, PySpark 2.4, HDInsight 4.0, Python 3.7, Snowflake 2.12, Snowflake-Connector 2.7.1, and Snowflake JDBC 3.12.5, don’t play together very well, so it’s best to use the versions I mentioned.</em></p><p>I am assuming you already have a resource group created, if you don’t, then just follow the steps in <a href="https://docs.microsoft.com/en-us/azure/hdinsight/spark/apache-spark-create-cluster-cli">this</a> article.</p><p>First you need to create a storage account:</p><pre>az storage account create \<br>    --name $AZURE_STORAGE_ACCOUNT \<br>    --resource-group $RESOURCE_GROUP \<br>    --https-only true \<br>    --kind StorageV2 \<br>    --location $LOCATION \<br>    --sku Standard_LRS</pre><p>Next, you’ll need the storage key value, so execute this command:</p><pre>az storage account keys list \<br>    --account-name $AZURE_STORAGE_ACCOUNT \<br>    --resource-group $RESOURCE_GROUP</pre><p>You will see a response like this:</p><pre>[<br>  {<br>    &quot;keyName&quot;: &quot;key1&quot;,<br>    &quot;permissions&quot;: &quot;Full&quot;,<br>    &quot;value&quot;: &quot;0kUstqMu68mmGQOxNhUORAYto63iUEDWrN5bEjXtAKJR8eXAZVLnCbH+81H0hrdu8FSme3W95yqQ==&quot;<br>  },<br>  {<br>    &quot;keyName&quot;: &quot;key2&quot;,<br>    &quot;permissions&quot;: &quot;Full&quot;,<br>    &quot;value&quot;: &quot;cv72JQJfyE8Ol+hHT8NMIN83wruz7kVcJR2X1b/ZAIuq6eI7GOBdzJ7IN2YIrH40OBaMntYRoKIEA==&quot;<br>  }<br>]</pre><p>Then take the first key1 value and place that into an environment variable like so:</p><pre>export AZURE_STORAGE_KEY=0kUstqMu68mmGQOxNhUORAYto63iUEDWrN5bEjXtAKJR8eXAZVLnCbH+81H0hrdu8FSme3W95yqQ==</pre><p>Then create your storage container:</p><p>You will need a storage container, if you don’t have one then let’s go ahead and create one like this:</p><pre>az storage container create \<br>    --name $AZURE_STORAGE_CONTAINER \<br>    --account-key $AZURE_STORAGE_KEY \<br>    --account-name $AZURE_STORAGE_ACCOUNT</pre><p>You’ll see a response like this:</p><pre>{<br>  &quot;created&quot;: true<br>}</pre><p>Okay, last step!</p><pre>az hdinsight create \<br>    --name $CLUSTER_NAME \<br>    --resource-group $RESOURCE_GROUP \<br>    --type $CLUSTER_TYPE \<br>    --component-version $COMPONENT_VERSION \<br>    --http-password $PASSWORD \<br>    --http-user admin \<br>    --location $LOCATION \<br>    --workernode-count $CLUSTER_SIZE_NODE \<br>    --ssh-password $PASSWORD \<br>    --ssh-user sshuser \<br>    --storage-account $AZURE_STORAGE_ACCOUNT \<br>    --storage-account-key $AZURE_STORAGE_KEY \<br>    --storage-container $AZURE_STORAGE_CONTAINER \<br>    --version $CLUSTER_VERSION</pre><p>^ That will create you a HDInsight PySpark Cluster! Congratulations if you got this far, high five 🙌.</p><p>Now like I mentioned above for the Wizard, wait like 15–25 minutes, and then once it’s done, you’ll see it in the Azure management console. Go get some ☕️ you earned it.</p><p>This is the cluster I created in the HDInsight Cluster screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pT7iFjGvBn3g7ibVvq3v3A.png" /></figure><p>Then if I dive in, I can see my cluster at a glance here…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UAqQKa1tuUpfA5r5xV5e6w.png" /></figure><h4>Step 3: Install Python Packages</h4><p>PySpark, out of the box, is preloaded with the core libraries that needed for basic data exploration, such as pandas, and most of the “how to” tutorials will assume that is all you need. However, for me, that’s rarely the case, I need certain packages installed from PyPi, my own internal non-public packages, or I want to be on the latest version of a particular library. So what we’ll first cover, is getting those packages loaded.</p><p>First things first, I recommend that you follow <a href="https://docs.microsoft.com/en-us/azure/hdinsight/spark/apache-spark-python-package-installation">these</a> instructions that walk you through step by step, how to create a script action, and bear in mind that this process of creating a script that the cluster will run, is required even if you’re using GCP or AWS. The key points are that you’ll need to create a storage account and container that is accessible by the HDInsight PySpark instance.</p><p>I created the shell script below, which instructs it to create a new python virtual environment (again this is a best practice), update to the latest version of conda if we haven’t already, install and update pip to latest version, and then install the two packages I need from PyPi. Also, if you’re wondering, you don’t have to use Anaconda, you can go straight for installing Python 3.7 virtual environment directly, but I won’t cover that option here, instead I’ll be using Conda.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d87c380c26483be50d3d57b4343ca1f/href">https://medium.com/media/7d87c380c26483be50d3d57b4343ca1f/href</a></iframe><p>Alright, let’s get run our custom scripts, we’ll head into the HDInsight Cluster console, click on “Script Actions” and then on “Submit new”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AdX7T-BpLpUga_SAK6IZ3w.png" /></figure><p>Remember, that if you point the Custom Script Actions to the gist URI, it must be to the raw version, otherwise you cannot process HTML 😜. Here’s what it should look like:</p><p><a href="https://gist.githubusercontent.com/daefresh/96ea0c442576e513cde3979c584fb680/raw/c2816ea0bd9a5c0303746071db7512c8976ee2dc/azure_pyspark_bootstrap.sh">https://gist.githubusercontent.com/daefresh/96ea0c442576e513cde3979c584fb680/raw/c2816ea0bd9a5c0303746071db7512c8976ee2dc/azure_pyspark_bootstrap.sh</a></p><p>We’ll create a script action that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*XjisgDaVgALVmwZVcbz7sQ.png" /></figure><p>This☝️usually takes 10–15 minutes, so chill out until your screen refreshes, and you get a success!</p><h4>Troubleshooting</h4><p>If you run into any issue, then I recommend you try to execute the script directly on one of the nodes in the cluster, you can start off with one of the head nodes. You can do this by going into “SSH + Cluster login” and copying the ssh command to the clipboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*abTpPicQUh7ajMDxaplgQw.png" /><figcaption>Getting the SSH command</figcaption></figure><p>Past that command into your terminal.</p><p>Once you connect, you’ll want to test your shell script, step by step, to determine what may not be working as expected. You’ll see in the screenshot below the steps I took: download the shell script using wget, make it executable using chmod, and then execute the script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g_KL6iqN1UFzvnkL8V-zUA.png" /><figcaption>Executing your shells script via SSH</figcaption></figure><p>Should you run into an error, you’ll need to start problem solving by using Google, or some good old fashioned trial and error, 😆. Oh, make sure that your shell script is re-runnable!</p><p><strong><em>2020–06 Warning</em></strong><em>: There’s a known bug for Anaconda version </em><em>4.7.11, </em><em>4.7.12, and </em><em>4.8.0. If you see your script actions hanging at </em><em>&quot;Collecting package metadata (repodata.json): ...working...&quot; and failing with </em><em>&quot;Python script has been killed due to timeout after waiting 3600 secs&quot;. You can download </em><a href="https://gregorysfixes.blob.core.windows.net/public/fix-conda.sh"><em>this script</em></a><em> and run it as script actions on all nodes to fix the issue.</em></p><h4>Step 4: Quick Health Check</h4><p>Now, there’s one more step, that we need to take, in order to make sure that everything is looking good, you’ll need to head into <a href="https://ambari.apache.org/">Ambari</a>, by clicking “Ambari home”, you’ll find this tile in the overview cluster page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*oXpYV5y990OiHY9ejzqOTA.png" /><figcaption>HDInsight PySpark Cluster Tile</figcaption></figure><p>This is your management console. Provided that everything is “all green” then you can proceed to the next step! If you see an error, then just make sure that you restart all of the services, and also ensure that you didn’t setup a 1 node or tiny 2 node cluster, because you may have issues due to not enough horsepower.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dbpDAryR_wZcKqjViQ6YNg.png" /><figcaption>Apache Amari screenshot</figcaption></figure><p>As a side note, I’ve noticed that my small cluster is quite chatty when idling, so be aware of that overhead, here’s a screenshot using htop for one of my cluster nodes, you can see it’s busy even when there’s no user requests</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BqYObTL6xPFaTRC7nZe5Jw.png" /><figcaption>Busy 🐝 cluster node while idling</figcaption></figure><h3>Step 4: Jupyter Smoke Test</h3><p>First, fire up a Jupyter Notebook, you’ll see a tile on your HDInsight cluster, that looks like the screenshot below, and the URL will again use the same name as your cluster, in my case it’s: <a href="https://pysparkcluster.azurehdinsight.net/jupyter/tree">https://pysparkcluster.azurehdinsight.net/jupyter/tree</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*JqNg8MNsxhQtifglQ1C4_g.png" /></figure><p>Then use the username/password you provided earlier when you created the cluster:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*bEI5T4ZEe1OmtK_LSlYHEw.png" /></figure><p>Next, create a new PySpark3 Notebook, and name it a friendly name that you’ll remember.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*5BPUarz8hIaT45vuwBrSKA.png" /></figure><p>Then simply type the below into the first cell and run it:</p><pre>import sys<br>print(sys)</pre><p>My expectation is that Spark starts, and it prints the Python version installed, if this works, then you know your cluster was launched successfully!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6TmqhH21inREy2fVlwtooQ.png" /><figcaption>Spark is now available!</figcaption></figure><h3>Conclusion</h3><p>㊗️ You have launched created a cluster, installed external packages, and connected using Jupyter. The next section we will get you connected to Snowflake and start issuing some queries!</p><h3>About</h3><p>Have any questions? Reach out to me on <a href="https://www.linkedin.com/in/douglaseisenstein/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14bbdda27359" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Integrate PySpark, Snowflake,  Azure, and Jupyter: Part 1]]></title>
            <link>https://medium.com/@doug.eisenstein/how-to-integrate-pyspark-snowflake-azure-and-jupyter-part-1-50595928ab8b?source=rss-1dd716fd0395------2</link>
            <guid isPermaLink="false">https://medium.com/p/50595928ab8b</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Doug Eisenstein]]></dc:creator>
            <pubDate>Fri, 05 Jun 2020 13:22:58 GMT</pubDate>
            <atom:updated>2020-06-08T13:03:02.401Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Integrate PySpark, Snowflake, Azure, and Jupyter: Part 1</h3><blockquote>Prepare to start, Snowflake + PySpark = 🌞</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rC4642lNzYpSXFwi-4RTGw.png" /></figure><h3>Purpose</h3><p>At the end of this three-part series, you’ll be able to launch a <a href="https://spark.apache.org/">Spark</a> cluster running in <a href="https://azure.microsoft.com/en-us/services/hdinsight/">Azure on HDInsight,</a> query live data from <a href="https://www.snowflake.com/">Snowflake</a> using the <a href="https://docs.snowflake.com/en/user-guide/spark-connector.html">Snowflake Connector</a> with <a href="https://github.com/snowflakedb/spark-snowflake/blob/7b5cf4d055e501f6d425e14c3376bb3e73abe47f/src/main/scala/net/snowflake/spark/snowflake/SnowflakeConnectorUtils.scala#L52">pushdown</a> capability, all done through <a href="https://jupyter.org/">Jupyter</a> notebook, using a Python 3.5 virtual environment, and we’ll be exploring the <a href="https://docs.snowflake.com/en/user-guide/sample-data-tpch.html">TPC-H dataset</a><a href="https://open.factset.com/en-us">,</a> and we’ll do this in just about 90 minutes.</p><h3>Background</h3><p>I created this documentation out of need, there’s a good series made about two years ago in 2018, on the <a href="https://www.snowflake.com/blog/snowflake-and-spark-part-1-why-spark/">Snowflake Blog</a>, however it doesn’t cover Azure HDInsight, nor Python as it’s tilted for Scala, and the <a href="https://docs.snowflake.com/en/user-guide/spark-connector.html">Snowflake documentation</a> online is useful, however it is more of a reference for details than it is for a “how to” instructional series, they’re good references so do have a read through them if you get stuck, but I hope this is gets you further along the way.</p><p>You can review the entire blog series here: <a href="https://medium.com/@doug.eisenstein/how-to-integrate-pyspark-snowflake-azure-and-jupyter-part-1-50595928ab8b"><strong>Part One</strong></a><strong> &gt; </strong><a href="https://medium.com/@doug.eisenstein/how-to-integrate-pyspark-snowflake-azure-and-jupyter-part-2-14bbdda27359"><strong>Part Two</strong></a><strong> &gt; </strong><a href="https://medium.com/@doug.eisenstein/how-to-integrate-pyspark-snowflake-azure-and-jupyter-part-3-d9710cd4a46c"><strong>Part Three</strong></a><strong>.</strong></p><h3>Audience</h3><p>The intended audience are those engineers, enthusiasts, and hackers, that may already be using Snowflake but haven’t yet integrated it with PySpark and would like to do so.</p><h3>Assumptions</h3><p>This tutorial assumes:</p><ul><li>You have a Snowflake account, so if you don’t, click <a href="https://trial.snowflake.com/">here</a> and get one set up, it’s pretty easy and my experience with their sales reps is that they know what they’re talking about, and are “real” engineers, which makes working with them a positive experience.</li><li>You run Snowflake in one of your preferred cloud providers, we’ll work with <a href="http://azure.microsoft.com/">Azure</a>, if you don’t have an account, you can get set-up with some free credits, so go ahead and do that now.</li><li>You can easily work with some of Snowflake test data like their weather sample, you can also use your very own data as it’s really easy to import data, but in this case, I’ll be using TPC-H data.</li><li>You will need access to your Azure portal and the CLI, I won’t be showing <a href="https://www.terraform.io/docs/providers/azurerm/index.html">infrastructure-as-code</a>, this should be a requirement for you to go production, haha as you should never be creating clusters in production through wizards or even the CLI.</li></ul><h3>Azure</h3><p>Snowflake runs on <a href="https://cloud.google.com/">GCP</a>, <a href="https://aws.amazon.com/">AWS</a>, and Azure. We’ll be using Azure for this tutorial. Side note, from my experience, each of these cloud providers are great. Azure is a little easier to get set-up than AWS and GCP. That’s not to say I wouldn’t use GCP or AWS because I’m a little bit of a fan-boy for one of them, so I sure will continue to do implement client Snowflake installations in those too, but wanted to give credit where it’s due, nice work Azure.</p><p>We’ll be using <a href="https://docs.microsoft.com/en-us/azure/hdinsight/hdinsight-overview">HDInsight</a>. Azure HDInsight is a managed, full-spectrum, open-source analytics service in the cloud for enterprises. You can use open-source frameworks such as Hadoop, Apache Spark, Apache Hive, LLAP, Apache Kafka, Apache Storm, R, and more.</p><h3>Snowflake</h3><p>Snowflake has gained tremendous traction in the last few years, I’m seeing over 55% of our clients are now running Snowflake. This doesn’t mean that they have moved their entire data warehouse over to it, but they have bought credits, and are dipping their toes into the water, by using it on enterprise data warehouse, or to move their sql-ready analytical applications from other less scalable relational databases to Snowflake.</p><p>There are a few advantages of Snowflake, and these are from my experience: first it’s serverless so you only get charged for your query, second it’s multi-cloud so it decouples 🔌 your data warehouse from AWS/GCP/Azure, third it requires less DBA overhead than traditional data warehouses, fourth the data is micro-partitioned and stored in S3/GCS/BLOB, and fifth theres integration with PySpark with the ability to push down queries into the database.</p><h3>PySpark</h3><p><a href="https://spark.apache.org/">Apache Spark</a> is a parallel processing framework that supports in-memory processing to boost the performance of big-data analytic applications. Apache Spark in Azure HDInsight is the Microsoft implementation of Apache Spark in the cloud. HDInsight makes it easier to create and configure a Spark cluster in Azure. Spark clusters in HDInsight are compatible with Azure Storage and Azure Data Lake Storage. So you can use HDInsight Spark clusters to process your data stored in Azure.</p><p>One of the key integrations, IMHO, is integration with PySpark, and in particular the <a href="https://docs.snowflake.com/en/user-guide/spark-connector-overview.html#query-pushdown">pushdown</a> (good article <a href="https://www.snowflake.com/blog/snowflake-spark-part-2-pushing-query-processing/">here</a> too), because we need balance where sometimes it’s best to have the database handle certain operations like simple aggregations vs. having PySpark/Python handle more complex transformations like time series resampling and especially for machine learning and artificial intelligence, anyways, in this article I will take you through a few simple steps to get this all going, and feel free to comment if there is anything that you’d like to dig into further.</p><h3>Jupyter</h3><p><a href="https://jupyter.org/">Jupyter</a> Notebook is a very popular exploration and analytical decision making tool, used by Data Scientists and Hackers like me, it enables you to edit, run and share Python code as a “notebook”. It’s 100% browser-based, it allows you to step by step create a process that will shape the data how you need it for analysis, exploration, and reporting. There are cool libraries out there like <a href="https://github.com/nteract/papermill">papermill</a> from Netflix, that enables data pipelines to consume the data outputted from a notebook, take a look at that, but it’s not part of this article.</p><h3>Conclusion</h3><p>Alright, let’s start moving through the process, this will be fun!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/0*cZFoIOfyVYC6GnUu.png" /></figure><h3>About</h3><p>Have any questions? Reach out to me on <a href="https://www.linkedin.com/in/douglaseisenstein/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50595928ab8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[7 tips for achieving 99.99% correlation for your next data comparison]]></title>
            <link>https://medium.com/@doug.eisenstein/7-tips-for-achieving-99-99-correlation-for-your-next-data-comparison-71770e1d1fc9?source=rss-1dd716fd0395------2</link>
            <guid isPermaLink="false">https://medium.com/p/71770e1d1fc9</guid>
            <category><![CDATA[dataops]]></category>
            <dc:creator><![CDATA[Doug Eisenstein]]></dc:creator>
            <pubDate>Tue, 26 May 2020 13:17:58 GMT</pubDate>
            <atom:updated>2020-05-26T13:17:58.103Z</atom:updated>
            <content:encoded><![CDATA[<h3>7 tips for achieving 99.99% data comparison correlation</h3><blockquote>Data is forever, your pipeline, storage, and shape isn’t.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k4wPJXSrOnUIZr3W.png" /></figure><p>Have you ever needed to compare the same data in two different databases 🤔?</p><p>This is required for data migration, warehouse consolidation, ingestion re-writes, or major system releases. It guarantees quality of your data is equal to or measurably better than your existing process.</p><p>If you are doing this great, add tips of your own, and if you aren’t then read on!</p><h3>Story</h3><p>I was inspired to write this article after my team and I hit <em>Summit Milestone 2</em> 🏔, of a 9-month data modernization strategy for a Chicago-based financial firm, with the key deliverable was re-writing 15 data loaders, with 99.99% data quality matching target.</p><p>Their tech stack was using techniques and software that were 10+ years old, there were 5 authors all of whom wrote different processes in R, Bash, Python, C#, Java and none of these authors were with the company any longer, the process was 100% batch-based taking 6 hours to run, and all of the logic was tightly coupled to a 1 single data warehouse requiring everyone to use MSSQL limiting them from other great databases like BigQuery, Aurora, and Snowflake.</p><p>The data from these 15 sources are absolutely mission critical for investment decision making across the enterprise, including in particular portfolio construction, risk management, and trade cost analysis. The data came from sources like <a href="https://www.crd.com/">CRD</a>, <a href="https://www.murex.com/">Murex</a>, <a href="http://bloomberg.com/">Bloomberg</a>, <a href="https://www.refinitiv.com/en">Refinitiv</a>, and <a href="https://www.axioma.com/">Axioma</a>, most of it was structured data, and some unstructured data like web scrapes, emails, pdfs, etc.</p><p>Anyone who has went live with a large scale data warehousing project will tell you to double or triple the amount of time you expect for it to go-live 🚀. Why is that? I’ll tell you why, nearly 2–3x the amount of time isn’t spent in development, it’s spent identifying data anomalies 🧟‍♀️and resolving them, and that’s what I knew we were up against before we had even started.</p><p>This is by far the hardest job because it requires that you reverse-engineer existing logic and re-write it. That’s a manual 🔨 activity and may lead to mistakes. Sometimes the mistakes are caused by “wait and see”, maybe the logic is so complex and you have a hunch it won’t happen or you’ll wait and see so you don’t implement it until someone asks. Do you know what? They always ask, someone always finds that edge case, and if it’s not you, I guarantee it’ll be an internal customer, or worst an external customer, it’s a ticking time bomb 💣, so if there is one thing you don’t do, don’t kick the can down the road, it will come back and cost you 10x more on the project, so be sure to compare the data!</p><p>So what what are some tips from the pro’s 💁:</p><h3>Tip 1: Define target 🎯 correlation, set expectations, and over communicate</h3><p>Talk to each consumer of the data or to the product manager, and set a target data comparison correlation metric like 99.998%. You can get more granular as you move forward like for certain sources of data, or time periods, or universe of entities, but start off with a success metric that everyone can remember.</p><p>The way I think about it, you must get 99.99% coverage with the 0.001% being completely explainable. You don’t want any rogue issues that you don’t understand, that will haunt 👻 you. Every difference must be accounted for, this is a great discipline for organizations that want to step up their game in treating data as an actual asset and ensuring that it’s near perfect. Having been granted the opportunity to work with a few of the top 10 asset managers with the year over year best performance, they dial in the data quality and have a very high standard.</p><p>After you ask people for their input, send out a simple email about your target quality metric, you may need their help to review edge cases, and they will need to do a final review and draw up a punch list of any discrepancies they may find, you must recruit them to help out during the review process, while you will take the ownership you need to also involve them into the investigations when they come up, it will help them to gain a better understanding of the data quality themselves.</p><h3>Tip 2: Think of a Data Point ⚪️ as the dimensions of Source, Entity, Time, Metric</h3><p>When I think about “data”, in my mind, I disassemble that into a shape composed of thousands of “data points”, and each is defined by an “source”, “entity”, “time”, and “metric”.</p><p>Let’s use an example, source:Amazon sells a product entity:Kettlebell priced at metric:price of $57 at time period time:2020-05-22 . Now, it doesn’t matter how you have this data stored, in JSON, EAV, K/V, Columnar, etc, what matters is you know where this data lives so it can be accessed by your comparison process.</p><p>You do not need to shape your data into the form above for comparison, but you do need to think in this way, it’s better to steer away from talking about tables and views and functions and scripts, because you’re comparing data, not how they’re stored.</p><h3>Tip 3: Create an inventory 📦 of source and target data metrics and how to access them</h3><p>Create an inventory of all data structures that need to be compared, if you need every single data point compared, then make sure that list is reflected, and then create a simple key/value map from source to target, this can be as simple as a spreadsheet at first, but those that know me know that it’s better to have all of this in a configuration file like a yaml, so that you manage one artifact that accelerates the development process.</p><h3>Tip 3: Simple “row counts” serve as a great 50k 🚠foot at a glance overview</h3><p>A very rudimentary data comparison check, is the Row Count check which is a simple aggregated count, you can first do this across the entire data set, and then do it over a given time dimension, such as a calendar day and then verify that you have the same number of data points between source and target. This is a great cursory check, because if these numbers don’t match, then it means you need to dig in further, and on the contrary don’t be all excited if you get 💯 match, but then later find out that you had accidentally inverted field names in your code.</p><h3>Tip 4: Missing 🙈 value checks using a natural time sampling frequency</h3><p>Missing value checks are usually done over a time dimension. This is a where you’ll pick a natural time frequency inside of the data, some data is sampled regularly like by business day, while others are sampled quarterly or intra-daily, make sure you understand what your time sampling is, also you can create a regular time sample if you’d like from the data, but the technique for how to do that isn’t covered in this article.</p><p>The article assumes you’ve got business daily observations, so then you’d want to compare the data business day over business day, for that given entity and metric, sometime you’ll be checking for NULLs, other times you may have missing data, as in the data value doesn’t even exist (think no row) in the source or the target, so these are the ones to be on the lookout for.</p><p>This kind of comparison can provide good confidence in quality of data, but don’t 🥳 it up yet!</p><h3>Tip 5: Granular value correlation checks for exact match or high 〰️ correlation:</h3><p>Then comes one of the most meaningful metric’s and this is a correlation check where you’re comparing an individual data point and expect either an exact match like 100%.</p><p>This is the hardest one to do and before you even start on this step you really need to have confidence 💪 in the results of the tip 3 and 4.</p><p>There are many ways to compare, once such is to use a MD5 hash across all of the key attributes for that data point or it’s feasible to even do a group of data points like by an entity, by a day, or even for a row.</p><p>This will allow you see all of the warts of the data so be prepared for this part to take the longest amount of time. This is where the projects often fail the most because they go overlooked, and remember my comment about kicking the can down the road from above, well this is where it comes back at you, so do take the easy way out.</p><h3>Tip 6: Capture the anomaly, treat it as an observation, then fix the bug or exclude it from the comparison reports</h3><p>Once you find a data anomaly then it doesn’t mean it’s right or wrong it’s more an observation.</p><p>It’s a common misconception that the old data is usually right and the new data isn’t. While this may be true at times, don’t make any assumptions until you have given this observation the proper love and care by conducting a source data investigation, and by this I mean you really dig into the data and explore the observation in both old and new.</p><p>So, refrain saying it’s a “problem” until you know for sure that it is. If it’s a bug in your new logic then go ahead and fix that and re-run the comparison reports to ensure they are perfectly matching. If it’s a known problem with the old data then you may choose to exclude it from your comparison reports by filtering it out.</p><p>Yes, the most rewarding 🏅 ones are those which are incorrect in the old process and correct in the new process, you do deserve a medal for that one. I also want to make sure it’s clear you do not try to fix all sorts of data problems while you’re here, that’s a separate project, first you need to get to a good comparison score so the data is as good or better than what’s in production now, and only after that point should you embark on cleaning up the data.</p><h3>Tip 6: Freeze the data that you’re comparing for the first milestone, then handle live data comparisons</h3><p>Do not try to do both at once, it’s too difficult, you’ll go dizzy 😵.</p><p>Let’s say that you have data provided from a third party every hour, and you have 20 years of this data, then you want to be comparing all of that data, but start by working with a frozen snapshot of the source and target data, that way you know no data is changing while you’re analyzing it.</p><p>You should consider looking at lagged data, meaning don’t include the last day worth of data, instead look at the previous business day’s data, and go back for one week to look at those comparisons.</p><p>Then start looking at the data quality problems from most recent to historical data problems. So start by looking at the last week of data, then the last month, last year, and finally the entire historical data set for the past 20 years.</p><p>Last, you will want to compare the data in-flight, so in real-time you’ll want to ensure that the data is coming through in a timely manner, but then again at this point you should only be investigating timing issues.</p><h3>Tip 7: Create a data comparison framework, but don’t overthink it</h3><p>You’ll need to scaffold a data comparison framework, because there really isn’t much high quality open source projects that do this for you, it’s not hard but someone should develop an open source project for this!</p><p>If you’re working with small data sets, and your a Python-guru, you may be able to pull out data from source to target, multi-process it, and do your comparisons. However if you’re working with much larger data sets, there are so many other ways to do this. As an example, we’ve created a framework that parameterizes the data you want compared, and will make a snapshot of it, store it in parquet files, and then you can do exploration and comparisons using PySpark, Athena, HDInsight, etc. Don’t be a purist here, use the right tool for the job given the demands of the data.</p><p>Then make sure that it’s all automated, and run this on a regular basis, if you’re looking at the data on a daily basis, then just run it overnight, if you need it to run more often then you’ll need to make sure that you can keep your snapshot updated.</p><h3>Conclusion</h3><p>I’ve learned painfully, over the last 10 years, onboarding 327+ data sets for customers, what it takes to deliver 99.99% data comparison quality, between old and new data sets, it sure wasn’t a walk in the park, but that’s why I’m sharing it with you, so you may learn from my failures 😅.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71770e1d1fc9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overcoming banter of on-prem to cloud data warehouse]]></title>
            <link>https://medium.com/@doug.eisenstein/overcoming-banter-of-on-prem-to-cloud-data-warehouse-1438f27edf0d?source=rss-1dd716fd0395------2</link>
            <guid isPermaLink="false">https://medium.com/p/1438f27edf0d</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[investment]]></category>
            <dc:creator><![CDATA[Doug Eisenstein]]></dc:creator>
            <pubDate>Mon, 02 Mar 2020 16:18:47 GMT</pubDate>
            <atom:updated>2020-03-02T16:18:47.484Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*2ACXrzLaCubp5NDi" /></figure><p>“I can’t move on-prem to the cloud because management doesn’t support it”</p><p>I hear that from financial companies small and large. Early on, before the cloud was a thing, I helped companies understand why you’d want to do this.</p><p>I’m going to share with you the same experiences that worked years ago now.</p><p>The short, no one wants to take the risk, until they see it’s got a real ROI, and that outweighs the perceived problems in their mind.</p><ol><li>Pick one internal product you own, yes may be a “custom built” product, where all of the data is not proprietary (don’t pick holdings data), as an example, all market data used by your investment research or risk management team.</li><li>Create a 3-page slide: problem, solution, benefits. Make it simple. No buzzwords. Talk through it. As an example “Backtesting takes 24 hours to run” as your problem. Seriously that simple. Don’t overthink but do focus on nouns.</li><li>Focus on quantifiable benefits of cost, speed, and agility. If you use AWS then use the <a href="https://calculator.s3.amazonaws.com/index.html">pricing calculator</a> and be sure to pick all serverless technologies as you construct your solution. Done efficiently, you can pay $5 to process all of your batch data per night.</li><li>Time-box 2 week sprint, and demonstrate in a POC, pick that point point of running a single query, or better yet an actual step in the investment process, how it can be run 100x faster in the cloud and at 1/10th of the cost.</li><li>If you need to combine cloud data with on-prem data, then consider anonymizing the entities, don’t use names, use identifiers that are meaningless, and if you cannot do that, then get a small sample set of data, and work with that locally.</li></ol><p>I help financial companies create awesome data-driven solutions. If you have any questions hit me directly via LinkedIn.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1438f27edf0d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Driving alpha at the speed of streams.]]></title>
            <link>https://medium.com/open-aristos/driving-alpha-at-the-speed-of-streams-e091807206a5?source=rss-1dd716fd0395------2</link>
            <guid isPermaLink="false">https://medium.com/p/e091807206a5</guid>
            <category><![CDATA[apache-beam]]></category>
            <category><![CDATA[investment]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[streaming]]></category>
            <category><![CDATA[alpha]]></category>
            <dc:creator><![CDATA[Doug Eisenstein]]></dc:creator>
            <pubDate>Sun, 01 Mar 2020 20:33:15 GMT</pubDate>
            <atom:updated>2020-03-01T20:33:15.117Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0NqNrXNmnfLDY838.png" /><figcaption>It’s all about Alpha baby!</figcaption></figure><p>Driving alpha at the speed of streams.</p><p>Excess returns originate from experimentation, and rapid iterations are enabled<strong> by speed, in 2020 that means streaming.</strong></p><p>This boat has already set sail at leading tech companies and many world-class investment managers. Mark my words that by 2025 you’ll be moving to streams much like how the industry is moving to cloud, <strong>streaming isn’t a fad, it’s a revolution.</strong></p><p>Some of you may be thinking, wait, I don’t have real-time data, why the heck do we need streams? You architect for the future, not now.</p><p>Let’s talk about batch. Stream-based architecture doesn’t mean you cannot support batch! <a href="https://beam.apache.org/">Apache Beam</a>, supports a unified data processing model, of both batch and stream. So don’t think it’s batch OR stream, think it’s both! You need to design your architecture so it supports stream as a first-class citizens and not the other way around.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cuXH4qtKJbnCaIsG.png" /><figcaption>Bye bye Big Data, hello streaming engines</figcaption></figure><p>Speed accelerates your research which drives greater alpha. The quicker you can process historical data, ingest new data, onboard new sources, innovate new models, or add new factors, the faster you can experiment and turn those brilliant ideas into higher returns for your clients.</p><p>Aristos is the worlds first open source toolkit for building a modern financial data platform and the backbone are all streams.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e091807206a5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-aristos/driving-alpha-at-the-speed-of-streams-e091807206a5">Driving alpha at the speed of streams.</a> was originally published in <a href="https://medium.com/open-aristos">Open Aristos</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Financial data platforms are broken]]></title>
            <link>https://medium.com/open-aristos/financial-data-platforms-are-broken-ca5f702cfbe5?source=rss-1dd716fd0395------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca5f702cfbe5</guid>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Doug Eisenstein]]></dc:creator>
            <pubDate>Thu, 27 Feb 2020 01:31:25 GMT</pubDate>
            <atom:updated>2020-02-27T01:31:25.757Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*Bne2NGRfvb21W2Vq.png" /></figure><p>I bet your data platform, is one of the following:</p><p>a) custom built using a variety of open-source libraries and tools</p><p>b) a one-stop-shop software-enabled vendor does 100% for you</p><p>c) you’ve bought a costly off-the-shelf monolithic solution</p><p>What’s wrong with that? Well, if you sit back, think about it, ask yourself, are you <strong>locked-in</strong>, like really, are you locked in?</p><p>Many companies are <strong>locked into a data provider</strong>, they rely on Bloomberg for everything, take them out of the mix, and your entire platform breaks, not because it’s the data, it’s because you’re too coupled to their identifier, or data model.</p><p>Another example, <strong>can you swap your database</strong>, from MSSQL to InfluxDB or try Snowflake? Can you do this in a day, and have all of your data running on it? Can you do this across clouds or are you tightly coupled to AWS, Azure, or Google?</p><p>Perhaps, you’ve bought a financial domain specific “Enterprise Data Management” tool, and are <strong>spending 6-digit’s per year</strong>, are you getting a good return on investment?</p><p>Well, I want you to imagine, what if, you could build your own data platform, as easy Wordpress has made creating a new website in hours, pick a theme, buy a few apps from the marketplace and then be up and running.</p><p>That is precisely the mindset that we have designed, from the ground up, in a disruptive open source toolkit, that helps you build a financial data platform in 60 minutes or less.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca5f702cfbe5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-aristos/financial-data-platforms-are-broken-ca5f702cfbe5">Financial data platforms are broken</a> was originally published in <a href="https://medium.com/open-aristos">Open Aristos</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A data platform is not a solution or warehouse.]]></title>
            <link>https://medium.com/open-aristos/a-data-platform-is-not-a-solution-or-warehouse-6237b6f1865e?source=rss-1dd716fd0395------2</link>
            <guid isPermaLink="false">https://medium.com/p/6237b6f1865e</guid>
            <category><![CDATA[delivering-data-platorms]]></category>
            <dc:creator><![CDATA[Doug Eisenstein]]></dc:creator>
            <pubDate>Fri, 21 Feb 2020 13:22:36 GMT</pubDate>
            <atom:updated>2020-02-21T13:22:36.598Z</atom:updated>
            <content:encoded><![CDATA[<p>A data platform is not a solution or warehouse. The data platform enables you to create a solution. The solution provides addresses a value stream. The value stream answers a specific set of needs. Those needs are well defined and scoped. The outcome is measurable and repeatable using deliverables.</p><p>It’s that simple. Just like you decouple components and abstractions in a well designed architecture you must do the same when working hand-in-hand with your customers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6237b6f1865e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-aristos/a-data-platform-is-not-a-solution-or-warehouse-6237b6f1865e">A data platform is not a solution or warehouse.</a> was originally published in <a href="https://medium.com/open-aristos">Open Aristos</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Investment 360” in finance and “Threat 360” in cybersecurity are gaining momentum.]]></title>
            <link>https://medium.com/open-aristos/investment-360-in-finance-and-threat-360-in-cybersecurity-are-gaining-momentum-478714edb2c8?source=rss-1dd716fd0395------2</link>
            <guid isPermaLink="false">https://medium.com/p/478714edb2c8</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[threat-hunting]]></category>
            <category><![CDATA[investment]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[entity-resolution]]></category>
            <dc:creator><![CDATA[Doug Eisenstein]]></dc:creator>
            <pubDate>Wed, 19 Feb 2020 14:41:34 GMT</pubDate>
            <atom:updated>2020-02-19T14:46:29.655Z</atom:updated>
            <content:encoded><![CDATA[<p>“Investment 360” in finance and “Threat 360” in cybersecurity are gaining momentum. Familiar with “Customer 360” and “Know Your Customers”? That desire has expanded into financial instruments and cybersecurity threats.</p><p>We’ve talked to 6 CTO’s across Fortune 500 companies and Top 25 Investment Managers. 5 out of 6 have are addressing these demands. Why? emerging technology, like knowledge graphs, artificial intelligence, time series databases, and streaming engines, are rapidly maturing and so is the interest in use cases.</p><p>The commonality, and why this is really cool, for what Open Aristos is doing, is it all comes back to resolving entities and relationships deep side of your data within milliseconds, seeing the “whole picture” in a few moments.</p><p>Open Aristos, is a marketplace of building blocks used to create your own data platform in less than 60 minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dqbGRmaPO90Le5-K.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=478714edb2c8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-aristos/investment-360-in-finance-and-threat-360-in-cybersecurity-are-gaining-momentum-478714edb2c8">“Investment 360” in finance and “Threat 360” in cybersecurity are gaining momentum.</a> was originally published in <a href="https://medium.com/open-aristos">Open Aristos</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>