Don't needlessly copy all the records.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
This commit is contained in:
brian m. carlson 2014-03-17 22:39:20 +00:00
parent b78eeba4c9
commit 455acb833c
No known key found for this signature in database
GPG key ID: BF535D811F52F68B

6
newfol
View file

@ -1012,12 +1012,12 @@ def import_into(db, dtbname, dbtype, minfields=0, strict=False, identity=False):
def export_from(db, table, dbtype): def export_from(db, table, dbtype):
vault = filemanip.FileStorage(dbtype, sys.stdout) vault = filemanip.FileStorage(dbtype, sys.stdout)
recs = db.records() f = lambda x: True
if table is None and dbtype == "csv": if table is None and dbtype == "csv":
raise newfol.exception.NewfolError("A table is required for csv") raise newfol.exception.NewfolError("A table is required for csv")
if table is not None: if table is not None:
recs = db.records(lambda x: x.table == table) f = lambda x: x.table == table
vault.store(recs) vault.store(db.records(f))
def parse_args(args): def parse_args(args):
parser = argparse.ArgumentParser(description="store and manipulate fol") parser = argparse.ArgumentParser(description="store and manipulate fol")