home / docs / sections

Menu

sections: internals:database-close

This data as json

id page ref title content breadcrumbs references
internals:database-close internals database-close db.close() Release all resources held by this Database instance. This shuts down the background write thread (if one was started by a previous call to await db.execute_write_fn(fn, block=True, transaction=True) or similar), closes the write connection, and closes any cached read connections. After db.close() has been called, any further call to await db.execute(sql, ...) , await db.execute_fn(fn) , await db.execute_write(sql, params=None, block=True) , await db.execute_write_fn(fn, block=True, transaction=True) , await db.execute_write_many(sql, params_seq, block=True) , await db.execute_write_script(sql, block=True) or await db.execute_isolated_fn(fn) will raise a datasette.database.DatasetteClosedError exception. close() is idempotent — calling it a second time is a no-op. It is one-way: a closed Database cannot be reopened. ["Internals for plugins", "Database class"] []
Powered by Datasette · Queries took 4.84ms