Skip to content

DOC: pd.read_sql() connection disposal for str type connections  #35495

Closed
@AdamSpannbauer

Description

@AdamSpannbauer

This is in between a documentation issue and a general question.

Location of the documentation

pd.read_sql()

Documentation problem

The documentation notes that if the con is a SQLAlchemy connectable that the user is responsible for disposing/closing. The documentation doesn't note whether the connection is closed if the user provides a str to the con parameter. In my quick search, I couldn't find a reference to .dispose()/.close() in the source code when the user provides a str type con. Is this connection being closed? Is it being left up to garbage collection as noted in SQLAlchemy docs?

Suggested fix for documentation

I think a note about connection closure for str type cons would be a nice addition. Right now, if I'm understanding correctly, the connection is being garbage collected and the user needs to infer from the docs that they don't need to worry about an open connection.

Current wording:

The user is responsible for engine disposal and connection closure for the SQLAlchemy connectable.

Potential wording:

The user is responsible for engine disposal and connection closure for the SQLAlchemy connectable; str connections are closed automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions