本文整理汇总了Python中psycopg2.extensions.connection.cursor函数的典型用法代码示例。如果您正苦于以下问题:Python cursor函数的具体用法?Python cursor怎么用?Python cursor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cursor函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cursor
def cursor (self, fetchsize = None):
"Return a psycopg2 Cursor object for operating on the connection."
if fetchsize:
# Tell psycopg2 to create a server-side cursor so that it will
# return the results in batches of the indicated size instead of
# retrieving all results on the first fetch.
#name = some unique, valid cursor name
#curs = pgConnection.cursor (self, name)
#curs.itersize = fetchsize
raise NotImplementedError ('Need algorithm for unique cursor name.')
else:
curs = pgConnection.cursor (self)
return curs
示例2: cursor
def cursor(self):
# DictCursor allows for both integer and key based row access
return _2connection.cursor(self, cursor_factory=DictCursor)
示例3: cursor
def cursor(self):
"""cursor() -> new psycopg 1.1.x compatible cursor object"""
return _2connection.cursor(self, cursor_factory=cursor)
示例4: cursor
def cursor(self, *args, **kwargs):
# type: (*Any, **Any) -> TimeTrackingCursor
kwargs.setdefault('cursor_factory', TimeTrackingCursor)
return connection.cursor(self, *args, **kwargs)
示例5: cursor
def cursor(self, name=None):
if name is None:
return _connection.cursor(self, cursor_factory=DictCursor)
else:
return _connection.cursor(self, name, cursor_factory=DictCursor)
示例6: cursor
def cursor(self):
return _connection.cursor(self, cursor_factory=DictCursor)
示例7: cursor
def cursor(self, *args, **kwargs):
kwargs['cursor_factory'] = NamedTupleCursor
return _connection.cursor(self, *args, **kwargs)