Git Product home page Git Product logo

cycli's People

Contributors

danodonovan avatar ikwattro avatar jonathanslenders avatar jotomo avatar nicolewhite avatar nogweii avatar snow01 avatar technige avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cycli's Issues

Using -f is opening the file in binary mode

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?

Add read-only mode

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

Setting a custom timeout

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)

Can't pip install cycli on python 2.7

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'

Cycli should support query parameters

Cycli currently can't execute Cypher queries using query parameters. It passes back compilation errors from the Cypher engine when parameters are referenced in a query, but it doesn't provide a way to define or examine their values, e.g. by using export or env as in the neo4j-shell client.

image

Cypher interpretation of commented lines ending in semicolons

  • Neo4j version: 3.3.4
  • Operating system: Arch Linux x86_64 | XFCE
  • API/Driver: Cypher { cypher-shell: .../neo4j-community-3.3.4/bin/neo4j-shell | cycli 0.7.6}
  • Web browser: Firefox 59.0.2 (64-bit)
    • ditto: Chrome 65.0.3325.181 (Official Build) (64-bit) | Opera 52.0.2871.40
  • Neo4j Browser version: 3.1.4
  • Python versions: 3.6.4 (home env); 3.5.3 (venv)
    ** Cycli (pull #60 updated) is running in the Py3.5 venv

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! :-)

remember query history

cycli console should remember query history even across different sessions, just like neo4j-shell does.

do not pin packages in setup.py

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.

Add obnoxious ascii-art welcome message

 ______     __  __     ______     __         __    
/\  ___\   /\ \_\ \   /\  ___\   /\ \       /\ \   
\ \ \____  \ \____ \  \ \ \____  \ \ \____  \ \ \  
 \ \_____\  \/\_____\  \ \_____\  \ \_____\  \ \_\ 
  \/_____/   \/_____/   \/_____/   \/_____/   \/_/ 

Semicolon in quoted property seems to be incorrectly interpreted as end of cypher statement

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 -

screenshot_20161208-231228-02


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.

Don't suggest relationships when inside curly braces

When the current character is :, the current if-else logic first checks to see if the latest non-alpha is a (, where it suggest node labels. Otherwise, it suggests relationship types. In the case that the latest non-alpha is a {, suggest nothing.

Bad:

bad

Support Offer

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).

Add optional parameter for the password

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.

Smart autocomplete on labels, relationship types, and properties

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.

Smart autocomplete on Cypher keywords with a Markov model

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.

Trying to run periodic commit results in an error

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.

Exceptions when using cycli with no authorization required

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.

request for support of begin..commit; transactions

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

ASCII can't decode error with UTF-8 data in Neo4j

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.

Properties aren't autocompleting on identifiers that end in numbers

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.

Not able to connect with database with non-standard bolt port and TLS

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.

Feature request: turn off echo

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? :

neo4j/neo4j#5901 (comment)

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.