# Connect to database db = Database(sys.argv[1]) # Get table list with open("schema.yaml", "w") as out: for table in db.get_table_list(): table_name = table[0] # Table name out.write(table_name.split("_")[1] + ":\n") out.write(" lock_attributes: true\n") # Attributes out.write(" attributes:\n") table_desc = db.get_table_definition(table_name) for column_desc in table_desc: # Skip "_id" field_name = get_field_name(column_desc) if field_name == "_id": continue # Field name and type field_type = get_field_type(column_desc) out.write(" - name: " + field_name + "\n") out.write(" type: " + field_type + "\n") # Length field_length = get_field_length(column_desc)