diff --git a/nilmdb/nilmdb.py b/nilmdb/nilmdb.py index af0ecfd..453bd3f 100644 --- a/nilmdb/nilmdb.py +++ b/nilmdb/nilmdb.py @@ -291,16 +291,6 @@ class NilmDB(object): if group == '': raise ValueError("invalid path") - # Make the group structure, one element at a time - group_path = group.lstrip('/').split("/") - for i in range(len(group_path)): - parent = "/" + "/".join(group_path[0:i]) - child = group_path[i] - try: - self.h5file.createGroup(parent, child) - except tables.NodeError: - pass - # Get description try: desc = nilmdb.layout.get_named(layout_name).description() @@ -314,7 +304,8 @@ class NilmDB(object): # Create the table table = self.h5file.createTable(group, node, description = desc, - expectedrows = exp_rows) + expectedrows = exp_rows, + createparents = True) # Insert into SQL database once the PyTables is happy with self.con as con: