[refactor] move a file manupilation from c++ to python.
[refactor] remove getenv statement.
[bug-fix] added file existance check.
[refactor] changed SQL keywords to uppercase.