def save_user_clan_relationship():
    init_db_cmd = "create table if not exists clans (clan_id int(8) unique, user_id int(10));"
    curs_users.execute(init_db_cmd)

    for clan_id in get_all_clans_ids():
        members = wg_api.get_clans_members_list_by_id(clan_id)
        for user_id in members:
            curs_users.execute("insert into clans values (?,?)", (clan_id, user_id))
    conn_users.commit()
def save_all_users_data():
    dt = datetime.datetime.now()
    for clan_id in get_all_clans_ids():
        try:
            save_all_users_data_from_clan(clan_id, dt)
        except Exception as e:
            print e
        print "clan " + str(clan_id) + " done"
        if clan_id % 50 == 0:
            conn_users.commit()
    conn_users.commit()