Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fanhaipeng0403/2e39a7b605e5bbeed55c1b623fe7999f to your computer and use it in GitHub Desktop.
Save fanhaipeng0403/2e39a7b605e5bbeed55c1b623fe7999f to your computer and use it in GitHub Desktop.
连接数据库
from sqlalchemy import create_engine, text
from sqlalchemy.engine.url import URL
url=URL(drivername='mysql+pymysql', username='root', password="123", host="localhost",
port=3306, database="bi_dev")
engine = create_engine(url)
query_result = engine.execute(
text("""SELECT user_id, display_name FROM bi_user limit 100"""))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment