Exemplo n.º 1
0
 def open(self, header_table, file, max_column_size=2000):
     """
     Create any initial files, headings, etc necessary.
     """
     self._isopen = True
     self.max_column_size = max_column_size
     self._current_primary_id = 0
     self.file = file
     
     from couchexport.export import _next_unique, _clean_name
     
     self._init()
     used_names = []
     for table_name, table in header_table:
         used_headers = []
         table_name_truncated = _clean_name(_next_unique(table_name, used_names,
                                                          self.max_table_name_size))
         used_names.append(table_name_truncated)
         def _truncate(val):
             ret = _next_unique(val, used_headers, max_column_size)
             used_headers.append(ret)
             return ret
         
         assert(len(table) == 1)
         row = table[0]
         # make sure we trim the headers
         row.data = map(_truncate, row.data)
         self._init_table(table_name, table_name_truncated)
         self._write_row(table_name, row) 
Exemplo n.º 2
0
 def _truncate(val):
     ret = _next_unique(val, used_headers, max_column_size)
     used_headers.append(ret)
     return ret