Sqlite3InMemoryConnection
- class PlasmaCalcs.tools.sql_tools.Sqlite3InMemoryConnection(*, con=None, _owner_close_con_on_delete=True)
Bases:
objectclass which mimics a database connection to an in-memory database.
Behaves like sqlite3.connect(‘:memory:’) but will not close() upon __exit__.Allows consistent interface with “with” blocks without losing the in-memory connection,as long as the InMemoryConnection object itself is kept alive.con: None or sqlite3.Connectionconnection to in-memory database.If None, creates new sqlite3.Connection to ‘:memory:’._owner_close_con_on_delete: boolwhether self should try to close self.con when self is about to be deleted.Only applies if self created con, i.e. con not None during init.Methods
__del__()delete self; if self owns con and _owner_close_con_on_delete, close con.
enter "with" block; returns self (which behaves like sqlite3.Connection)
__exit__(exc_type, exc_value, traceback)exit "with" block; does NOT close connection.
__getattr__(name)pass through any other attribute access to self.con
- __del__()
delete self; if self owns con and _owner_close_con_on_delete, close con.
- __enter__()
enter “with” block; returns self (which behaves like sqlite3.Connection)
- __exit__(exc_type, exc_value, traceback)
exit “with” block; does NOT close connection.
- __getattr__(name)
pass through any other attribute access to self.con