Using a Data Flow to move data from who knows where to Neo4j in SSIS
Tags: neo4j, ssis
Published: 2020-02-19 09:33:30

---
title: Using a Data Flow to move data from who knows where to Neo4j in SSIS
published: true
date: 2019-07-19 16:43:15 UTC
tags: Neo4j,SSIS
canonical_url: 
---

In what is rapidly becoming a series of posts – we look into another of the components in the Anabranch SSIS Components for Neo4j package. The [last post](https://dev.to/cskardon/neo4j-ssis-connecting-and-executing-cypher-in-a-control-flow-5f60-temp-slug-8430168) looked at using the “Execute Cypher Task” from within a Control Flow, but that’s not so useful, I mean – it’s _great_ for doing things like Deleting a DB, adding indexes etc, but when we want to get Data from one source to another, we gotta go all Data Flowy.

<iframe src="https://player.vimeo.com/video/349005497" width="525" height="295" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

I’m working on the principle that you’ve gone through the last post, as well, I’m going to pick up from where we left off, and I make no apologies for my assumptions.

## Clear the DB

I should mention – please check which DB instance you are connected to – nothing says ‘problem’ quite like deleting your production database.

Let’s first clear the Neo4j instance back to an empty state, run:

```
MATCH (n) DETACH DELETE n
```

In the browser.

## Clear Package

We don’t want the Execute Cypher Task any more, so select it – and press Delete, or go all Mousey and right-click – the choice is yours

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-14.png)<figcaption>Deleting the mouse way</figcaption>

## Let’s Data Flow (Task)!

Drag a Data Flow Task onto the Control Flow workspace:

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-15.png)

Double click on the Task to be taken to the Data Flow workspace, which will be empty. So let’s drag a ‘Flat File Source’ to the space:

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-16.png)

Double click on the Flat File Source, and the editor will pop up. We need to add a new Connection Manager, so press ‘New…’

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-17.png)

Now, we want to use a CSV file, you can use the one I use by downloading from [this link](https://anabranch-my.sharepoint.com/:x:/g/personal/cskardon_anabranch_co_uk/EdRCjAVnCmxCk_JiJRMbOfwBkTiCbrL3FDSskFVyQxJbNg?e=8Nn1sh), it’s not very exciting I’m afraid, just some names ![🙂](https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f642.png) Anyhews – fill in the details that match your file (the ones in this picture match my file, the only thing I’ve changed from default is the Code page to be 65001 (UTF-8))

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-18.png)

Then click on the ‘Columns’ bit on the left hand side, to make sure it all looks ok, and press OK. You’ll be back to the ‘Flat File Source Editor’ – and you should now click on the ‘Columns’ bit here too:

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-19.png)

Make sure at least the First/Last names are checked here – obviously if you’re using your own file – pick your columns! Press OK and go back to the workspace.

Now drag an ‘Execute Cypher Destination’ task to the workspace:

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-20-1024x363.png)

Drag the ‘Blue arrow’ from the Flat File Source, and attach it to the Execute Cypher task:

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-22.png)

Then, right click on the execute cypher task, and select ‘Show Advanced Editor…’

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-21.png)

First, set the connection manager, we want to use our existing Neo4j Connection Manager

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-23.png)

Then we want to select the ‘Input Columns’, just pick them all for now:

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-24.png)

Press OK, and then Double click on the Execute Cypher Task, to get the Cypher Editor

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-25-1024x598.png)

Add the Cypher as I have above:

```
CREATE (:User {First: $FirstName, Last: $LastName})
```

And press OK.

## Do some SSISing!

Now, all that’s left to do is press Start (or Right-click – Execute Task) whichever is your preference!

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-26.png)

It’ll run, and give you the following:

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-27.png)

Which you can check in your DB by running:

```
MATCH (n) RETURN COUNT(n)
```

![](https://xclave.co.uk/wp-content/uploads/2019/07/image-28.png)

Things are a bit more interesting now, as we’re pulling from a different source and putting into the database, obviously SSIS supports _loads_ of sources – with

These controls are currently in an open beta, to register to get the controls, please go to: http://bit.ly/neo4jssis