- 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.
推薦閱讀
- 持續(xù)演進(jìn)的Cloud Native:云原生架構(gòu)下微服務(wù)最佳實(shí)踐
- Vue.js框架與Web前端開發(fā)從入門到精通
- 畫筆圣經(jīng) Photoshop專業(yè)繪畫技法
- 中文版Maya 2022完全自學(xué)教程
- Flash CC動(dòng)畫制作案例教程
- 我為PS狂 Photoshop照片處理一分鐘秘笈
- SolidWorks2014基礎(chǔ)實(shí)例教程
- 光影之書:Photoshop+Camera Raw攝影后期與創(chuàng)意合成
- 專業(yè)級(jí)音樂制作理論與實(shí)踐Pro Tools:從入門到應(yīng)用
- Excel數(shù)據(jù)管理:不加班的秘密
- 虛擬現(xiàn)實(shí):沉浸于VR夢(mèng)境
- Vue.js實(shí)戰(zhàn)
- Python Testing Cookbook
- 中文版3ds Max 2020基礎(chǔ)教程
- UG NX 11中文版從入門到精通