Example #1
0
def main(args):
    setup.setup(args.dburl)

    model.metadata.drop_all()
    model.metadata.create_all()

    if args.dumpfile:
        load_data(args)
Example #2
0
def main(args):
    setup.setup(args.dburl)

    model.metadata.drop_all()
    model.metadata.create_all()

    if args.dumpfile:
        load_data(args)
Example #3
0
def main(args):
    setup.setup(args.dburl)

    def dump_tbl(table):
        res = table.select().execute()
        return [ dict(row) for row in res ]
    rv = dict( (tname, dump_tbl(tbl)) for (tname, tbl) in model.metadata.tables.items() )

    output = sys.stdout
    if args.dumpfile:
        output = open(args.dumpfile, "w")
    cPickle.dump(rv, output)
Example #4
0
def main(args):
    setup.setup(args.dburl)

    def dump_tbl(table):
        res = table.select().execute()
        return [dict(row) for row in res]

    rv = dict((tname, dump_tbl(tbl))
              for (tname, tbl) in model.metadata.tables.items())

    output = sys.stdout
    if args.dumpfile:
        output = open(args.dumpfile, "w")
    cPickle.dump(rv, output)
Example #5
0
    def __init__(self, http_port, db_url, db_kwargs={},
                       run_allocator=False, run_ui=False):
        tw_service.MultiService.__init__(self)

        setup.setup(db_url, db_kwargs)

        if run_allocator:
            self.allocator = service.AllocatorService()
            self.allocator.setServiceParent(self)
        else:
            self.allocator = None

        if run_allocator or run_ui:
            self.site = site.Site(self.allocator,
                    run_allocator=run_allocator, run_ui=run_ui)
            self.httpservice = strports.service(http_port, self.site)
            self.httpservice.setServiceParent(self)
Example #6
0
    def __init__(self,
                 http_port,
                 db_url,
                 db_kwargs={},
                 run_allocator=False,
                 run_ui=False):
        tw_service.MultiService.__init__(self)

        setup.setup(db_url, db_kwargs)

        if run_allocator:
            self.allocator = service.AllocatorService()
            self.allocator.setServiceParent(self)
        else:
            self.allocator = None

        if run_allocator or run_ui:
            self.site = site.Site(self.allocator,
                                  run_allocator=run_allocator,
                                  run_ui=run_ui)
            self.httpservice = strports.service(http_port, self.site)
            self.httpservice.setServiceParent(self)