nicolewhite / cycli Goto Github PK
View Code? Open in Web Editor NEWA Command Line Interface for Neo4j's Cypher.
License: MIT License
A Command Line Interface for Neo4j's Cypher.
License: MIT License
This is in order to support instances secured with HTTPS.
Would it be possible to make a new pypi release? The current latest version (0.7.6) still has the old prompt_toolkit
dependency which is clobbering other installs.
Hi, I tried running a series of queries saved on a file through cycle , but it's complaining that the file is binary?
I was using -f flag. After many trials, i did with --filename and it worked fine !
aren't those two flags have the same behavior?
> RETURN [1,2,3];
[1,2,3]
---------------
['1', '2', '3']
Add an option for starting cycli in read-only mode, where any queries that attempt writing to the database throw some sort of error. Plan: cycli -r
Some queries take longer to be executed than py2neo's default timeout. cycli should provide a way to set this timeout. (py2neo.packages.httpstream.http.socket_timeout)
Hi,
I ran into a known issue, but thought I'd post it here in case others run into it. The problem is with uninstalling the python package six. The issue is discussed here:
pypa/pip#3165
I will probably install python using homebrew and/or use virtualenv.
El Capitan 10.11.4
pip 8.1.1 from /Library/Python/2.7/site-packages (python 2.7)
The error:
~ 62 $ sudo -H pip install cycli
....
Installing collected packages: six, wcwidth
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 726, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 746, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-QVyBM9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
If you arrow-up to a past query, attempting to insert a new line with shift+enter will submit the query. This should be changed so that it inserts a new line.
Hi: I'm not sure if this issue resides with Neo4j or Cycli; I suspect the latter (Cycli), as detailed below.
Problem Description
I prefer to use cypher scripts and Neovim, rather than the Neo4j Browser, for working with data.
However, when I comment-out ( // ...
) lines in the cypher scripts using a keyboard shortcut in Neovim, commented lines lines ending in semicolons throw warnings in Cycli.
The same code pasted into the Neo4j Browser, or the same script loaded into Neo4j via cypher-shell results in reading of the code, with no wrnings.
Thus, when I am writing scripts and and I want to comment out statements that end in a semicolon with my keyboard shortcut (Neovim editor), I ALSO need to go to the end of all of those //-commented lines and delete those semicolons (reversing that tedious process when uncommenting those lines).
That is, if I want to avoid seeing those warnings.
glycolysis_bioentities.csv
[exported form a PostgreSQL database, hence the .csv extension]:
name
α-D-glucose
glucose 6-phosphate
fructose 6-phosphate
"fructose 1,6-bisphosphate"
dihydroxyacetone phosphate
D-glyceraldehyde 3-phosphate
"1,3-bisphosphoglycerate"
3-phosphoglycerate
2-phosphoglycerate
phosphoenolpyruvate
pyruvate
hexokinase
glucose-6-phosphatase
phosphoglucose isomerase
phosphofructokinase
"fructose-bisphosphate aldolase, class I"
triosephosphate isomerase (TIM)
glyceraldehyde-3-phosphate dehydrogenase
phosphoglycerate kinase
phosphoglycerate mutase
enolase
pyruvate kinase
glycolysis.cypher:
LOAD CSV WITH HEADERS FROM "file:/glycolysis_bioentities.csv" AS row
MERGE (n:Glycolysis {name:row.name})
// RETURN n, labels(n), n.name;
RETURN n.name;
// Same:
// MATCH (n) RETURN n.name;
Examples - Cycli :
cycli -P 7474 -u victoria -p <password_obfuscated_here> -f glycolysis.cypher
> LOAD CSV WITH HEADERS FROM "/glycolysis_bioentities.csv" AS row
MERGE (n:Glycolysis {name:row.name})
// RETURN n, labels(n), n.name;
109 ms
> RETURN n.name;
Variable `n` not defined (line 1, column 8 (offset: 7))
"RETURN n.name;"
^
> // Same:
// MATCH (n) RETURN n.name;
Unexpected end of input: expected whitespace, comment, CYPHER options, EXPLAIN, PROFILE or Query (line 2, column 29 (offset: 37))
"// MATCH (n) RETURN n.name;"
^
(py35) [victoria@victoria Vancouver]$
Despite those warnings, the 22 nodes are created in the Neo4j Browser. So it appears to be a warnings-related issue, not a script execution errors.
Compare that shell output to this modified script, where I deleted semicolons at ends of //-commented lines:
LOAD CSV WITH HEADERS FROM "file:/glycolysis_bioentities.csv" AS row
MERGE (n:Glycolysis {name:row.name})
// RETURN n, labels(n), n.name
RETURN n.name;
// Same
// MATCH (n) RETURN n.name
Script execution - Cycli :
cycli -P 7474 -u victoria -p <password_obfuscated_here> -f glycolysis.cypher
> LOAD CSV WITH HEADERS FROM "file:/glycolysis_bioentities.csv" AS row
MERGE (n:Glycolysis {name:row.name})
// RETURN n, labels(n), n.name
RETURN n.name;
n.name
----------------------------------------
α-D-glucose
glucose 6-phosphate
fructose 6-phosphate
fructose 1,6-bisphosphate
dihydroxyacetone phosphate
D-glyceraldehyde 3-phosphate
1,3-bisphosphoglycerate
3-phosphoglycerate
2-phosphoglycerate
phosphoenolpyruvate
pyruvate
hexokinase
glucose-6-phosphatase
phosphoglucose isomerase
phosphofructokinase
fructose-bisphosphate aldolase, class I
triosephosphate isomerase (TIM)
glyceraldehyde-3-phosphate dehydrogenase
phosphoglycerate kinase
phosphoglycerate mutase
enolase
pyruvate kinase
109 ms
Example - cypher-shell :
As mentioned, this does not occur when loading that same .cypher script into cypher-shell, where it runs without issue (resulting in 22 nodes in the Neo4j Browser):
cat glycolysis.cypher | cypher-shell -u victoria -p <password_obfuscated_here>
n.name
"α-D-glucose"
"glucose 6-phosphate"
"fructose 6-phosphate"
"fructose 1,6-bisphosphate"
"dihydroxyacetone phosphate"
"D-glyceraldehyde 3-phosphate"
"1,3-bisphosphoglycerate"
"3-phosphoglycerate"
"2-phosphoglycerate"
"phosphoenolpyruvate"
"pyruvate"
"hexokinase"
"glucose-6-phosphatase"
"phosphoglucose isomerase"
"phosphofructokinase"
"fructose-bisphosphate aldolase, class I"
"triosephosphate isomerase (TIM)"
"glyceraldehyde-3-phosphate dehydrogenase"
"phosphoglycerate kinase"
"phosphoglycerate mutase"
"enolase"
"pyruvate kinase"
Thanks! :-)
cycli console should remember query history even across different sessions, just like neo4j-shell does.
even if there is no semicolon
(perhaps configurable)
cycli -l cypher_logs.txt
a package should specify minimum-dependencies
it should not do exact pinning in setup.py.
If I install this package in my virtual-env, it will upgrade certain packages
that will break my setup, while not necessarily breaking cycli.
Cycli version: 0.7.6
Neo4j version: 3.0.4
______ __ __ ______ __ __
/\ ___\ /\ \_\ \ /\ ___\ /\ \ /\ \
\ \ \____ \ \____ \ \ \ \____ \ \ \____ \ \ \
\ \_____\ \/\_____\ \ \_____\ \ \_____\ \ \_\
\/_____/ \/_____/ \/_____/ \/_____/ \/_/
When creating a node with a semicolon in the property value, the following error was produced. Perhaps the semicolon parsing isn't always being skipped inside quotes?
Please note that the troublesome code is rendered as a left arrow in this Github issue, as that is the HTML entity where the problematic semicolon parsing occurs. View source below to see the semicolon in context, or the attached screenshot of the code here -
MATCH (mno:ghi)
where mno.id = "mno"
CREATE (def:ghi{id:"jkl",stu:"xyz ⇐
Unexpected end of input: expected '', ANY or '"' (line 4, column 131 (offset: 287))
"CREATE (def:ghi{id:"jkl",stu:"xyz ⇐"
^
abc",pqr:"xyz ⇐
Invalid input '1': expected (line 1, column 1 (offset: 0))
"abc",pqr:"xyz ⇐"
^
I tried to redact the actual cypher, and hopefully that doesn't obfuscate it too much. I can add another case where this also happened in a where clause as well if that helps.
Hi Nicole, I'd be happy to help out with tending issues / reviewing PRs if it would help you keep this project alive. I use cycli
regularly, and it'd be great if it could be updated to stay compatible with other libraries! (I'm currently working off a fork which isn't great).
This in order to be able to copy/paste the entire CLI call.
If only username is provided it can prompt for the password, so interactive login method would also be supported.
Autocomplete can be smarter. On startup, in the background, query the graph for all the combinations of (:Label)-[:RELATIONSHIP]-(:Label)
in the graph. Essentially the "what is related and how" query.
When recommending relationship names, only recommend relationships that are possibly attached to the node label to the left, if present. When recommending node labels, only recommend node labels attached to the relationship name to the left, if present. When recommending property keys, only recommend keys that are on the node label that the identifier was created with.
Whether or not cycli retrieves this data in the background should probably be an option, such as cycli -m
or cycli --smart
for smart autocomplete.
i have a database on graphenedb and cycli loaded , how do i connect cycli to the database?
for example I've tried cycli -h http://hobby-mmjhdkmhoeaggbkemnmbakpl.dbs.graphenedb.com:24789/db/data/ and variations
Cypher keywords should be recommended based on typical Cypher usage. Current plan is to scrape queries from all the GraphGists and create a Markov model where each state is a Cypher keyword. It will then be trivial to recommend the next state, or Cypher keyword, based on probability.
When you type any of the following opening characters, a closing version of the character should be inserted to the right of your cursor.
{
--> }
(
--> )
[
--> ]
"
--> "
'
--> '
/\ _\ /\ _\ \ /\ ___\ /\ \ /\
\ \ __ \ ____ \ \ \ ____ \ \ ____ \ \
\ \ /\ \ \ \ \ \ _
// // // // /_/
Using Bolt.
Version: 0.7.5
Bug reports: https://github.com/nicolewhite/cycli/issues
MATCH (d:Species) RETURN d LIMIT 1;
Unable to connect to aws-neo4j on port 7687 - is the server running?
The import files are in "$NEO4J_HOME/import/panama/*"
USING PERIODIC COMMIT 50000
LOAD CSV WITH HEADERS FROM "file:///panama/Intermediaries.csv" AS line
MERGE (n:Node {node_id: line.node_id }) ON CREATE SET n:Intermediary, n += line;
'module' object has no attribute 'SemanticError'
HTTP POST returned response 500
If I run the same query in browser it returns fine.
if currently in suggestion drop down
cycli -f queries.cql
cycli -f queries.cyp
cycli -f queries.cypher
MATCH (n:Asset) RETURN n;
is flagged as a write query because of the word set
being inside Asset
.
neo4j-shell shows time taken in query, cycli shall show it too.
Add a function for detecting if the query is a write query. If it is, update the schema and the autocompleter.
Hi,
I initially filed an issue with py2neo:
https://github.com/technige/py2neo/issues/621
and technige said the issue looks to actually be within cycli. As stated, I was using Neo4j 3.1.1 and have the latest version of cycli off of pypi.
I have not updated Neo4j to 3.2 as there was some issue with updating the data in my database, haven't gotten around to seeing if they've fixed that yet. I forget the details, I got some vague sense that Neo4j had some issues around authorization at the time. But I haven't needed to revisit that project yet.
Using cycli it appears I can not create a begin..commit transaction, as evidence
begin
match (n) return n limit 1;
Invalid input 'b': expected (line 1, column 1 (offset: 0))
"begin"
^
of note the type ahead feature does include COMMIT in the drop down available text but does not include BEGIN
Hello,
I noticed that you get the following error when you have non-ASCII characters in your data:
'ascii' codec can't decode byte 0xc4 in position 18: ordinal not in range(128)
This is with Python 2.7.6. I haven't tried with Python 3+ yet but I would expect that to work.
So that people don't get confused about what is cycli and what is Cypher.
Properties aren't displayed if cycli thinks the user is typing a float. E.g.,
MATCH (p:Person) WHERE p.age > 5.
won't bring up a menu of properties. However, we do want properties in the case of identifiers that end in numbers:
MATCH (p1:Person) WHERE p1.
At the point above, properties should be displayed. Currently they are not because the current algorithm only checks the most previous character, not the entire identifier.
I'm having troubles connecting with a database hosted in GrapheneDB using cycli 0.7.6
.
I'm only able to connect databases with Neo4j version < 3.
If I try the same parameters that I used to connect with a database >= 3, I get the following:
$cycli -u USERNAME -p PASS -h hobby-fdaalmhijildgbkemjfeffnl.dbs.graphenedb.com -P 24789
Cycli version: 0.7.6
Neo4j version: 3.0.6
Bug reports: https://github.com/nicolewhite/cycli/issues
> MATCH (n) RETURN count(n);
[Errno 110] Connection timed out
I think passing bolt=None
to py2neo makes it try to connect via Bolt. The database version is >= 3, but GrapheneDB uses a non-standard port for Bolt connections and also needs to use TLS secure connections. I managed to connect to my database using py2neo with the following options:
Graph("bolt://hobby-fdaalmhijildgbkemjfeffnl.dbs.graphenedb.com:24786", user=USERNAME, password=PASS, bolt=True, secure = True, http_port = 24789)
It would be great if you can add more options to be able to use your tool for GrapheneDB (at least: bolt, bolt_port). Currently, with databases >= 3 is not possible to connect with neither HTTP/HTTPS, nor Bolt protocol.
Hi Nicole!
Can we turn off / disable the echoing of the cypher script contents during the script executions, e.g. as shown in my comment here? :
That issue also raises the subject of the commenting of cypher statements in cypher scripts, which throws errors in Cycli (but not cypher-shell). I believe that is a Neo4j issue (hence, my post there)?
Thanks again for all your work; e.g. #60 -- I am thrilled that you continue to support Cycli, which is the best cypher CLI, IMO. :-D
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.