数据库
fsj233
这个作者很懒,什么都没留下…
展开
-
python连接postgresql数据库
import psycopg2#连接数据库conn = psycopg2.connect(database=“postgres”, user=“postgres”,password=“postgres”, host=“202.202.66.169”, port=“32786”)#创建游标cursor = conn.cursor()#执行mysql语句cursor.execute(“select * from diagnosis_traindata”)#提交命令conn.commit()原创 2021-04-22 10:49:19 · 111 阅读 · 0 评论 -
Python连接mysql数据库
Python连接mysql数据库安装三个包:pip install pandaspip install sqlalchemypip install pymysql数据库连接:import pandas as pdfrom sqlalchemy import create_engine#初始化数据库连接#按实际情况依次填写MySQL的用户名、密码、IP地址、端口、数据库名engine = create_engine(‘mysql+pymysql://root:12345678@local原创 2021-04-22 10:44:55 · 102 阅读 · 0 评论