from mksc.core import reader
import os

def save_result(data, mode="local"):
    cfg = reader.config()
    if mode == "local":
        data.to_csv(os.path.join(cfg.get('PATH', 'save_dir'), 'apply_result.csv'), index=False)
    elif mode == "remote":
        data.to_sql(cfg.get('DATABASE', 'schema_name'), cfg.get('DATABASE', 'save_engine_url'), if_exists='append')
