本文整理汇总了Python中dumptruck.DumpTruck.save_var方法的典型用法代码示例。如果您正苦于以下问题:Python DumpTruck.save_var方法的具体用法?Python DumpTruck.save_var怎么用?Python DumpTruck.save_var使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dumptruck.DumpTruck
的用法示例。
在下文中一共展示了DumpTruck.save_var方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import save_var [as 别名]
def setUp(self):
self.cleanUp()
h = DumpTruck(dbname=u"/tmp/test.db")
h.save_var(u"birthday", u"November 30, 1888")
h.close()
connection = sqlite3.connect(u"/tmp/test.db")
self.cursor = connection.cursor()
示例2: setUp
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import save_var [as 别名]
def setUp(self):
self.cleanUp()
h = DumpTruck(dbname = u'/tmp/test.db')
h.save_var(u'birthday', u'November 30, 1888')
h.close()
connection=sqlite3.connect(u'/tmp/test.db')
self.cursor=connection.cursor()
示例3: savegetvar
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import save_var [as 别名]
def savegetvar(self, var):
h = DumpTruck(dbname="/tmp/test.db")
h.save_var(u"weird", var)
h.close()
h = DumpTruck(dbname="/tmp/test.db")
t = os.stat("/tmp/test.db").st_mtime
self.assertEqual(h.get_var(u"weird"), var)
h.close()
assert os.stat("/tmp/test.db").st_mtime == t
示例4: savegetvar
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import save_var [as 别名]
def savegetvar(self, var):
h = DumpTruck(dbname = '/tmp/test.db')
h.save_var(u'weird', var)
h.close()
h = DumpTruck(dbname = '/tmp/test.db')
t=os.stat('/tmp/test.db').st_mtime
self.assertEqual(h.get_var(u'weird'), var)
h.close()
assert os.stat('/tmp/test.db').st_mtime==t
示例5: save
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import save_var [as 别名]
def save(self, key, value):
h = DumpTruck(dbname = u'/tmp/test.db')
h.save_var(key, value)
h.close()
示例6: savegetvar
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import save_var [as 别名]
def savegetvar(self, var):
h = DumpTruck(dbname = '/tmp/test.db')
h.save_var(u'weird', var)
self.assertEqual(h.get_var(u'weird'), var)
h.close()
示例7: set
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import save_var [as 别名]
# We initialize DumpTruck, with dummy data that won't be inserted.
dump_truck.create_table(
{
"stored_filename": "filename.20130227205616.tgz",
"size": 1,
"metadata": {"is_enc": False},
"backup_date": 1361994976,
"filename": "filename",
"backend": "s3",
"is_deleted": False,
"last_updated": 1361994976,
"tags": [],
"backend_hash": "backendhash",
},
"backups",
)
dump_truck.create_index(["stored_filename"], "backups", unique=True)
if not "inventory" in dump_truck.tables():
dump_truck.create_table({"filename": "filename", "archive_id": "glacier-archive-id"}, "inventory")
dump_truck.create_index(["filename"], "inventory", unique=True)
if not "jobs" in dump_truck.tables():
dump_truck.create_table({"filename": "filename", "job_id": "job_id"}, "jobs")
dump_truck.create_index(["filename"], "jobs", unique=True)
if not "config" in dump_truck.tables():
dump_truck.save_var("client_id", "")
dump_truck.save_var("sync_ts", 0)
dump_truck.save_var("tags", set())
示例8: reference
# 需要导入模块: from dumptruck import DumpTruck [as 别名]
# 或者: from dumptruck.DumpTruck import save_var [as 别名]
# The first entry has no ancestors, so it has to make its own entry.
if self.motherbucket == None:
dt.insert({"scraper_run": scraper_run, "kwargs": self.kwargs}, self.bucket)
return childbuckets
def reference(self):
# For linking scraped data to this row
return {"kwargs": self.kwargs, "motherkwargs": self.motherkwargs, "scraper_run": scraper_run}
try:
scraper_run = dt.get_var("scraper_run")
except:
scraper_run = datetime.date.today().isoformat()
dt.save_var("scraper_run", scraper_run)
def excavate(bucketclasses=[], startingbuckets=[]):
"Start everything."
# Bucket classes (page types)
if bucketclasses == []:
for g in globals().values():
if isinstance(g, BucketMold) and g != BucketMold:
bucketclasses.append(g)
bag = Bag(buckets=bucketclasses)
# The seed buckets
if dt.execute('select count(*) as "c" from `%s`' % bag._table_name)[0]["c"] == 0:
for b in startingbuckets: