MCPcopy
hub / github.com/gunthercox/ChatterBot / close

Method close

chatterbot/storage/sql_storage.py:472–483  ·  view source on GitHub ↗

Close the database connection and dispose of the engine. This ensures proper cleanup of resources.

(self)

Source from the content-addressed store, hash-verified

470 Base.metadata.create_all(self.engine)
471
472 def close(self):
473 """
474 Close the database connection and dispose of the engine.
475 This ensures proper cleanup of resources.
476 """
477 # Remove thread-local sessions from scoped_session registry
478 if hasattr(self, 'Session'):
479 self.Session.remove()
480
481 # Dispose of the connection pool
482 if hasattr(self, 'engine'):
483 self.engine.dispose()

Callers 11

test_set_database_uriMethod · 0.95
set_sqlite_pragmaMethod · 0.45
countMethod · 0.45
removeMethod · 0.45
filterMethod · 0.45
createMethod · 0.45
create_manyMethod · 0.45
updateMethod · 0.45
get_randomMethod · 0.45
dropMethod · 0.45

Calls 1

removeMethod · 0.45

Tested by 2

test_set_database_uriMethod · 0.76