Made the Python code consistent with the updated SQL interface