cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Error importing Exported CSV

Hi. The following query worked fine on a Manually created lyrics CSV: Starboy.csv

I am exporting clean lyrics to a CSV using Python, and the doesn't work, throwing an exception:

"neo4j.exceptions.ClientError: Cannot merge node using null property value for word"

Please check this article

I can share my api_key through email if you need to test my script

Thanks in advance

Traceback (most recent call last):
  File "Desktop/100/Mining Top Tracks in india.py", line 171, in <module>
    create_Nodes(create_Nodes_Query)
  File "Desktop/100/Mining Top Tracks in india.py", line 100, in create_Nodes
    session.write_transaction(graph.create_Nodes, create_Nodes_Query)
  File "/anaconda3/lib/python3.6/site-packages/neo4j/v1/api.py", line 503, in write_transaction
    return self._run_transaction(WRITE_ACCESS, unit_of_work, *args, **kwargs)
  File "/anaconda3/lib/python3.6/site-packages/neo4j/v1/api.py", line 480, in _run_transaction
    tx.close()
  File "/anaconda3/lib/python3.6/site-packages/neo4j/v1/api.py", line 644, in close
    self.sync()
  File "/anaconda3/lib/python3.6/site-packages/neo4j/v1/api.py", line 615, in sync
    self.session.sync()
  File "/anaconda3/lib/python3.6/site-packages/neo4j/v1/api.py", line 357, in sync
    detail_count, _ = self._connection.sync()
  File "/anaconda3/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 380, in sync
    detail_delta, summary_delta = self.fetch()
  File "/anaconda3/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 287, in fetch
    return self._fetch()
  File "/anaconda3/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 327, in _fetch
    response.on_failure(summary_metadata or {})
  File "/anaconda3/lib/python3.6/site-packages/neo4j/v1/result.py", line 70, in on_failure
    raise CypherError.hydrate(**metadata)
neo4j.exceptions.ClientError: Cannot merge node using null property value for word

neo4j version
desktop version
browser version
driver : Official (neo4j.v1)
neo4j.log:

2018-10-29 11:58:46.276+0000 INFO  Neo4j Server shutdown initiated by request
Active database: graph.db
Directories in use:
  home:         /Users/d3v4n5h/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-25eef966-4d97-4421-9310-903f03421892/installation-3.4.6
  config:       /Users/d3v4n5h/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-25eef966-4d97-4421-9310-903f03421892/installation-3.4.6/conf
  logs:         /Users/d3v4n5h/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-25eef966-4d97-4421-9310-903f03421892/installation-3.4.6/logs
  plugins:      /Users/d3v4n5h/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-25eef966-4d97-4421-9310-903f03421892/installation-3.4.6/plugins
  import:       /Users/d3v4n5h/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-25eef966-4d97-4421-9310-903f03421892/installation-3.4.6/import
  data:         /Users/d3v4n5h/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-25eef966-4d97-4421-9310-903f03421892/installation-3.4.6/data
  certificates: /Users/d3v4n5h/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-25eef966-4d97-4421-9310-903f03421892/installation-3.4.6/certificates
  run:          /Users/d3v4n5h/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-25eef966-4d97-4421-9310-903f03421892/installation-3.4.6/run
Starting Neo4j.
2018-10-30 08:46:47.553+0000 INFO  ======== Neo4j 3.4.6 ========
2018-10-30 08:46:47.667+0000 INFO  Starting...
2018-10-30 08:46:51.053+0000 INFO  Initiating metrics...
2018-10-30 08:46:53.143+0000 INFO  Sending metrics to CSV file at /Users/d3v4n5h/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-25eef966-4d97-4421-9310-903f03421892/installation-3.4.6/metrics
2018-10-30 08:46:53.766+0000 INFO  Bolt enabled on 127.0.0.1:7687.
2018-10-30 08:46:56.205+0000 WARN  Server thread metrics not available (missing neo4j.server.threads.jetty.all)
2018-10-30 08:46:56.209+0000 WARN  Server thread metrics not available (missing neo4j.server.threads.jetty.idle)
2018-10-30 08:47:04.383+0000 INFO  Started.
2018-10-30 08:47:04.965+0000 INFO  Mounted REST API at: /db/manage
2018-10-30 08:47:05.184+0000 INFO  Server thread metrics has been registered successfully
2018-10-30 08:47:06.796+0000 INFO  Remote interface available at http://localhost:7474/
2 REPLIES 2

It works totally fine on Starboy.csv but throws error in TakiTaki.csv

Ironically, starboy.csv had null and it still worked. But it won't work on the file I exported (with NULL or after manually removing the NULL)

You haven't provided your LOAD CSV cypher, but I can take a pretty good guess at what's causing this from just this.

When you're loading data, you're doing something like this:

MERGE (f:FooNode { word: line.word })

And in your CSV data, on some particular line in the file, there is a null value for the word column. So your merge is failing because you have missing data in your input CSV. "Null" isn't equal to anything in cypher, so you can't merge by null, because merge is trying to check for equality to see if something already exists, and that entire equality check concept is off of the rails when you're dealing with null.

Here's what you should do to fix it:

  1. Adjust your CSV to coalesce a non-null value, like this: MERGE (:FooNode { word: coalesce(line.word, 'DEFAULTVALUE') }). Coalesce will replace nulls with the default value.
  2. Clean up your CSV before importing to ensure no nulls are present.