本文整理汇总了Python中db.DB属性的典型用法代码示例。如果您正苦于以下问题:Python db.DB属性的具体用法?Python db.DB怎么用?Python db.DB使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类db
的用法示例。
在下文中一共展示了db.DB属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import db [as 别名]
# 或者: from db import DB [as 别名]
def __init__(self, dbenv=None):
self.db = db.DB(dbenv)
self._closed = True
if HIGHEST_PROTOCOL:
self.protocol = HIGHEST_PROTOCOL
else:
self.protocol = 1
示例2: __getattr__
# 需要导入模块: import db [as 别名]
# 或者: from db import DB [as 别名]
def __getattr__(self, name):
"""Many methods we can just pass through to the DB object.
(See below)
"""
return getattr(self.db, name)
#-----------------------------------
# Dictionary access methods
示例3: __iter__
# 需要导入模块: import db [as 别名]
# 或者: from db import DB [as 别名]
def __iter__(self) : # XXX: Load all keys in memory :-(
for k in self.db.keys() :
yield k
# Do this when "DB" support iteration
# Or is it enough to pass thru "getattr"?
#
# def __iter__(self) :
# return self.db.__iter__()
示例4: __init__
# 需要导入模块: import db [as 别名]
# 或者: from db import DB [as 别名]
def __init__(self, dbenv, *args, **kwargs):
# give it the proper DBEnv C object that its expecting
self._cobj = db.DB(*((dbenv._cobj,) + args), **kwargs)
# TODO are there other dict methods that need to be overridden?
示例5: parseArgs
# 需要导入模块: import db [as 别名]
# 或者: from db import DB [as 别名]
def parseArgs():
parser = argparse.ArgumentParser(prog=sys.argv[0], description="Parse SQLite3 DB from NVprof or Nsight.")
parser.add_argument("file",
type=str,
default=None,
help="SQLite3 database.")
args = parser.parse_args()
return args
示例6: setUp
# 需要导入模块: import db [as 别名]
# 或者: from db import DB [as 别名]
def setUp(self):
self.db = DB(username='glamp', dbname='Chinook', dbtype='postgres')
示例7: setUp
# 需要导入模块: import db [as 别名]
# 或者: from db import DB [as 别名]
def setUp(self):
self.db = DB(username='root', dbname='Chinook', dbtype='mysql')