get_cursor¶
-
GenericDBWrapper.get_cursor(cursor_name=None, cursor_class=None, *args, **kwargs) → Union[privex.db.base.CursorManager, privex.db.types.GenericCursor][source]¶ Create and return a new database cursor object, by default the cursor will be wrapped with
CursorManagerto ensure context management (withstatements) works regardless of whether the database API supports context managing cursors (e.g.sqlitedoes not support cursor contexts).For sub-classes, you should override
_get_cursor(), which returns an actual native DB cursor.- Parameters
- Key bool cursor_mgr
(Default:
True) If True, wrap the returned cursor withCursorManager- Key callable close_callback
(Default:
None) Passed ontoCursorManager- Return GenericCursor cursor
A cursor object which should implement at least the basic Python DB API Cursor functionality as specified in
GenericCursor((PEP 249)