def get_table(self, name): table = Table(name) if (lstore.globals.diskManager.open_table_file(name, table) == None): return None else: lstore.globals.tables.append(table) return table
def create_table(self, name, num_columns, key): if (lstore.globals.diskManager.new_table_file(name, key, num_columns) ): # check if new table file was successfully created table = Table(name, key, num_columns) lstore.globals.tables.append(table) return table else: return None
def create_table(self, name, num_columns, key): table = Table(name, num_columns, key) BufferPool.init_latest_tail(name) BufferPool.init_tps(name) # create a new table in database self.tables.append(table) # table.mergeProcessController() return table
def create_table(self, name, num_columns, key): expanded = os.path.expanduser(self.filename) db_file = open(expanded, "rb") db = pickle.load(db_file) db_file.close() self.tables.append( Table(name, num_columns, key, self.bp, Index(num_columns))) return self.tables[len(self.tables) - 1]
def open(self, path): self.path = Path(path) if self.path.exists(): if not self.path.is_dir(): raise Exception("path is not a directory") else: self.path.mkdir(exist_ok=True) for child in self.path.iterdir(): if child.is_dir(): table = Table.read_table_from_dir(child) self.tables[child.name] = table
def create_table(self, name, num_columns, key): table = Table(name, key, num_columns, self.bufferpool, latest_range_index=-1, base_current_rid=0, tail_current_rid=Config.MAX_RID, tail_tracker=[], merge_tracker=[], base_tracker=[]) self.tables.update({name: table}) # insert table with name return table
def create_table(self, name: str, num_columns: int, key: int): assert name != None,\ "Must enter valid name" assert name not in self.tables,\ "Table name taken: " + name assert key in range(num_columns),\ "Key must be in range of num_columns: " + str(range(num_columns)) assert num_columns >= 1,\ "Table must have at least 1 data column" table_path = self.path / name table = Table.create_new_table(num_columns, key, table_path) self.tables[name] = table return table
def get_table(self, name): with open(os.getcwd() + '/' + name + '/metadata.json', 'r') as fp: meta_dict = json.loads(fp.read()) fp.close() table = Table(name, meta_dict['key'], meta_dict['num_columns'], self.bufferpool, meta_dict['latest_range'], meta_dict['base_rid'], meta_dict['tail_rid'], meta_dict['tail_tracker'], meta_dict['merge_tracker'], meta_dict['base_tracker'], method='get') self.tables.update({name: table}) return table