neo4j-import failed while import local CSV file - neo4j

I am trying to import a CSV file into the neo4j database, I adopted the sample online but I still failed.
I executed the following command under the 'import' directory:
../bin/neo4j-admin import --into retail.db --id-type string --nodes:Customer customers.csv --nodes products.csv --nodes orders_header.csv --relationships:CONTAINS order_details.csv --relationships:ORDERED customer_orders_headers.csv
Expectedly,the windows powershell should have results like:
IMPORT DONE IN 5s 212ms
Imported:
6 nodes
7 relationships
12 properties
However,my actual result is
expected '--nodes 'to have at least 1 valid item,but had 0[]
and gave me some usage guidance of neo4j-admin import. I cannot tell what the problem was because my command seemed correct.

Related

Python Getting a SyntaxError: parsing command to Hython on windows

I'm trying to parse a few commands to Houdini's Python module called Hython.
And I'm doing this through os on windows.
My command looks like this:
command = '''"c:\\Program Files (x86)\\Steam\\steamapps\\common\\Houdini Indie\\bin\\hython.exe" -c \
"import sys; sys.path.append('d:\\Cloud\\OneDrive\\Dokumenter\\GitHub\\tutorialTools\\utils'); \
import houUtils; houUtils.runReduction(\'%s\',\'%s\')"''' % (assetDir, amount)
os.popen(command)
I've tried all the tricks on quotations I could think of, but I'm getting a :
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes
in position 49-50: truncated \uXXXX escape
Any kind of help would be appreciated
First I tried adding to the command by separate lines:
"command +=" but this stopped me quickly.
I've tried doing the initial path with r'c:\...'
The entire problem seems to be connected with writing paths inside a quotation.

vscode dev container python interactive (`tkagg`) plots

