Update createtables.py

refactor createtables.py