Update sql_writer.py

And the code is finished.