converson of common_sql to python