Article From:
from sqlalchemy import create_engine


PORT = 3306

DATABASE = 'first_sqlalchemy'

USERNAME = 'root'

PASSWORD = '123456'

DB_URI = "mysql+pymysql://{username}:{password}@{host}:{port}/" \

engine = create_engine(DB_URI)

#Decide whether to link successfully.

conn = engine.connect() #Link successfully fetches the pointer to the operation database.

result = conn.execute('select 1')

print(result.fetchone())#Extract a result
Link of this Article: Sqlalchemy link database

Leave a Reply

Your email address will not be published. Required fields are marked *