Python对接六大主流数据库,只需三步
作为近两年来最火的编程语言的python,受到广大程序员的追捧必然是有其原因的,如果要挑出几点来讲的话,第一条那就python语法简洁,易上手,第二条呢?
便是python有着极其丰富的第三方的库。
所以不管你使用的关系型数据库是oracle,mysql, sqlserver,还是关系型数据库redis,mongoDB。
python都有有与之对应的第三方库。
下面就来为大家一一介绍一下!


Mysql
我们先来看看如何对接mysql数据库,python2和python3中对接mysql的库是不一样的。
在我们以这里python3为标准(毕竟python2在不久的将来官方就不再维护了)。
在python3中对接mysql数据库使用到的库为pymysql模块。
1、安装pymysql

2、快速上手


Oracle
python中对接oracle数据库,使用的第三方库为cx_Oracle
1、安装

2、快速上手


Sql—server
python对接sqlserver使用的第三方库:pymssql
1、安装pymassql

2、快速上手


PostgreSQL
python对接postgreSQL使用的模块是psycopg2
1、安装

2、快速上手


MongoDB
python中操作mongodb使用的第三方库为 pymongo
1、安装pymogo

2、快速上手


Redis
python操作redis的模块为redis
1、安装

2、快速上手


时间:2019-08-02 00:31 来源:可思数据 转发量:次
声明:本站部分作品是由网友自主投稿和发布、编辑整理上传,对此类作品本站仅提供交流平台,转载的目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,不为其版权负责。如果您发现网站上有侵犯您的知识产权的作品,请与我们取得联系,我们会及时修改或删除。
相关文章:
- [数据挖掘]底层I/O性能大PK:Python/Java被碾压,Rust有望取代
- [数据挖掘]RedMonk语言排行:Python力压Java,Ruby持续下滑
- [数据挖掘]不得了!Python 又爆出重大 Bug~
- [数据挖掘]TIOBE 1 月榜单:Python年度语言四连冠,C 语言再次
- [数据挖掘]TIOBE12月榜单:Java重回第二,Python有望四连冠年度
- [数据挖掘]这个可能打败Python的编程语言,正在征服科学界
- [数据挖掘]2021年编程语言趋势预测:Python和JavaScript仍火热,
- [数据挖掘]Spark 3.0重磅发布!开发近两年,流、Python、SQL重
- [数据挖掘]Python 为什么推荐蛇形命名法?
- [数据挖掘]Python才是世界上最好的语言
相关推荐:
网友评论: