Fix cursor() arguments for connection classes.

In order to use the latest version of psycopg2 with the latest version
of sqlalchemy we must integrate the changes made in the 2.4.6 release of
psycopg2. See
c86ca7687f
and the release notes for psycopg2 2.4.6.
This commit is contained in:
umkay 2016-10-14 00:36:27 -07:00 committed by Tim Abbott
parent 0b7b15b361
commit 278574a6ec
1 changed files with 4 additions and 6 deletions

View File

@ -44,12 +44,10 @@ class TimeTrackingConnection(connection):
self.queries = [] # type: List[Dict[str, str]]
super(TimeTrackingConnection, self).__init__(*args, **kwargs)
def cursor(self, name=None):
# type: (Optional[text_type]) -> TimeTrackingCursor
if name is None:
return super(TimeTrackingConnection, self).cursor(cursor_factory=TimeTrackingCursor)
else:
return super(TimeTrackingConnection, self).cursor(name, cursor_factory=TimeTrackingCursor)
def cursor(self, *args, **kwargs):
# type: (*Any, **Any) -> TimeTrackingCursor
kwargs.setdefault('cursor_factory', TimeTrackingCursor)
return connection.cursor(self, *args, **kwargs)
def reset_queries():
# type: () -> None