Created
August 29, 2017 06:17
-
-
Save fanhaipeng0403/2e39a7b605e5bbeed55c1b623fe7999f to your computer and use it in GitHub Desktop.
连接数据库
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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