腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
首页
学习
活动
专区
工具
TVP
最新优惠活动
返回腾讯云官网
sktj
专栏成员
举报
1542
文章
1964979
阅读量
34
订阅数
订阅专栏
申请加入专栏
全部文章(999+)
python(292)
html(229)
编程算法(179)
http(171)
png(116)
image(114)
网络安全(107)
qt(94)
网站(89)
linux(85)
javascript(79)
flask(79)
https(74)
tcp/ip(68)
bash(67)
sql(65)
c++(62)
node.js(61)
ios(60)
css(59)
数据库(59)
class(56)
容器(50)
bash 指令(49)
jquery(48)
php(45)
bootstrap(42)
容器镜像服务(41)
云数据库 SQL Server(40)
java(30)
import(30)
缓存(26)
nginx(25)
ssh(23)
unix(22)
self(20)
android(19)
命令行工具(19)
分布式(19)
yum(19)
xml(18)
grep(18)
windows(18)
日志服务(17)
DevOps 解决方案(17)
jquery ui(16)
文件存储(16)
存储(16)
shell(16)
ftp(16)
jenkins(16)
zabbix(15)
href(15)
go(14)
json(14)
apache(14)
socket编程(14)
layui(14)
file(13)
ide(12)
git(12)
centos(12)
sqlalchemy(11)
腾讯云测试服务(11)
django(10)
init(10)
sys(10)
title(10)
负载均衡(9)
sqlite(9)
打包(9)
api(9)
开源(9)
dns(9)
zookeeper(9)
scrapy(9)
button(9)
data(9)
path(9)
text(9)
云推荐引擎(8)
kubernetes(8)
运维(8)
html5(8)
nav(8)
return(8)
row(8)
云数据库 Redis(7)
负载均衡缓存(7)
gui(7)
自动化测试(7)
flash(7)
udp(7)
数据分析(7)
container(7)
default(7)
dropdown(7)
size(7)
time(7)
toggle(7)
swift(6)
单片机(6)
github(6)
tomcat(6)
访问管理(6)
serverless(6)
面向对象编程(6)
数据结构(6)
form(6)
input(6)
random(6)
table(6)
thread(6)
actionscript(5)
oracle(5)
svn(5)
devops(5)
正则表达式(5)
nat(5)
utf8(5)
Elasticsearch Service(5)
cat(5)
label(5)
multiprocessing(5)
panel(5)
root(5)
sort(5)
width(5)
配置(5)
其他(4)
.net(4)
memcached(4)
ubuntu(4)
NAT 网关(4)
vr 视频解决方案(4)
爬虫(4)
selenium(4)
gcc(4)
微信(4)
安全(4)
canvas(4)
processing(4)
accordion(4)
block(4)
element(4)
function(4)
key(4)
line(4)
prometheus(4)
queue(4)
range(4)
release(4)
select(4)
txt(4)
脚本(4)
对象存储(3)
regex(3)
vue.js(3)
access(3)
web.py(3)
全文检索(3)
SSL 证书(3)
自动化(3)
jdk(3)
cdn(3)
kernel(3)
ipv6(3)
add(3)
carousel(3)
count(3)
daemon(3)
db(3)
grafana(3)
height(3)
list(3)
lock(3)
mysql(3)
navbar(3)
pagination(3)
pipe(3)
port(3)
process(3)
sleep(3)
tcp(3)
timeout(3)
var(3)
win32com(3)
监控(3)
设计(3)
perl(2)
erlang(2)
webview(2)
listview(2)
textview(2)
makefile(2)
apt-get(2)
spring(2)
mapreduce(2)
cci 持续集成(2)
企业(2)
babel.js(2)
游戏(2)
wordpress(2)
hive(2)
numpy(2)
openstack(2)
rpc(2)
kvm(2)
网站建设(2)
虚拟化(2)
数据库管理(2)
admin(2)
alarm(2)
alert(2)
app(2)
area(2)
argv(2)
bat(2)
border(2)
break(2)
byte(2)
client(2)
com(2)
cookie(2)
cpu(2)
dashboard(2)
date(2)
debug(2)
dot(2)
driver(2)
error(2)
excel(2)
exit(2)
filter(2)
func(2)
h2(2)
haproxy(2)
hash(2)
host(2)
hover(2)
io(2)
it(2)
jobs(2)
keepalived(2)
ldap(2)
location(2)
map(2)
min(2)
object(2)
output(2)
ping(2)
position(2)
python3(2)
reactor(2)
script(2)
semaphore(2)
set(2)
sh(2)
shadow(2)
slide(2)
space(2)
split(2)
target(2)
view(2)
wait(2)
webdriver(2)
word(2)
worker(2)
wrapper(2)
zip(2)
备份(2)
变量(2)
布局(2)
部署(2)
对象(2)
服务器(2)
高可用(2)
集群(2)
架构(2)
权限(2)
手机(2)
数据(2)
算法(2)
硬件(2)
优化(2)
装饰器(2)
云服务器(1)
内容分发网络 CDN(1)
数据挖掘(1)
objective-c(1)
xcode(1)
c 语言(1)
c#(1)
ruby(1)
r 语言(1)
react(1)
ajax(1)
typescript(1)
硬件开发(1)
matlab(1)
jar(1)
maven(1)
深度学习(1)
腾讯云可观测平台(1)
TDSQL MySQL 版(1)
消息队列 CMQ 版(1)
域名注册(1)
数据加密服务(1)
文字识别(1)
短信(1)
图像处理(1)
数据备份(1)
渲染(1)
url 安全(1)
数据安全(1)
xslt & xpath(1)
grunt(1)
spark(1)
jvm(1)
erp(1)
npm(1)
二叉树(1)
单元测试(1)
markdown(1)
ddos(1)
rabbitmq(1)
iis(1)
scikit-learn(1)
ntp(1)
小程序(1)
物联网(1)
hbase(1)
iview ui(1)
腾讯云开发者社区(1)
云计算(1)
kafka(1)
机器学习平台(1)
网站渗透测试(1)
ascii(1)
迁移(1)
fiddler(1)
实时监控(1)
流计算 Oceanus(1)
持续集成(1)
alamofire(1)
async(1)
awk(1)
backup(1)
binary(1)
bind(1)
buffer(1)
build(1)
camera(1)
case(1)
categories(1)
cell(1)
center(1)
cgi(1)
chmod(1)
chrome(1)
click(1)
clock(1)
coding(1)
combinations(1)
comments(1)
connect(1)
console(1)
contains(1)
csv(1)
datasource(1)
datetime(1)
decimal(1)
deferred(1)
dereference(1)
diff(1)
digits(1)
dimensions(1)
directory(1)
distance(1)
document(1)
download(1)
dump(1)
editor(1)
el(1)
elasticsearch(1)
event(1)
exe(1)
extract(1)
fadeout(1)
filenames(1)
filepath(1)
find(1)
footer(1)
format(1)
fs(1)
global(1)
google(1)
grid(1)
handler(1)
header(1)
headless(1)
hidden(1)
hide(1)
ini(1)
inline(1)
insert(1)
installation(1)
int(1)
iptables(1)
ipv4(1)
join(1)
kubectl(1)
lambda(1)
launch(1)
lines(1)
load(1)
localhost(1)
ls(1)
mailto(1)
match(1)
math(1)
memory(1)
merge(1)
message(1)
mkmapview(1)
mmap(1)
mobile(1)
mono(1)
ode(1)
offset(1)
openldap(1)
openpyxl(1)
overflow(1)
paste(1)
patch(1)
pdf(1)
persistence(1)
pickle(1)
pip(1)
point(1)
policy(1)
pool(1)
popover(1)
prefix(1)
private(1)
proc(1)
progress(1)
properties(1)
ps(1)
puppet(1)
pywin32(1)
readfile(1)
redis(1)
reference(1)
refresh(1)
replication(1)
reset(1)
responsive(1)
restore(1)
rewrite(1)
rgb(1)
route(1)
samba(1)
screen(1)
scrum(1)
security(1)
send(1)
sequence(1)
server(1)
setter(1)
smtplib(1)
spam(1)
sqlite3(1)
src(1)
state(1)
status(1)
stderr(1)
string(1)
sum(1)
super(1)
swap(1)
swing(1)
tabs(1)
tail(1)
tar(1)
templates(1)
textarea(1)
threadpool(1)
timedelta(1)
tkinter(1)
tooltip(1)
trace(1)
uri(1)
urllib(1)
valueerror(1)
version(1)
vhosts(1)
vi(1)
viewer(1)
vr(1)
web(1)
wiki(1)
window(1)
xlsx(1)
编译(1)
表格(1)
插件(1)
磁盘(1)
代理(1)
登录(1)
动画(1)
队列(1)
二进制(1)
反向代理(1)
分页(1)
工作(1)
管理(1)
函数(1)
后台(1)
基础(1)
接口(1)
进程(1)
镜像(1)
客户端(1)
内存(1)
排序(1)
事件(1)
索引(1)
同步(1)
文件系统(1)
系统(1)
效率(1)
性能(1)
虚拟主机(1)
语法(1)
域名(1)
指针(1)
重定向(1)
状态机(1)
自动化运维(1)
字符串(1)
搜索文章
搜索
搜索
关闭
Mysql 索引(学习笔记十二)
数据库
云数据库 SQL Server
sql
数据结构
全文检索
MySQL索引的建立对于MySQL的高效运行是很重要的,索引可以大大提高MySQL的检索速度。
用户5760343
2022-05-23
430
0
python 操作DB
全文检索
linux
编程算法
python
数据库
import os from random import randrange as rand COLSIZ = 10 FIELDS = ('login', 'userid', 'projid') RDBMSs = {'s': 'sqlite', 'm': 'mysql', 'g': 'gadfly'} DBNAME = 'test' DBUSER = 'root' DB_EXC = None NAMELEN = 16 tformat = lambda s: str(s).title().ljust(COLSIZ) cformat = lambda s: s.upper().ljust(COLSIZ) def setup(): return RDBMSs[raw_input(''' Choose a database system: (M)ySQL (G)adfly (S)QLite Enter choice: ''').strip().lower()[0]] def connect(db): global DB_EXC dbDir = '%s_%s' % (db, DBNAME) if db == 'sqlite': try: import sqlite3 except ImportError: try: from pysqlite2 import dbapi2 as sqlite3 except ImportError: return None DB_EXC = sqlite3 if not os.path.isdir(dbDir): os.mkdir(dbDir) cxn = sqlite3.connect(os.path.join(dbDir, DBNAME)) elif db == 'mysql': try: import MySQLdb import _mysql_exceptions as DB_EXC except ImportError: return None try: cxn = MySQLdb.connect(db=DBNAME) except DB_EXC.OperationalError: try: cxn = MySQLdb.connect(user=DBUSER) cxn.query('CREATE DATABASE %s' % DBNAME) cxn.commit() cxn.close() cxn = MySQLdb.connect(db=DBNAME) except DB_EXC.OperationalError: return None elif db == 'gadfly': try: from gadfly import gadfly DB_EXC = gadfly except ImportError: return None try: cxn = gadfly(DBNAME, dbDir) except IOError: cxn = gadfly() if not os.path.isdir(dbDir): os.mkdir(dbDir) cxn.startup(DBNAME, dbDir) else: return None return cxn def create(cur): try: cur.execute(''' CREATE TABLE users ( login VARCHAR(%d), userid INTEGER, projid INTEGER) ''' % NAMELEN) except DB_EXC.OperationalError: drop(cur) create(cur) drop = lambda cur: cur.execute('DROP TABLE users') NAMES = ( ('aaron', 8312), ('angela', 7603), ('dave', 7306), ('davina',7902), ('elliot', 7911), ('ernie', 7410), ('jess', 7912), ('jim', 7512), ('larry', 7311), ('leslie', 7808), ('melissa', 8602), ('pat', 7711), ('serena', 7003), ('stan', 7607), ('faye', 6812), ('amy', 7209), ('mona', 7404), ('jennifer', 7608), ) def randName(): pick = set(NAMES) while pi
用户5760343
2022-05-14
559
0
python QA站点
全文检索
git
git链接地址:https://github.com/huangantai/sihelper
用户5760343
2019-11-21
912
0
没有更多了
社区活动
【纪录片】中国数据库前世今生
穿越半个世纪,探寻中国数据库50年的发展历程
立即查看
Python精品学习库
代码在线跑,知识轻松学
立即查看
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
立即体验
技术创作特训营·精选知识专栏
往期视频·千货材料·成员作品 最新动态
立即查看
领券
问题归档
专栏文章
快讯文章归档
关键词归档
开发者手册归档
开发者手册 Section 归档