Skip to content

Issue: Switch to psycopg3 breaks SQLAlchemy default connection (psycopg2 missing) #788

@gabrielmouta

Description

@gabrielmouta

From this section:
https://github.com/DataTalksClub/data-engineering-zoomcamp/blob/main/01-docker-terraform/docker-sql/05-data-ingestion.md

From this commit:
c9e8112

This change from:

uv add sqlalchemy psycopg2-binary

to:

uv add sqlalchemy "psycopg[binary,pool]"

is crashing the next line:

engine = create_engine("postgresql://root:root@localhost:5432/ny_taxi")

with the error:

ModuleNotFoundError: No module named 'psycopg2'

I noticed that in another commit/file the connection string was updated to psycopg3, but that version requires defining several additional variables:

engine = create_engine(f'postgresql+psycopg://{pg_user}:{pg_pass}@{pg_host}:{pg_port}/{pg_db}')

Originally posted by @gabrielmouta in #782 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions