- MySQL for Python
- Albert Lukaszewski, PhD
- 76字
- 2021-04-13 17:12:27
In MySQL for Python, all database objects are discrete. All you need do is to connect with each under a different name. Consider the following:
mydb1 = MySQLdb.connect(host="localhost", user="skipper", passwd="mysecret", db="fish") mydb2 = MySQLdb.connect(host="localhost", user="skipper", passwd="mysecret", db="fruit") cursor1 = mydb1.cursor() cursor2 = mydb2.cursor()
The objects then function like any other variable or object. By calling their methods and attributes separately, you can interact with either or even copy from one to the other.
推薦閱讀
- Vue.js前端開發技術
- AutoCAD 2018實用教程(第5版)
- 持續演進的Cloud Native:云原生架構下微服務最佳實踐
- Cinema 4D 2024+AI工具詳解與實戰(視頻微課·全彩版)
- Alice 3 Cookbook
- Premiere Pro CC 2018基礎教程(第3版)
- 說服力:工作型PPT該這樣做(第2版)
- Photoshop+CorelDRAW平面設計案例實戰:從入門到精通(視頻自學全彩版)
- CAD/CAE技術應用
- iOS智能手機APP界面設計實戰教程
- 攝影師的后期必修課(RAW格式篇)
- Mobile Web Development
- Building SOA/Based Composite Applications Using NetBeans IDE 6
- 精通AutoCAD 2013機械設計
- AutoCAD 2020中文版完全自學一本通