File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -5526,13 +5526,23 @@ below and the SQLAlchemy `documentation <https://docs.sqlalchemy.org/en/latest/c
55265526 # Create your engine.
55275527 engine = create_engine(" sqlite:///:memory:" )
55285528
5529- If you want to manage your own connections you can pass one of those instead:
5529+ If you want to manage your own connections you can pass one of those instead. The example below opens a
5530+ connection to the database using a Python context manager that automatically closes the connection after
5531+ the block has completed.
5532+ See the `SQLAlchemy docs <https://docs.sqlalchemy.org/en/latest/core/connections.html#basic-usage >`__
5533+ for an explanation of how the database connection is handled.
55305534
55315535.. code-block :: python
55325536
55335537 with engine.connect() as conn, conn.begin():
55345538 data = pd.read_sql_table(" data" , conn)
55355539
5540+ .. warning ::
5541+
5542+ When you open a connection to a database you are also responsible for closing it.
5543+ Side effects of leaving a connection open may include locking the database or
5544+ other breaking behaviour.
5545+
55365546Writing DataFrames
55375547''''''''''''''''''
55385548
You can’t perform that action at this time.
0 commit comments