Expected Behavior (local environment: fresh MacOS 12.4 installation)
With no environment updates except $ pip3 install matplotlib, I can successfully run this simple plot from the Matplotlib documentation:
Example Code:
# testplot.py
import matplotlib.pyplot as plt
import numpy as np
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
fig, ax = plt.subplots()
ax.plot(t, s)
ax.set(xlabel='time (s)', ylabel='voltage (mV)',
title='About as simple as it gets, folks')
ax.grid()
fig.savefig("test.png")
plt.show()
Actual Output (saved to a .png after window opens):
Run $ python3 testplot.py in the terminal:
Observed Behavior (vscode python 3.8 dev container)
Disclaimer: This post does not address notebook-based plots (which work fine but are not always preferred)
However, when I run this in my dev container, I get the following error:
testplot.py:16: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
plt.show()
First Attempted Solution:
Following this previously posted solution, I specified the backend (export MPLBACKEND=TKAgg) before running the interpreter, but the error persists.
Second Attempted Solution:
Following the comments, I added the following lines to the script:
import matplotlib
matplotlib.use('tkagg')
In the v3.8 dev container, this addition changes the error to:
Traceback (most recent call last):
File "testplot.py", line 5, in <module>
matplotlib.use('tkagg')
File "/usr/local/python/lib/python3.8/site-packages/matplotlib/__init__.py", line 1144, in use
plt.switch_backend(name)
File "/usr/local/python/lib/python3.8/site-packages/matplotlib/pyplot.py", line 296, in switch_backend
raise ImportError(
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running
Note: adding these two lines broke the local script as well. The point of the local example was to show that it plots stuff without installing anything except matplotlib.

WARNING: Invalid input 'S': expected 'n/N' USING PERIODIC COMMIT

I'm trying to import à CSV via Neo4JShell on Neo4J 3.0.4.
This script worked on an older version of Neo4J.
Here's my script :
USING PERIODIC COMMIT 5000
LOAD CSV WITH HEADERS FROM
"file:///my_file.csv"
AS line FIELDTERMINATOR ';'
WITH coalesce(line.VAR1,"") as var1
MERGE (i:myObject {var1: var1})
But I get this error :
WARNING: Invalid input 'S': expected 'n/N' (line 9, column 2 (offset: 247))
"USING PERIODIC COMMIT 5000"
Any idea ?
I install the zip version, one powershell to run "invoke-neo4j console", and an other powershell to run de "invoke-neo4jshell -file "my_script.cypher"
Thanks.

export to csv from neo4j using import-cypher

I found this neo4j data exporting tool (https://github.com/jexp/neo4j-shell-tools#cypher-import) and it worked perfectly on my mac OS computer. I followed the same step to export data from a ubuntu server and the following error message was generated without further explanations.
Has anyone used this tool on ubuntu and any idea what the error message may indicate? Also, is there another way to export large (~100M rows) neo4j data into a csv file?
neo4j-sh (?)$ import-cypher -d"," -o test.csv match (p:Product)-[s:SIMILAR_TO]-(q:Product) return p.Id,q.Id limit 10
Query: match (p:Product)-[s:SIMILAR_TO]-(q:Product) return p.Id,q.Id limit 10 infile (none) delim ',' quoted false outfile test.csv batch-size 1000
Error occurred in server thread; nested exception is:
java.lang.NoSuchMethodError: org.neo4j.graphdb.GraphDatabaseService.execute(Ljava/lang/String;)Lorg/neo4j/graphdb/Result;
I just added a new way of exporting data as cypher statements.
https://github.com/jexp/neo4j-shell-tools#cypher-export
(Note this is for Neo4j 2.2.5)
But for 100M rows I think import-cypher -o is still a good approach.
Otherwise check out: http://neo4j.com/blog/export-csv-from-neo4j-curl-cypher-jq/

Which dart2js command is launched by DartEditor?

After reading article found at https://www.dartlang.org/articles/web-ui/tools.html, I tried to compile my application by following it.
My application stored in web/app.html can be successfully compiled to Javascript under DartEditor by using "Run as Javascript" command.
When I try to use following command lines to perform a compilation for deploying in production, I encounter an issue on uncopied package part file.
$ dart --package-root=packages/ packages/web_ui/dwc.dart --out /tmp/dart/ --no-rewrite-urls web/app.html
$ ls lib/app/
model_browser.dart model_server.dart
$ ls lib/app/src/model/
model_browser.dart model_server.dart model_shared.dart
$ cd /tmp/dart
$ dart2js -v app.html_bootstrap.dart --package-root=packages/ -oapp.html_bootstrap.dart.js
...
info: scanning library file:///private/tmp/dart/_from_packages/bm/model_browser.dart
_from_packages/app/model_browser.dart:12:1: Error: Cannot read "_from_packages/app/src/model/model_shared.dart" (OS Error: No such file or directory, errno = 2).
part 'src/model/model_shared.dart';
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
info: Error: compiler cancelled: Error: Cannot read "_from_packages/app/src/model/model_shared.dart" (OS Error: No such file or directory, errno = 2).
...
$ ls _from_packages/app/
model_browser.dart model_browser.dart.map
$ ls _from_packages/app/src/model/
model_browser.dart model_browser.dart.map
In fact, "model_shared.dart" file isn't copied into /tmp/dart/_from_packages/app/src/model/model_shared.dart.
The content of model_browser.dart is following
library model;
import 'dart:json' as json;
import 'package:bm/i18n.dart' as i18n;
import 'package:logging/logging.dart';
import 'package:web_ui/web_ui.dart';
part 'src/model/model_shared.dart';
part 'src/model/model_browser.dart';
DartEditor can launch my application as Javascript. What is the right command line for launching dart2js in order to take into account the "part" statements of my "model" library ?
The issue is linked to "--no-rewrite-urls" option and the absolute path in --out option.
If I remove the "--no-rewrite-urls" option and put a relative path in --out option, the dart2js compilation is successfully done.

Resources