Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
py2neo 1.6

py2neo 1.6

@technige
(py2neo 1.6)-[:IS_BUILT_FOR]->(Neo4j 2.0)

py2neo 1.6

@technige
What's new?
●

Cypher transactions

●

Label support

●

Schema index support (but not constraints)

●

Better Unicode sup...
What else?
●

Neotool shell

●

Gremlin removed (see py2neo-gremlin)

●

Load2neo integration

py2neo 1.6

@technige
Cypher Transactions
Server

Client
Session
Transaction

Transaction

Statement
Statement
Statement
Statement
Statement
Sta...
Cypher Transactions
>>> from py2neo import cypher
>>> session = cypher.Session("http://arthur:excalibur@camelot:7474")
>>>...
Node Labels
Node.add_labels(*labels)
Add one or more labels to this node.
>>> from py2neo import neo4j, node
>>> graph_db ...
Node Labels
Node.remove_labels(*labels)
Remove one or more labels from this node.

Node.get_labels()
Fetch all labels asso...
Neotool Shell
$ neotool shell -U arthur -W excalibur -H camelot
Neotool Shell (py2neo/1.6.1 Python/2.7.3-final-0)
Copyrigh...
https://pypi.python.org/pypi/py2neo
~
https://github.com/nigelsmall/py2neo

py2neo 1.6

@technige
Upcoming SlideShare
Loading in …5
×

Py2neo 1.6

2,242 views

Published on

My lightning talk on a few of the new bits of py2neo 1.6 from the London Graph Café (27 Nov 2013)

Published in: Business, Technology
  • Be the first to comment

Py2neo 1.6

  1. 1. py2neo 1.6 py2neo 1.6 @technige
  2. 2. (py2neo 1.6)-[:IS_BUILT_FOR]->(Neo4j 2.0) py2neo 1.6 @technige
  3. 3. What's new? ● Cypher transactions ● Label support ● Schema index support (but not constraints) ● Better Unicode support ● Improved streaming for Cypher and batches ● Implicit authentication py2neo 1.6 @technige
  4. 4. What else? ● Neotool shell ● Gremlin removed (see py2neo-gremlin) ● Load2neo integration py2neo 1.6 @technige
  5. 5. Cypher Transactions Server Client Session Transaction Transaction Statement Statement Statement Statement Statement Statement py2neo 1.6 execute commit rollback @technige
  6. 6. Cypher Transactions >>> from py2neo import cypher >>> session = cypher.Session("http://arthur:excalibur@camelot:7474") >>> tx = session.create_transaction() >>> tx.append("MERGE (a:Person {name:'Alice'}) RETURN a") >>> tx.append("MERGE (b:Person {name:'Bob'}) RETURN b") >>> tx.append("MATCH (a), (b) WHERE a.name = 'Alice' AND b.name = 'Bob' " "CREATE UNIQUE (a)-[ab:KNOWS]->(b) RETURN ab") >>> tx.commit() [[Record(columns=(u'a',), values=(Node('.../node/1'),))], [Record(columns=(u'b',), values=(Node('.../node/2'),))], [Record(columns=(u'ab',), values=(Relationship('.../relationship/1'),))]] py2neo 1.6 @technige
  7. 7. Node Labels Node.add_labels(*labels) Add one or more labels to this node. >>> from py2neo import neo4j, node >>> graph_db = neo4j.GraphDatabaseService() >>> alice, = graph_db.create(node(name="Alice")) >>> alice.add_labels("female", "human") py2neo 1.6 @technige
  8. 8. Node Labels Node.remove_labels(*labels) Remove one or more labels from this node. Node.get_labels() Fetch all labels associated with this node. GraphDatabaseService.find(label, property_key=None, property_value=None) Iterate through a set of labelled nodes, optionally filtering by property key and value. py2neo 1.6 @technige
  9. 9. Neotool Shell $ neotool shell -U arthur -W excalibur -H camelot Neotool Shell (py2neo/1.6.1 Python/2.7.3-final-0) Copyright 2013, Nigel Small camelot:7474/cypher> MATCH (a) RETURN a LIMIT 3 a ---------------------(1 {"name":"Alice"}) (2 {"name":"Bob"}) (3 {"name":"Carol"}) (3 rows) py2neo 1.6 @technige
  10. 10. https://pypi.python.org/pypi/py2neo ~ https://github.com/nigelsmall/py2neo py2neo 1.6 @technige

×