Example #1
0
 def test_save(self):
   h = DumpTruck(dbname = '/tmp/test.db')
   h.insert({'firstname': 'Robert', 'lastname': 'LeTourneau'}, 'foo')
   h.drop('foo')
   self.assertEqual(h.tables(), set([]))
   h.close()
Example #2
0
 def test_save(self):
     h = DumpTruck(dbname="/tmp/test.db")
     h.insert({"firstname": "Robert", "lastname": "LeTourneau"}, "foo")
     h.drop("foo")
     self.assertEqual(h.tables(), set([]))
     h.close()
Example #3
0
 def test_drop_nonexistant_if_exists(self):
   h = DumpTruck(dbname = '/tmp/test.db')
   h.drop(if_exists = True)
Example #4
0
    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:
            bag.add(b)

    # Go
    while True:
        currentbucket = bag.pop()

        if currentbucket == None:
            break

        for newbucket in currentbucket._go():
            bag.add(newbucket)

        log("Committing")
        # Commit at the end in case of errors.
        dt.commit()

        log("Taking a break")  # Don't thrash the server
        sleep(3)


dt.drop("_dumptruckvars")  # Hack to refresh the scraper_run