Course · Part of Graph Application Development

Using Neo4j with Python

Learn to connect Python applications to Neo4j with the official Python driver. Run Cypher queries, stream results into pandas, and handle errors.

1 hour15 lessons across 3 modules
About this course

In this 1-hour course, you will learn

Neo4j and Python work together through the official Neo4j Python driver, and this course teaches you how to use it. You will install the driver, connect to a Neo4j database, run CypherNeo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. queries from Python code, work with the results, and apply the transaction and error handling patterns that production applications depend on.

Python and Neo4j are a natural pair. Data engineers use Python to move data in and out of the graph, backend developers expose graph queries through APIs built with frameworks such as FastAPI, Flask, and Django, and data scientists pull connected data into pandas for analysis. Whatever you are building, the driver is the supported, first-party way to talk to Neo4j from Python, and the patterns you learn here apply to all of those projects.

  • Driver Life Cycle

    Understand how to create, reuse, and close the Neo4j driver correctly so your application manages connections efficiently and avoids resource leaks.

  • Installing and Instantiation

    Install the official Neo4j Python driver and instantiate a driver instance configured with the correct URI, credentials, and connection options.

  • Read and Write Transactions

    Write read and write transactions using managed transaction functions, ensuring queries execute with the correct access mode and automatic retry behaviour.

  • Best Practices

    Apply production-ready patterns including connection verification, parameter injection to prevent injection attacks, and proper session scoping for Python applications.

  • Who this course is for

    Python developers who want to read and write Neo4j data from their own code: backend developers adding a graph database to an application, data engineers building pipelines that move connected data, and data scientists who want query results delivered straight into a pandas DataFrame. You should have a working knowledge of Python and pip, and be comfortable with the basics of Neo4j and CypherNeo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. first — the prerequisite courses are listed beside this overview. No previous experience with the driver itself is needed; the course starts with installation and builds up one concept at a time, so it works equally well as a first introduction and as a structured refresher.

  • What you'll build and do

    This is a hands-on course built around short lessons followed by challenges that check your code against a live database. You will install the driver with pip, create a driver instance using a neo4j+s:// connection string, run your first CypherNeo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. queries with execute_query(), pass parameters safely instead of concatenating strings, and unpack the records that come back.

    You will then move beyond simple values. You will access nodesA vertex in a graph. In a property graph it can carry labels and properties. and relationshipsA named, directed connection between two nodes. Every relationship has a type, a start node and an end node. returned by your queries, read their labelsA tag on a node that groups it with other nodes of the same kind. A node can carry more than one., types, and propertiesA named value stored on a node or a relationship., convert an entire result into a pandas DataFrame with a single result transformer, and handle Cypher's temporal and spatial values in Python. You finish by writing transaction functions and error handling code that keep your application running when something goes wrong.

  • Where to go next

    With the driver in your toolkit, a strong next step is Neo4j & GenerativeAI Fundamentals, where you combine Neo4j with large language models and vector searchFinding the records whose vectors lie closest to a query vector. using the Python-based GraphRAGRetrieval-augmented generation whose context comes from a knowledge graph, so the model can follow the relationships between facts. package. To sharpen the queries you send through the driver, Intermediate Cypher Queries covers filtering, aggregation, and query tuning in depth. This course also counts toward your preparation for the Neo4j Certified Professional exam, which validates your knowledge of Neo4j fundamentals, CypherNeo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it., and application patterns like the ones you practice here.