Nov 20: Neo4j, Graph Model
Learning Objectives
After today's class, you should be able to:
- Compare Neo4j's graph model with the relational database model.
- Write basic Cypher queries using pattern matching and filtering.
Lesson Outline¶
Hints/Tips [15 min]
Lecture [35 min]
- NoSQL Databases
(Source: pdbmbook.com)
- Slides 70–74: Graph Based Databases (Neo4j)
- Slides 75–86: Cypher Overview / Social Graph
- Documentation
Mini Lab [25 min]
- Writing Queries for Neo4j
- Submit your notes to Gradescope
Hints and Tips¶
HW5 Hints
- Three SELECT statements in a subquery
- Use EXCEPT
- LEFT JOIN
- Two subqueries,
> interval '10 minutes' - SELECT DISTINCT in subquery
- Similar in structure to #5
- PARTITION BY "course"
- Get total enrollment by subject
GP6 Preview
- Your project is due in two weeks
- Prepare your final presentation
profs Updates
- In app.py, using standard
SQLAlchemyinstead of the legacyget_sqla_class()function. The legacy function was based on outdated examples. - In app.py, using an application factory pattern by defining a
create_app()function. Theflask runcommand recognizes and calls this function automatically. Works better for non-trivial apps. - In menu.py, moved the
from views import ...into thesetup_menu()function. This solves the circular import problem, because theappmodule will finish importing before this function is called. - In forms.py, can now
from app import dbonce at the top, rather than in each method (because of change #4).