sql相关
Byfar_
这个作者很懒,什么都没留下…
展开
-
lpush脚本
# coding:utf-8 import json,pymysql,redis def get_from_mysql(): db = pymysql.connect(user='root', password='xxxx', host='127.0.0.1', database='wang', charset='utf8mb4') cursor = db.cursor(pymysql.cursors.DictCursor) # sql = """create table ngu原创 2022-05-18 19:45:28 · 208 阅读 · 0 评论 -
python[redis] push数据
# -*- coding: UTF-8 -*- import redis r = redis.Redis(host='xxx', port=xx, decode_responses=True, password='xxx') with open('message_data.txt', encoding='UTF-8') as f: for line in f: r.lpush('your redis key name', line) print (line) #原创 2022-05-18 18:43:23 · 438 阅读 · 0 评论 -
mysql(scrapy)
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import pymysql,datetime class XwProjectPipeline(object): d原创 2022-05-18 15:48:39 · 248 阅读 · 0 评论 -
Pymysql
一次性插入多字段 职位信息和 公司信息到 mysql 。 # 适用于表已经存在 # 插入的字段一定要和表结构字段 以及类型一样 import pymysql class JzmPipeline(object): '''把数据存储到mysql数据库中''' # 1. 在open_spider方法中, 链接Mysql数据库 def open_spider(sel...原创 2018-12-07 11:38:36 · 311 阅读 · 0 评论 -
mysql 中的一些语法
说个题外话,mysql的utf8不是真正的utf8,mb4才是。具体的google一下都是历史 sql中 %s 变量模糊查询的问题 SELECT `id`,`cityarea_name` FROM `ymm_map` WHERE cityarea_name like '%%%s%%' # 此处 %s 是一个变量 查询出重复记录 select * from 数据表 WHERE ...原创 2019-06-04 11:01:54 · 936 阅读 · 0 评论 -
mysql的安装相关
参考:https://blog.csdn.net/TD520314/article/details/80461545 如果安装版本不对,重新安装的情况下: 完全删除所有的mysql 相关文件 ! ①快捷键:win+R 在打开的运行窗口中输入命令services.msc ,点击确定,进入服务程序; ②任务栏的搜索框直接输入“控制面板” 控制面板->程序->卸载程序->...原创 2019-09-23 15:39:25 · 835 阅读 · 2 评论