All pastes #178698 Raw Edit

Miscellany

public text v1 · immutable
#178698 ·published 2006-09-21 14:31 UTC
rendered paste body
def getFilename(schema):
  f = open(schema, "r")
  d = {}
  filenames = []
  for line in f:
    if line.startswith("d"):
      path = line.split()[2]
      # Split out the unique table ID
      # First take the core section: "TRANSACTION":7,64
      # Now split out the unique number - 7
      j = line.split()[1]
      if "Schema" not in j:
        k = j.split(':')[1].split(',')[0]
        if k not in d:
          d[k] = 1
        else:
          d[k] = d[k] + 1
  for t in d.items():
    filenames.append(path + "/" + DBNAME + "_" + str(t[0]) + ".d" + str(t[1]))
  return filenames