- 博客(21)
- 收藏
- 关注
原创 buff/cache的问题
在后台导入sql文件到mysql,发现-bash-4.2$ free -h total used free shared buff/cache availableMem: 30G 1.8G 229M 20M 28G 28G...
2018-12-26 17:50:53
2364
原创 导入图片数据报错, 2006 - MySQL server has gone away
1、应用程序(比如PHP)长时间的执行批量的MYSQL语句。最常见的就是采集或者新旧数据转化。解决方案:在my.ini文件中添加或者修改以下两个变量:wait_timeout=2880000interactive_timeout = 2880000关于两个变量的具体说明可以google或者看官方手册。如果不能修改my.cnf,则可以在连接数据库的时候设置CLIENT_INTERACT...
2018-12-25 18:26:01
226
原创 MySQL8.0提示 caching_sha2_passwor' cannot be loaded
一 SELECT `user`, `host`, `authentication_string`, `plugin` FROM mysql.user;查询如下,plugin为sha2mysql> SELECT `user`, `host`, `authentication_string`, `plugin` FROM mysql.user;+------------------+---...
2018-11-08 14:19:00
291
原创 在单独的脚本中直接使用django的models
实际就是先确定自己的系统话就目录pwd = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))sys.path.append(pwd)os.environ['DJANGO_SETTINGS_MODULE'] = 'cnsa_service.settings'import django...
2018-10-19 15:45:49
721
原创 mysql创建库,表,权限操作
1、create schema [数据库名称] default character set utf8 collate utf8_general_ci;--创建数据库 采用create schema和create database创建数据库的效果一样。2、create user '[用户名称]'@'%' identified by '[用户密码]';--创建用户 密码8位以上,包括:...
2018-10-17 12:05:14
215
原创 Treading类使用时出现错误RuntimeError: thread.__init__() not called
在写一个多线程类的时候调用报错 RuntimeError: thread.__init__() not calledclass DiskCheckTread(threading.Thread): def __init__(self, path): threading.Thread.__init__(self) self.path = path ...
2018-10-08 17:33:57
840
原创 (2003, "Can't connect to MySQL server on '192.168.60.172' (99)")错误
mysql连上一段时间连不上报错了,(2003, "Can't connect to MySQL server on '192.168.60.172' (99)")此类错误是连接数超过设定的限制引起检查到代码如下:class PathProperty(object): def __init__(self,place, path=''): self.path = path ...
2018-07-13 09:37:20
2471
原创 mysql 批量删除表
使用Select CONCAT( 'drop table ', table_name, ';' ) FROM information_schema.tables Where table_name LIKE 'sample_%';可生成drop表语句,然后可以批量删除:drop table seq_data_tmp_gf_sz_20180129;drop table seq_data_tmp_gf_...
2018-07-12 10:41:59
13779
3
原创 django中,用vue.js获取后端json数据并加载
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Vue 测试实例 - 菜鸟教程(runoob.com)</title><script src="https://cdn.bootcss.com/vue/2.2.2/vue.min
2018-06-20 18:55:08
3349
原创 django增加数据显示别名
django添加数据显示别名,在python3 和2中不同,需要在设计表中添加如下:python3 :def __str__(self): data = self.city + ' ' + self.area return datapython2:def __unicode__(self): return self.title...
2018-06-15 16:25:51
2011
原创 mysql连接问题
需要远程连接rootdjango连接出现Access denied for user 'root'@'localhost' 错误手动cmd连接出现错误:Authentication plugin 'caching_sha2_password' cannot be loaded:解决办法:ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_nati...
2018-06-13 11:22:59
144
原创 离线安装paramiko
在公司centos上安装paramiko,无法直接连通互联网,所以只能一个个下载包,依赖包有以下:pyasn1-0.4.2.tar.gzPyNaCl-1.2.1.tar.gzcffi-1.11.4.tar.gz(需要依赖yum install -y libffi libffi-devel,依赖python包pycparser)cryptography( 需要安装sudo yum install o...
2018-04-25 17:00:47
2080
1
原创 两个大表的个别字段的模糊匹配查询
需求:有两个表A,和B,分别为300万和400万数据,B中path字段包含目录信息,需要匹配A中的path信息,及B.path in A.path且需要包含信息。问题:1 如果直接关联查询,如用like,instr,查询非常慢,执行一天都执行不出来结果。执行计划无法使用索引,直接全表扫描,效率奇差2 采用 full text索引后,搜索出来的结果都是模糊查询,一大堆结果,所以无法联合查询解决办法:...
2018-03-30 16:27:23
7773
原创 用python读取oracle的clob类型数据的处理
用python cx_Oracle读取oracle数据,存在clob类型数据,利用dbms_lob.substr(extension,4000)来转换成python的str类型,大于3200时候会报错(很多地方是4000,应该是其他设置原因)ORA-06502: PL/SQL: 数字或值错误 : 字符串缓冲区太小针对此问题解决方法:1 直接读取clob数据 ,其数据类型在oracle为cx_Or...
2018-03-22 15:37:44
4067
1
转载 深刻理解Python中的元类(metaclass)(修正)
此文原始出处https://stackoverflow.com/questions/100003/what-is-a-metaclass-in-python翻译有错误,修正了一些类也是对象在理解元类之前,你需要先掌握Python中的类。Python中类的概念借鉴于Smalltalk,这显得有些奇特。在大多数编程语言中,类就是一组用来描述如何生成一个对象的
2017-10-27 01:49:50
270
转载 python @classmethod 的使用场合
官方的说法: classmethod(function)中文说明:classmethod是用来指定一个类的方法为类方法,没有此参数指定的类的方法为实例方法,使用方法如下: class C: @classmethod def f(cls, arg1, arg2, ...): ... 看后之后真是一头雾水。说的啥子东西呢??? 自己到国外的论坛
2017-10-25 01:04:30
23368
11
原创 python卸载没卸载干净导致再次安装失败
错误内容如下:There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support or package vendor' I have no bloody idea what
2017-07-24 01:01:47
21916
2
原创 命令行接口神器:fire
谷歌开源了命令行接口库fire,安装直接pip instal file即可。简单易用,对原有代码可以零改动实现命令行调用,简单明了例子:sr/bin/env pythonimport fireclass Example(object): def hello(self, name='world'): """Says hello to the specified name.""
2017-07-19 22:24:44
971
原创 django Get css,js文件返回304无法正常加载的问题
pycharm现象:[18/Jul/2017 23:27:26] "GET /static/201408210521231921042235.png HTTP/1.1" 304 0[18/Jul/2017 23:27:26] "GET /static/20140821110101152399045.png HTTP/1.1" 304 0[18/Jul/2017 23:27:26] "G
2017-07-18 23:53:03
3991
转载 关于python的下划线理解
Python 用下划线作为变量前缀和后缀指定特殊变量/方法。主要存在四种情形 1. object # public 2. __object__ # special, python system use, user should not define like it 3. __object # private (name mangling during runtime) 4. _
2017-02-20 22:03:43
203
原创 lxml模块安装失败
环境:win10 64 python27,已经安装 vc python 27,无效src\lxml\includes\etree_defs.h(14) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory c:\users\xzfeng\a
2016-12-26 02:19:21
714
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人