- 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.
推薦閱讀
- Excel函數、公式、圖表、數據處理從新手到高手
- DotNetNuke 5.4 Cookbook
- Visio圖形設計從新手到高手(兼容版·第2版)
- Spring Security 3
- ERP沙盤模擬簡明教程
- 圖像處理基礎教程(Photoshop CS5)(第2版)
- Learning VirtualDub: The complete guide to capturing, processing and encoding digital video
- CorelDRAW服裝設計實用教程(第四版)
- Lighttpd
- Photoshop CC摳圖+修圖+調色+合成+特效實戰視頻教程
- Instant Markdown
- Oracle E/Business Suite R12 Supply Chain Management
- EJB 3.1 Cookbook
- Getting Started with Oracle Hyperion Planning 11
- UG NX 9.0模具設計工廠實訓