Skip to content

Conversation

Copy link

Copilot AI commented Nov 15, 2025

Implements a type-safe Python client for the Neo4j aviation database with repository pattern, Pydantic models, and parameterized queries.

Package Structure

  • neo4j_client/ - Core library (893 LOC)

    • models.py - 9 Pydantic models (Aircraft, Airport, Flight, System, Component, Sensor, Reading, MaintenanceEvent, Delay)
    • repository.py - 4 repository classes with CRUD operations
    • connection.py - Connection manager with context manager support
    • exceptions.py - Custom exception hierarchy
  • tests/ - Integration test suite (376 LOC)

    • Uses testcontainers for Neo4j
    • 15 tests covering CRUD operations and error handling
  • Documentation

    • README_CLIENT.md - Usage examples and API reference
    • example_usage.py - Working demonstration
    • pyproject.toml - PEP 621 packaging

Usage Example

from neo4j_client import Neo4jConnection, AircraftRepository, Aircraft

with Neo4jConnection(uri, username, password) as conn:
    session = conn.get_session()
    repo = AircraftRepository(session)
    
    # Create aircraft
    aircraft = Aircraft(
        aircraft_id="AC001",
        tail_number="N12345",
        model="Boeing 737-800",
        operator="Example Airlines",
        manufacturer="Boeing"
    )
    repo.create(aircraft)
    
    # Query with type safety
    found = repo.find_by_tail_number("N12345")
    flights = repo.find_by_aircraft("AC001", limit=100)

Security

All Cypher queries use parameterized placeholders. No string interpolation or f-strings in query construction.

query = """
MATCH (a:Aircraft {aircraft_id: $aircraft_id})
RETURN a
"""
result = session.run(query, aircraft_id=aircraft_id)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 0.0.0.0.in-addr.arpa
    • Triggering command: /opt/java/openjdk/bin/java -cp /var/lib/neo4j/plugins/*:/var/lib/neo4j/conf/*:/var/lib/neo4j/lib/* -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024 -Dio.netty.tryReflectionSetAccessible=true -Djdk.tls.ephemeralDHKeySize=2048 -Djdk.tls.rejectClientInitiatedRenegotiation=true -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED -Dlog4j2.disable.jmx=true -Dfile.encoding=UTF-8 org.neo4j.server.CommunityEntryPoint --home-dir=/var/lib/neo4j --config-dir=/var/lib/neo4j/conf --console-mode (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Create a pyton client for the neo4j db

Custom agent used: neo4j-local-client-generator
A basic demo agent for testing Neo4j graph database integration with Python MCP server


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add Python client for Neo4j database Add Python client library for Neo4j aviation database Nov 15, 2025
Copilot AI requested a review from ZaidZaim November 15, 2025 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants