pip3 install PyMySQL
from sqlalchemy import create_engine
from config import get_config
from sqlalchemy import text
if __name__ == '__main__':
database = 'mysql'
host = get_config(f'{database}', 'host')
port = int(get_config(f'{database}', 'port'))
username = get_config(f'{database}', 'username')
password = get_config(f'{database}', 'password')
database_name = get_config(f'{database}', 'database')
engine = create_engine('mysql+pymysql://' + f'{username}:{password}@{host}:3306/{database_name}', echo=True)
sql = 'select clue_url,hbbq_users_id,hbbq_works_id ,id from hbbq_works_doubtful_clue where txt_status = 0 and status = 0'
conn = engine.connect()
result = conn.execute(text(sql))
for row in result:
print(row)